Skip to content

Commit

Permalink
contrib/go-chi: Appends spankind and component to existing opts which…
Browse files Browse the repository at this point in the history
… fixes tests
  • Loading branch information
zarirhamza committed Dec 12, 2022
1 parent 5f28620 commit dbcc08e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions contrib/go-chi/chi.v5/chi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func Middleware(opts ...Option) func(next http.Handler) http.Handler {
fn(cfg)
}
log.Debug("contrib/go-chi/chi.v5: Configuring Middleware: %#v", cfg)
spanOpts := append(cfg.spanOpts, tracer.ServiceName(cfg.serviceName))
spanOpts = append(cfg.spanOpts, tracer.Tag(ext.Component, "go-chi/chi.v5"))
spanOpts = append(cfg.spanOpts, tracer.Tag(ext.SpanKind, ext.SpanKindServer))
spanOpts := append(cfg.spanOpts, tracer.ServiceName(cfg.serviceName),
tracer.Tag(ext.Component, "go-chi/chi.v5"),
tracer.Tag(ext.SpanKind, ext.SpanKindServer))
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if cfg.ignoreRequest(r) {
Expand Down
6 changes: 3 additions & 3 deletions contrib/go-chi/chi/chi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ func Middleware(opts ...Option) func(next http.Handler) http.Handler {
fn(cfg)
}
log.Debug("contrib/go-chi/chi: Configuring Middleware: %#v", cfg)
spanOpts := append(cfg.spanOpts, tracer.ServiceName(cfg.serviceName))
spanOpts := append(cfg.spanOpts, tracer.ServiceName(cfg.serviceName),
tracer.Tag(ext.Component, "go-chi/chi"),
tracer.Tag(ext.SpanKind, ext.SpanKindServer))
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if cfg.ignoreRequest(r) {
next.ServeHTTP(w, r)
return
}
opts := spanOpts
opts = append(opts, tracer.Tag(ext.Component, "go-chi/chi"))
opts = append(opts, tracer.Tag(ext.SpanKind, ext.SpanKindServer))
if !math.IsNaN(cfg.analyticsRate) {
opts = append(opts, tracer.Tag(ext.EventSampleRate, cfg.analyticsRate))
}
Expand Down

0 comments on commit dbcc08e

Please sign in to comment.