Load Generator
The load generator is based on the Python load testing framework Locust. By default it will simulate users requesting several different routes from the frontend.
Traces¶
Initializing Tracing¶
Since this service is a locustfile, the OpenTelemetry SDK is initialized after the import statements. This code will create a tracer provider, and establish a Span Processor to use. Export endpoints, resource attributes, and service name are automatically set using OpenTelemetry environment variables.
Adding instrumentation libraries¶
To add instrumentation libraries you need to import the Instrumentors for each
library in your Python code. Locust uses the Requests
andURLLib3
libraries,
so we will import their Instrumentors.
In your code before the library is leveraged, the Instrumentor needs to be
initialized by calling instrument()
.
Once initialized, every Locust requests for this load generator will have their
own trace with a span for each of the Requests
and URLLib3
libraries.
Metrics¶
TBD
Logs¶
TBD
Baggage¶
OpenTelemetry Baggage is used by the load generator to indicate that the traces
are synthetically generated. This is done in the on_start
function by creating
a context object containing the baggage item, and associating that context for
all tasks by the load generator.