Where the providers go in your sample
A TracerProvider and a MeterProvider are OpenTelemetry SDK objects your application creates. The Agent Observability SDK records its spans and metrics through them, and they pass that data to an exporter, which sends it over OTLP. The Agent Observability SDK does not create the providers.
The two providers
Your sample constructs the Agent Observability client, captures a generation, and calls client.shutdown(). In Milestone 7 you edit that same file: you add a TracerProvider and a MeterProvider above the line that constructs the client, shut them down after client.shutdown(), and rerun the sample.
Warning
The position in the file matters. If the providers are created after the client, traces and metrics are silently lost.
The SDK configuration page has the snippet for each supported language. The Python snippet adds:
- A
TracerProviderwith an OTLP span exporter. - A
MeterProviderwith an OTLP metric exporter. - One resource for both providers,
Resource.create({"service.name": "my-agent"}), which carries one named value, theservice.nameattribute set tomy-agent.
The snippet shuts down the providers after client.shutdown().
What the OpenTelemetry SDK reads from the environment
Set the OTLP endpoint and any auth headers through environment variables. The OpenTelemetry SDK exporters read them automatically. Generation data goes directly to the Agent Observability API.