generated from TrueCloudLab/basic
[#12] tracing: Optimize noop exporter
All checks were successful
DCO action / DCO (pull_request) Successful in 1m7s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m16s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m23s
Tests and linters / Staticcheck (pull_request) Successful in 1m49s
Tests and linters / Tests with -race (pull_request) Successful in 2m8s
Tests and linters / Lint (pull_request) Successful in 2m42s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m7s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m16s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m23s
Tests and linters / Staticcheck (pull_request) Successful in 1m49s
Tests and linters / Tests with -race (pull_request) Successful in 2m8s
Tests and linters / Lint (pull_request) Successful in 2m42s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
cb37f5975e
commit
6dd265d949
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,6 @@ package tracing
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
@ -12,6 +11,7 @@ import (
|
||||||
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
|
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
|
||||||
"go.opentelemetry.io/otel/sdk/resource"
|
"go.opentelemetry.io/otel/sdk/resource"
|
||||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
"go.opentelemetry.io/otel/trace/noop"
|
"go.opentelemetry.io/otel/trace/noop"
|
||||||
|
@ -133,7 +133,7 @@ func getExporter(ctx context.Context, cfg *Config) (sdktrace.SpanExporter, error
|
||||||
case StdoutExporter:
|
case StdoutExporter:
|
||||||
return stdouttrace.New()
|
return stdouttrace.New()
|
||||||
case NoOpExporter:
|
case NoOpExporter:
|
||||||
return stdouttrace.New(stdouttrace.WithWriter(io.Discard))
|
return tracetest.NewNoopExporter(), nil
|
||||||
case OTLPgRPCExporter:
|
case OTLPgRPCExporter:
|
||||||
return otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(cfg.Endpoint), otlptracegrpc.WithInsecure())
|
return otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(cfg.Endpoint), otlptracegrpc.WithInsecure())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue