Skip to content

Commit

Permalink
改变stdout export
Browse files Browse the repository at this point in the history
  • Loading branch information
afocus committed Mar 31, 2022
1 parent bfde49c commit ecdc061
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"go.opentelemetry.io/contrib/propagators/b3"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
"go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/sdk/trace"
)
Expand Down Expand Up @@ -47,9 +46,19 @@ func ExportGRPC(endpoint string) func(ctx context.Context) (trace.SpanExporter,
}
}

type defaultExport struct{}

func (d *defaultExport) Shutdown(ctx context.Context) error {
return nil
}

func (d *defaultExport) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
return nil
}

func ExportStdOut() func(ctx context.Context) (trace.SpanExporter, error) {
return func(ctx context.Context) (trace.SpanExporter, error) {
return stdouttrace.New()
return &defaultExport{}, nil
}
}

Expand Down

0 comments on commit ecdc061

Please sign in to comment.