Skip to content

Conversation

@itssaharsh
Copy link
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

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.7%. Comparing base (63b24b0) to head (0a77a74).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7825     +/-   ##
=======================================
- Coverage   81.7%   81.7%   -0.1%     
=======================================
  Files        304     304             
  Lines      23252   23260      +8     
=======================================
+ Hits       19009   19015      +6     
- Misses      3860    3862      +2     
  Partials     383     383             
Files with missing lines Coverage Δ
...e/otlptracegrpc/internal/observ/instrumentation.go 100.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +246 to +249
success := successful(e.nSpans, err)
addOpt := get[metric.AddOption](addOptPool)
defer put(addOptPool, addOpt)
*addOpt = append(*addOpt, e.inst.addOpt)
Copy link
Contributor

Choose a reason for hiding this comment

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

Preserve the existing code flow. Changing this is not needed and a distraction for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey so I got stuck here because if the if block in which success is there doesn't run the other block where success is used will panick that's why I changed structure.

}

recOpt := get[metric.RecordOption](recordOptPool)
defer put(recordOptPool, recOpt)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this changed?

Copy link
Contributor Author

@itssaharsh itssaharsh Jan 23, 2026

Choose a reason for hiding this comment

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

I changed it because I wanted to put back the slice manually each time. I will change it to defer if it is better but I thought putting it back instantly would be better.

@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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants