Skip to content

otelgin: Add a WithSpanStartOptions option - #7261

Merged
dmathieu merged 3 commits into
open-telemetry:mainfrom
arshukla98:Issue_7247
May 13, 2025
Merged

otelgin: Add a WithSpanStartOptions option#7261
dmathieu merged 3 commits into
open-telemetry:mainfrom
arshukla98:Issue_7247

Conversation

@arshukla98

Copy link
Copy Markdown
Contributor

Closes: #7247

@github-actions
github-actions Bot requested review from akats7 and flc1125 April 24, 2025 07:35
@codecov

codecov Bot commented Apr 24, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.2%. Comparing base (abb5c4f) to head (50403a2).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7261     +/-   ##
=======================================
- Coverage   81.2%   81.2%   -0.1%     
=======================================
  Files        207     207             
  Lines      18263   18270      +7     
=======================================
+ Hits       14835   14839      +4     
- Misses      3007    3009      +2     
- Partials     421     422      +1     
Files with missing lines Coverage Δ
...ntation/github.com/gin-gonic/gin/otelgin/config.go 100.0% <100.0%> (ø)
...umentation/github.com/gin-gonic/gin/otelgin/gin.go 93.1% <100.0%> (+0.1%) ⬆️

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

@arshukla98
arshukla98 marked this pull request as ready for review April 28, 2025 07:14
@arshukla98
arshukla98 requested a review from a team as a code owner April 28, 2025 07:14

@dmathieu dmathieu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is missing tests and a changelog entry.

@arshukla98
arshukla98 marked this pull request as draft April 28, 2025 08:04
@arshukla98 arshukla98 closed this Apr 30, 2025
@arshukla98 arshukla98 reopened this Apr 30, 2025
Comment thread instrumentation/github.com/gin-gonic/gin/otelgin/config.go Outdated
Comment thread CHANGELOG.md Outdated
cfg := config{}

defaultOpts := []Option{
WithSpanOptions(oteltrace.WithSpanKind(oteltrace.SpanKindServer)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the reason for moving this part here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This structure is also used in otelhttp, as seen [here](

func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler {
h := middleware{
operation: operation,
}
defaultOpts := []Option{
WithSpanOptions(trace.WithSpanKind(trace.SpanKindServer)),
WithSpanNameFormatter(defaultHandlerFormatter),
}
).

Let me know if you’d prefer to remove it.

@flc1125 flc1125 May 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to the principle of Occam's Razor: Do not multiply entities beyond necessity.

From what I understand, the operating result would be the same even without modifying this part.

@arshukla98
arshukla98 marked this pull request as ready for review May 5, 2025 08:26
@flc1125

flc1125 commented May 5, 2025

Copy link
Copy Markdown
Member

Additionally, please correct the title of this PR.

@arshukla98
arshukla98 marked this pull request as draft May 5, 2025 13:12
@arshukla98 arshukla98 changed the title otelgin: Add a WithSpanOptions option otelgin: Add a WithSpanStartOptions option May 6, 2025

@flc1125 flc1125 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you are ready for review, you can remove the draft mode.

@arshukla98
arshukla98 marked this pull request as ready for review May 6, 2025 10:23
@arshukla98
arshukla98 requested a review from dmathieu May 8, 2025 07:53
Comment thread CHANGELOG.md Outdated
pellared and others added 2 commits May 12, 2025 13:06
Co-authored-by: Damien Mathieu <42@dmathieu.com>
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.

otelgin: Add a WithSpanOptions option

5 participants