Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add span start end end options to gin configuration #5250

Closed
wants to merge 4 commits into from

Conversation

dmathieu
Copy link
Member

@dmathieu dmathieu commented Mar 6, 2024

This allows setting span start and end options to the gin configuration, so folks can (for example), enable stack traces to recorded errors.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.2%. Comparing base (f3ba8c2) to head (d598c72).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5250   +/-   ##
=====================================
  Coverage   61.2%   61.2%           
=====================================
  Files        185     185           
  Lines      11207   11216    +9     
=====================================
+ Hits        6865    6874    +9     
  Misses      4142    4142           
  Partials     200     200           
Files Coverage Δ
...ation/github.com/gin-gonic/gin/otelgin/gintrace.go 80.5% <100.0%> (+0.2%) ⬆️
...ntation/github.com/gin-gonic/gin/otelgin/option.go 100.0% <100.0%> (ø)

@mikk2168 mikk2168 mentioned this pull request Mar 7, 2024
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Similarly to #5251 (review)

The user can e.g. change the span kind using https://pkg.go.dev/go.opentelemetry.io/otel/trace#WithSpanKind or create attributes which are not aligned with the semantic conventions and they others may blame that the instrumentation library does not follow semantic conventions.

However, with the difference that func HTML(c *gin.Context, code int, name string, obj interface{}) { is calling span.RecordError(err) when c.HTML(code, name, obj) panics.

Maybe we should just add an option to capture stacktraces instead?

@dmathieu dmathieu closed this Apr 3, 2024
@dmathieu dmathieu deleted the gin-span-options branch April 3, 2024 10:26
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.

None yet

3 participants