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,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

View File

@ -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
}