mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-01 18:01:28 -06:00
prevent having a nil traceprovider
This commit is contained in:
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
@@ -74,7 +74,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
)
|
||||
|
||||
{
|
||||
handle = svc.NewTracing(handle)
|
||||
//handle = svc.NewTracing(handle)
|
||||
handle = svc.NewInstrument(handle, options.Metrics)
|
||||
handle = svc.NewLogging(handle, options.Logger)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
@@ -3,6 +3,8 @@ package svc
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
v0proto "github.com/owncloud/ocis/thumbnails/pkg/proto/v0"
|
||||
thumbnailsTracing "github.com/owncloud/ocis/thumbnails/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@@ -21,16 +23,20 @@ type tracing struct {
|
||||
|
||||
// GetThumbnail implements the ThumbnailServiceHandler interface.
|
||||
func (t tracing) GetThumbnail(ctx context.Context, req *v0proto.GetThumbnailRequest, rsp *v0proto.GetThumbnailResponse) error {
|
||||
tracer := thumbnailsTracing.TraceProvider.Tracer("thumbnails")
|
||||
ctx, span := tracer.Start(ctx, "Thumbnails.GetThumbnail")
|
||||
defer span.End()
|
||||
var span trace.Span
|
||||
|
||||
span.SetAttributes(
|
||||
attribute.KeyValue{"filepath", attribute.StringValue(req.Filepath)},
|
||||
attribute.KeyValue{"thumbnail_type", attribute.StringValue(req.ThumbnailType.String())},
|
||||
attribute.KeyValue{"width", attribute.IntValue(int(req.Width))},
|
||||
attribute.KeyValue{"height", attribute.IntValue(int(req.Height))},
|
||||
)
|
||||
if thumbnailsTracing.TraceProvider != nil {
|
||||
tracer := thumbnailsTracing.TraceProvider.Tracer("thumbnails")
|
||||
ctx, span = tracer.Start(ctx, "Thumbnails.GetThumbnail")
|
||||
defer span.End()
|
||||
|
||||
span.SetAttributes(
|
||||
attribute.KeyValue{"filepath", attribute.StringValue(req.Filepath)},
|
||||
attribute.KeyValue{"thumbnail_type", attribute.StringValue(req.ThumbnailType.String())},
|
||||
attribute.KeyValue{"width", attribute.IntValue(int(req.Width))},
|
||||
attribute.KeyValue{"height", attribute.IntValue(int(req.Height))},
|
||||
)
|
||||
}
|
||||
|
||||
return t.next.GetThumbnail(ctx, req, rsp)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
Propagator propagation.TextMapPropagator
|
||||
|
||||
// TraceProvider is the global trace provider for the proxy service.
|
||||
TraceProvider *sdktrace.TracerProvider
|
||||
TraceProvider = sdktrace.NewTracerProvider()
|
||||
)
|
||||
|
||||
func Configure(cfg *config.Config, logger log.Logger) error {
|
||||
|
||||
Reference in New Issue
Block a user