Otel changes and testutils#249
Conversation
Coverage Report for CI Build 29833643914Coverage increased (+0.6%) to 94.275%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
|
|
FastAPI (and other class-patching) instrumentation is now order-sensitive. This is the one real behavioral trap. FastAPIInstrumentor().instrument() patches fastapi.FastAPI so only apps instantiated after the call get traced. Under the old opentelemetry-instrument wrapper, patching happened at interpreter startup before any user code, so ordering was guaranteed. Now configure_opentelemetry() must run before the service constructs its FastAPI app, or requests won't be traced. |
Co-authored-by: Camill Kaipf <87362681+ckaipf@users.noreply.github.com>
I don't think we can avoid that. Edit: |
Addressed in dc01a38. |
Changed OpenTelemetry config code to manually instrument all installed instrumentation libraries.
This should no longer be used in conjunction with opentelemetry-instrument, which was fragile, either way.
Also removed explicitly setting an env variable to disable OTel as this was no longer working with current OTel versions, as the code evaluating the env variable now runs before our code during autoinstrumentation.
Instead simply skipping
TracerProvidercreation should serve the same purpose.Added testutils (and some sanity tests for those) that can be used in the services to build tests around span capture.
Not really sure we need both of the variants, i.e. TracerProvider already exists vs. create a new one.
Might make sense in a unit vs. integration test scenario, where the integration tests hit the normal startup code.
Changes should be effectively non-breaking, so this only bumps the minor version.