Skip to content

Commit

Permalink
I’ve added my DCO signoff at the project’s request. There are no othe…
Browse files Browse the repository at this point in the history
…r changes.

Signed-off-by: Rehan Pasha <rehan.pasha@fmr.com>
  • Loading branch information
rehanpfmr committed May 28, 2024
1 parent 7352c6e commit ce53f63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The `WithSchemaURL` option function in `go.opentelemetry.io/contrib/bridges/otelslog`.
This option function is used as a replacement of `WithInstrumentationScope` to specify the semantic convention schema URL for the logged records. (#5588)
- Add support for Cloud Run jobs in `go.opentelemetry.io/contrib/detectors/gcp`. (#5559)
- Add `*gin.Context` Filter parameter in `go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin`. gin.Context has FullPath() method, which returns a matched route full path. (#3070)

### Changed

Expand Down
11 changes: 11 additions & 0 deletions instrumentation/github.com/gin-gonic/gin/otelgin/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ type config struct {
// be traced. A Filter must return true if the request should be traced.
type Filter func(*http.Request) bool

// Adding new Filter parameter (*gin.Context)
//gin.Context has FullPath() method, which returns a matched route full path.
type GinFilter func(*gin.Context) bool

// SpanNameFormatter is used to set span name by http.request.
type SpanNameFormatter func(r *http.Request) string

Expand Down Expand Up @@ -70,6 +74,13 @@ func WithFilter(f ...Filter) Option {
})
}

// WithGinFilter adds a filter to the list of filters used by the handler.
func WithGinFilter(f ...Filter) Option {
return optionFunc(func(c *config) {
c.Filters = append(c.Filters, f...)
})
}

// WithSpanNameFormatter takes a function that will be called on every
// request and the returned string will become the Span Name.
func WithSpanNameFormatter(f func(r *http.Request) string) Option {
Expand Down

0 comments on commit ce53f63

Please sign in to comment.