Convert IDP service to service trace provider.
This converts the IDP service to use the service trace provider.
This commit is contained in:
@@ -4,14 +4,13 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
idpTracing "github.com/owncloud/ocis/v2/services/idp/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// Static is a middleware that serves static assets.
|
||||
func Static(root string, fs http.FileSystem) func(http.Handler) http.Handler {
|
||||
func Static(root string, fs http.FileSystem, tp trace.TracerProvider) func(http.Handler) http.Handler {
|
||||
if !strings.HasSuffix(root, "/") {
|
||||
root = root + "/"
|
||||
}
|
||||
@@ -28,7 +27,7 @@ func Static(root string, fs http.FileSystem) func(http.Handler) http.Handler {
|
||||
spanOpts := []trace.SpanStartOption{
|
||||
trace.WithSpanKind(trace.SpanKindServer),
|
||||
}
|
||||
ctx, span := idpTracing.TraceProvider.Tracer("idp").Start(r.Context(), "serve static asset", spanOpts...)
|
||||
ctx, span := tp.Tracer("idp").Start(r.Context(), "serve static asset", spanOpts...)
|
||||
defer span.End()
|
||||
r = r.WithContext(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user