update trace logic

This commit is contained in:
Aleksandr Trushkin
2024-09-24 21:59:33 +03:00
parent c0f45d98c2
commit c7fada2c54
7 changed files with 345 additions and 599 deletions

View File

@ -93,6 +93,10 @@ func newCommonTraceProvider(ctx context.Context, params TraceProviderParams) (tp
return "bigstats:kuriweb", nil
}),
),
resource.WithAttributes(
semconv.ServiceName("bigstats:kuriweb"),
semconv.DeploymentEnvironment("production"),
),
)
if err != nil {
return nil, fmt.Errorf("making new resource: %w", err)
@ -124,14 +128,19 @@ func newCommonTraceProvider(ctx context.Context, params TraceProviderParams) (tp
spanExporter, err = otlptracegrpc.New(
ctx,
otlptracegrpc.WithEndpointURL(params.Endpoint),
otlptracegrpc.WithInsecure(),
otlptracegrpc.WithHeaders(headers),
otlptracegrpc.WithCompressor("gzip"),
)
case config.TraceClientTypeHTTP:
httpClient := otlptracehttp.NewClient(
otlptracehttp.WithEndpointURL(params.Endpoint),
otlptracehttp.WithHeaders(headers),
otlptracehttp.WithCompression(otlptracehttp.GzipCompression),
)
spanExporter, err = otlptrace.New(
ctx, httpClient,
)
spanExporter, err = otlptrace.New(ctx, httpClient)
case config.TraceClientTypeStdout:
spanExporter, err = stdouttrace.New(stdouttrace.WithPrettyPrint())
default: