mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 21:28:22 +08:00
25 lines
611 B
Go
25 lines
611 B
Go
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||
|
//
|
||
|
// This Source Code Form is subject to the terms of the MIT License.
|
||
|
// If a copy of the MIT was not distributed with this file,
|
||
|
// You can obtain one at https://github.com/gogf/gf.
|
||
|
|
||
|
package gtrace
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"go.opentelemetry.io/otel/trace"
|
||
|
)
|
||
|
|
||
|
type Span struct {
|
||
|
trace.Span
|
||
|
}
|
||
|
|
||
|
// NewSpan creates a span using default tracer.
|
||
|
func NewSpan(ctx context.Context, spanName string, opts ...trace.SpanOption) (context.Context, *Span) {
|
||
|
ctx, span := NewTracer().Start(ctx, spanName, opts...)
|
||
|
return ctx, &Span{
|
||
|
Span: span,
|
||
|
}
|
||
|
}
|