Documentation

Getting Started With Python

Send OpenTelemetry traces to Telemetry Machine.

This guide describes the actions you need to take to send your OpenTelemetry traces to Telemetry Machine.

Step 1: Create a Telemetry Machine account

Before you can send us traces, you must create a Telemetry Machine account.

  1. Create an account by entering your email address and setting a password.

Step 2: Create your first dataset

  1. Select New Dataset (if you have never created a dataset before, you will be shown this wizard automatically).
  2. Select Traces as the dataset type.
  3. Enter a name for your dataset (for example, my-cool-app-traces).

The name must be unique within your organization (or for your personal account, if you don't have an organization). Beside that, you can choose any name you like.

  1. Click Create.

Step 3: Grab your API key

  1. We automatically generate an API key for you when you create a dataset.
  2. Treat the API key as a secret. For production, store it wherever you store your other secrets.

(What happens if someone else gets this API key? They will be able to send data to your dataset.)

We only show it once, but if you lose it, just click "Generate a new API key" and we'll show you a new one.

Step 4: Configure your app

These instructions work for most Python apps.

Install packages

pip install opentelemetry-instrumentation opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap --action=install

Set environment variables

export OTEL_SERVICE_NAME="my-service-name"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.telemetrymachine.com"
export OTEL_EXPORTER_OTLP_HEADERS="x-api-key=<your api key>,x-dataset-name=my-cool-app-traces"

Replace <your api key> with the API key from Step 3, and <your dataset name> with the dataset name from Step 2.

Run your app

opentelemetry-instrument is a way to run your app with lots of libraries automatically instrumented.

opentelemetry-instrument python myapp.py

Step 5: Watch your data arrive

Huzzah! You will see your data pop up in the Stream view within a few seconds.

You can click "Check for new data" if you feel impatient.

Step 6: Level up your instrumentation

The above instructions are a simple way to get instrumentation working for a Python app, but there are actually many ways to approach this.