Configuring the tracing pipeline
With the packages now installed, we're ready to take our first step to generate distributed traces with OpenTelemetry – configuring the tracing pipeline. The tracing pipeline is what allows the tracing data we explored in Chapter 2, OpenTelemetry Signals – Traces, Metrics, and Logs, to be generated when the OpenTelemetry API calls are made. The pipeline also defines where and how the data will be emitted. Without a tracing pipeline, a no-op implementation is used by the API, meaning the code will not generate distributed traces. The tracing pipeline configures the following:
TracerProvider
to determine how spans should be generated- A
Resource
object, which identifies the source of the spans SpanProcessor
to describe how spans will be exportedSpanExporter
to describe where the spans will be exported
The following code imports the TracerProvider
, ConsoleSpanExporter
, and SimpleSpanProcessor
classes from the...