Skip to content

Commit

Permalink
trace http endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Jul 12, 2024
1 parent ee73cd8 commit dddb62e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/contrib/instrumentation/runtime"
"go.opentelemetry.io/otel"
"google.golang.org/grpc"

_ "google.golang.org/grpc/encoding/gzip"
Expand Down Expand Up @@ -257,7 +258,11 @@ func Main() *cli.Command {
Metrics: ms.Export,
Logs: ls.Export,
}
aoh := otelhttp.NewHandler(svc, "fri_otlp_http")
aoh := otelhttp.NewHandler(svc, "fri_otlp_http",
otelhttp.WithTracerProvider(
otel.GetTracerProvider(),
),
)
osvr := &http.Server{
Handler: aoh,
BaseContext: func(l net.Listener) context.Context { return ctx },
Expand All @@ -271,7 +276,11 @@ func Main() *cli.Command {
}
}()

oh := otelhttp.NewHandler(mux, "fri_http_api")
oh := otelhttp.NewHandler(mux, "fri_http_api",
otelhttp.WithTracerProvider(
otel.GetTracerProvider(),
),
)
svr := &http.Server{
Handler: audit.Audit(oh),
BaseContext: func(l net.Listener) context.Context { return ctx },
Expand Down

0 comments on commit dddb62e

Please sign in to comment.