From fa1427014c28f19614f37f973c76ae4798858c63 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 9 May 2024 19:16:12 +0300 Subject: [PATCH] close #343 Signed-off-by: Vasiliy Tolstov --- tracer/options.go | 15 ++++++++++++--- tracer/tracer.go | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tracer/options.go b/tracer/options.go index 6f736379..98c4d3a7 100644 --- a/tracer/options.go +++ b/tracer/options.go @@ -83,9 +83,11 @@ func (sk SpanKind) String() string { // SpanOptions contains span option type SpanOptions struct { - Labels []interface{} - Kind SpanKind - Record bool + StatusMsg string + Labels []interface{} + Status SpanStatus + Kind SpanKind + Record bool } // SpanOption func signature @@ -111,6 +113,13 @@ func WithSpanLabels(kv ...interface{}) SpanOption { } } +func WithSpanStatus(st SpanStatus, msg string) SpanOption { + return func(o *SpanOptions) { + o.Status = st + o.StatusMsg = msg + } +} + func WithSpanKind(k SpanKind) SpanOption { return func(o *SpanOptions) { o.Kind = k diff --git a/tracer/tracer.go b/tracer/tracer.go index 8ad7cdf4..a5100dca 100644 --- a/tracer/tracer.go +++ b/tracer/tracer.go @@ -44,6 +44,8 @@ type Tracer interface { Init(...Option) error // Start a trace Start(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span) + // Extract get span metadata from context + // Extract(ctx context.Context) // Flush flushes spans Flush(ctx context.Context) error }