feat(otel): add OpenTelemetry base instrumentation#1087
Draft
dimoschi wants to merge 1 commit intoopensanctions:mainfrom
Draft
feat(otel): add OpenTelemetry base instrumentation#1087dimoschi wants to merge 1 commit intoopensanctions:mainfrom
dimoschi wants to merge 1 commit intoopensanctions:mainfrom
Conversation
- Add opentelemetry-api, opentelemetry-sdk, opentelemetry-instrumentation-fastapi, and opentelemetry-exporter-otlp-proto-http as dependencies - Use FastAPIInstrumentor for automatic HTTP metrics and traces - Add manual spans on SearchProvider operations via __init_subclass__, providing consistent tracing for both Elasticsearch and OpenSearch backends - Use stable OTEL semantic conventions (db.system.name, db.operation.name) - No manual TracerProvider setup; users configure OTEL entirely via standard env vars and opentelemetry-instrument CLI Ref: opensanctions#1079
4a14ac0 to
d5fd44d
Compare
Contributor
|
Hi, thanks for sending this and sorry for the delay! I was out for part of the week and currently working on some urgent things - will get to this beginning of next week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds OpenTelemetry instrumentation to yente (ref #1079):
FastAPIInstrumentor__init_subclass__, providing consistent tracing for both Elasticsearch and OpenSearch backendsdb.system.name,db.operation.name)TracerProvider, no new yente env vars. Users configure everything via standardOTEL_*env vars and theopentelemetry-instrumentCLINew dependencies
opentelemetry-apiopentelemetry-sdkopentelemetry-instrumentation-fastapiopentelemetry-exporter-otlp-proto-httpUsage
To enable OTEL tracing, run yente with
opentelemetry-instrument:Or configure via env vars:
Without
opentelemetry-instrument, OTEL is a no-op (zero overhead).What this does NOT include (future PRs)
/metricsPrometheus scrape endpointTest plan
tests/test_otel.pyverify span creation for HTTP requests and SearchProvider operations