Skip to content

Checked if instrument enabled before measuring in oteltracegrpc#7825

Merged
dmathieu merged 10 commits intoopen-telemetry:mainfrom
itssaharsh:bump
Feb 10, 2026
Merged

Checked if instrument enabled before measuring in oteltracegrpc#7825
dmathieu merged 10 commits intoopen-telemetry:mainfrom
itssaharsh:bump

Conversation

@itssaharsh
Copy link
Copy Markdown
Contributor

This pr updates otltracegrpc for checking if the operation is enabled before adding any metric or performing operation.

tracked in #7800

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.7%. Comparing base (101e969) to head (a59d89a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...e/otlptracegrpc/internal/observ/instrumentation.go 93.7% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7825     +/-   ##
=======================================
- Coverage   81.7%   81.7%   -0.1%     
=======================================
  Files        304     304             
  Lines      23276   23281      +5     
=======================================
- Hits       19024   19021      -3     
- Misses      3865    3866      +1     
- Partials     387     394      +7     
Files with missing lines Coverage Δ
...e/otlptracegrpc/internal/observ/instrumentation.go 94.4% <93.7%> (-5.6%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
@MrAlias MrAlias changed the title Checked if fields enabled before adding to metrics Checked if instrument enabled before measuring in oteltracegrpc Jan 22, 2026
@MrAlias MrAlias added the pkg:exporter:otlp Related to the OTLP exporter package label Jan 22, 2026
@itssaharsh itssaharsh requested a review from MrAlias January 25, 2026 07:09
Copilot AI review requested due to automatic review settings February 3, 2026 04:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements performance optimizations for the OTLP trace gRPC exporter by adding Enabled() checks before metric recording operations, preventing unnecessary computation when instruments are not configured with views. This addresses part of issue #7800 which tracks the adoption of the Enabled() method across all synchronous metric instruments in the project.

Changes:

  • Added Enabled() checks for all three metric instruments (inflightSpans, exportedSpans, opDuration) before performing metric operations
  • Optimized resource pooling to only allocate pool objects when metrics are actually enabled
  • Refactored get() function formatting for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
@itssaharsh itssaharsh requested a review from dashpole February 4, 2026 13:37
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
Comment thread exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go Outdated
@dmathieu dmathieu added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Feb 10, 2026
@dmathieu dmathieu merged commit 53c10af into open-telemetry:main Feb 10, 2026
31 of 32 checks passed
@MrAlias MrAlias added this to the v1.41.0 milestone Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:exporter:otlp Related to the OTLP exporter package Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants