Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-05-09 19:16:12 +03:00
parent 62074965ee
commit fa1427014c
2 changed files with 14 additions and 3 deletions

View File

@ -83,7 +83,9 @@ func (sk SpanKind) String() string {
// SpanOptions contains span option // SpanOptions contains span option
type SpanOptions struct { type SpanOptions struct {
StatusMsg string
Labels []interface{} Labels []interface{}
Status SpanStatus
Kind SpanKind Kind SpanKind
Record bool Record bool
} }
@ -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 { func WithSpanKind(k SpanKind) SpanOption {
return func(o *SpanOptions) { return func(o *SpanOptions) {
o.Kind = k o.Kind = k

View File

@ -44,6 +44,8 @@ type Tracer interface {
Init(...Option) error Init(...Option) error
// Start a trace // Start a trace
Start(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span) 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 flushes spans
Flush(ctx context.Context) error Flush(ctx context.Context) error
} }