Documentation ¶
Index ¶
- Constants
- func GetOTelSpanName(parentIndex int) string
- func InitOTelTracer() *sdktrace.TracerProvider
- func ParamsAttribute(params any) attribute.KeyValue
- type OTelSpanBuilder
- func (b *OTelSpanBuilder) Build(ctx context.Context) trace.Span
- func (b *OTelSpanBuilder) WithAttributes(kv ...attribute.KeyValue) *OTelSpanBuilder
- func (b *OTelSpanBuilder) WithName(name string) *OTelSpanBuilder
- func (b *OTelSpanBuilder) WithSuffix(suffix string) *OTelSpanBuilder
- func (b *OTelSpanBuilder) WithTracer(tracer string) *OTelSpanBuilder
Constants ¶
const ( UserIDAttributeKey = attribute.Key("user-id") // for outermost layer only ParamsAttributeKey = attribute.Key("params") )
Filterable with <attribute>="...".
Variables ¶
This section is empty.
Functions ¶
func GetOTelSpanName ¶
func InitOTelTracer ¶
func InitOTelTracer() *sdktrace.TracerProvider
func ParamsAttribute ¶
Types ¶
type OTelSpanBuilder ¶
type OTelSpanBuilder struct {
// contains filtered or unexported fields
}
func NewOTelSpanBuilder ¶
func NewOTelSpanBuilder(opts ...trace.SpanStartOption) *OTelSpanBuilder
TODO: reusable in tracing pkg, + WithTracer + WithAttributes so we have dedicated newOTelSpan for each package that returns builder with predefined opts. e.g. repos WithTracer(otelName).WithAttributes(semconv.DBSystemPostgreSQL) When creating a Span it is recommended to provide all known span attributes using the `WithAttributes()` SpanOption as samplers will only have access to the attributes provided when a Span is created.
func (*OTelSpanBuilder) Build ¶
func (b *OTelSpanBuilder) Build(ctx context.Context) trace.Span
Build builds and returns a span with the given options.
func (*OTelSpanBuilder) WithAttributes ¶
func (b *OTelSpanBuilder) WithAttributes(kv ...attribute.KeyValue) *OTelSpanBuilder
WithAttributes adds span attributes.
func (*OTelSpanBuilder) WithName ¶
func (b *OTelSpanBuilder) WithName(name string) *OTelSpanBuilder
WithName overrides the default span name.
func (*OTelSpanBuilder) WithSuffix ¶
func (b *OTelSpanBuilder) WithSuffix(suffix string) *OTelSpanBuilder
WithSuffix appends a suffix between brackets to the span name in order to identify multiple spans in the same function.
func (*OTelSpanBuilder) WithTracer ¶
func (b *OTelSpanBuilder) WithTracer(tracer string) *OTelSpanBuilder
WithTracer overrides the default tracer name.