| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The bare MetricsCapture() inside trace_call creates a MetricsTracer without project_id or instance_id. Since every caller already provides its own MetricsCapture(resource_info) with correct labels, the one inside trace_call is redundant and records operation metrics with incomplete resource labels on every operation. Fixes googleapis#16173
There was a problem hiding this comment.
This pull request removes the MetricsCapture context manager and its associated import from the trace_call function in the OpenTelemetry tracing implementation. I have no feedback to provide.
Sorry, something went wrong.
|
What is the reason this PR is not merged yet? Log explorers on those problematic lib versions are filled up with noises. |
Sorry, something went wrong.
|
@rahul2393, Please could you take a look? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
trace_call() wraps every Spanner operation with a bare MetricsCapture() that creates a MetricsTracer without project_id or instance_id. Since every caller of trace_call already provides its own MetricsCapture(resource_info) with correct labels, the one inside trace_call is redundant and harmful.
The redundant tracer records operation metrics (via record_operation_completion()) with incomplete resource labels on every operation. Because OpenTelemetry uses cumulative aggregation, these orphan data points persist for the process lifetime and get re-exported every 60 seconds by the PeriodicExportingMetricReader. Cloud Monitoring rejects them with:
Root cause
When Python evaluates with trace_call(...) as span, MetricsCapture(resource_info):, the execution order is:
History
Fix
Remove the bare MetricsCapture() from trace_call. All ~27 call sites already provide their own MetricsCapture with correct resource labels.
Testing
All existing unit tests pass. The change only removes the redundant context manager; span/trace behavior is unchanged.
Fixes #16173