Skip to content

Conversation

@sonalgaud12
Copy link
Contributor

This PR fixes issue #8132

The WithMessageEvents option previously accepted an unexported type (event).
This change exports the type as Event.

@sonalgaud12 sonalgaud12 requested review from a team and dmathieu as code owners November 9, 2025 07:58
@sonalgaud12
Copy link
Contributor Author

Hello @dmathieu , OpenTelemetry Go enums usually prefix constants with the type name (e.g. SpanKindServer, SpanKindClient). So shall I change ReadEvents, WriteEvents to EventRead, EventWrite .

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.8%. Comparing base (7ff03d6) to head (1bd97b2).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8153   +/-   ##
=====================================
  Coverage   81.8%   81.8%           
=====================================
  Files        194     194           
  Lines      13362   13377   +15     
=====================================
+ Hits       10936   10952   +16     
+ Misses      2029    2027    -2     
- Partials     397     398    +1     
Files with missing lines Coverage Δ
instrumentation/net/http/otelhttp/config.go 83.0% <ø> (+0.9%) ⬆️

... and 7 files with indirect coverage changes

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

@sonalgaud12 sonalgaud12 requested a review from flc1125 November 13, 2025 16:53
@flc1125
Copy link
Member

flc1125 commented Nov 17, 2025

@sonalgaud12 Please fix the lint; we can use make ci for local verification.

// Different types of events that can be recorded, see WithMessageEvents.
const (
ReadEvents event = iota
unspecifiedEvent Event = iota
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
unspecifiedEvent Event = iota
unspecifiedEvents Event = iota


func TestEvent(t *testing.T) {
t.Run("constant values", func(t *testing.T) {
assert.Equal(t, otelhttp.ReadEvents, otelhttp.Event(1), "ReadEvents should be 1")
Copy link
Member

Choose a reason for hiding this comment

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

In fact, the modified expected and actual positions are incorrect; the pre-modified ones are accurate.

Of course, we could do it this way: assert.Equal(t, 1, int(otelhttp.ReadEvents), "ReadEvents should be 1")

It is worth noting that we still lack validation for unspecifiedEvents.

Copy link
Member

Choose a reason for hiding this comment

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

Only remaining issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants