tracing

package
v0.0.0-...-5905bd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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 GetOTelSpanName(parentIndex int) string

func InitOTelTracer

func InitOTelTracer() *sdktrace.TracerProvider

func ParamsAttribute

func ParamsAttribute(params any) attribute.KeyValue

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL