From fe34a03eb84d218b1e5895f3b22200f800ca73bd Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Thu, 20 Jun 2024 00:27:18 +0100 Subject: [PATCH] fixup! Add draft of tracing package. --- README.md | 8 +++++++- trace/tracing.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3348fb5..c7bdbfd 100644 --- a/README.md +++ b/README.md @@ -300,7 +300,13 @@ If you prefer more control over the metrics purging - you can enable `PURGE_METR Tracing can be enabled by setting `ENABLE_TRACE` to `true` and providing compatible with OTEL `TRACER_ENDPOINT` value ( default is `localhost:4317` ). From that moment you can include `X-Trace-Span` in your requests to the proxy. -The value of X-Trace-Span should be in following format !!#TODO!! +The value of X-Trace-Span should be in following format: + +```json +{ + "traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01", +} +``` #### Healthcheck diff --git a/trace/tracing.go b/trace/tracing.go index 8e44c26..2496da5 100644 --- a/trace/tracing.go +++ b/trace/tracing.go @@ -72,7 +72,7 @@ func TraceContextExtract(ctx context.Context, traceContext map[string]string) co func StartSpanFromContext(ctx context.Context, operationName string) (context.Context, oteltrace.Span) { tr := otel.GetTracerProvider().Tracer("") - return tr.Start(ctx, operationName, oteltrace.WithSpanKind(oteltrace.SpanKindInternal)) + return tr.Start(ctx, operationName, oteltrace.WithSpanKind(oteltrace.SpanKindServer)) } func ContinueSpanFromContext(ctx context.Context, operationName string) (context.Context, oteltrace.Span) {