tracing

package
v0.0.0-...-d611558 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InteractTimeMs = atomic.NewInt64(0)

InteractTimeMs is the time spent waiting on user interaction in milliseconds.

Functions

func AppendUsageAttribute

func AppendUsageAttribute(attr attribute.KeyValue)

Sets or appends a value to a slice-type usage attribute that possibly exists. The attribute is expected to be a slice-type value, and matches the existing type. Otherwise, a strict replacement is performed.

func GetGlobalAttributes

func GetGlobalAttributes() []attribute.KeyValue

Returns all global attributes set.

func GetUsageAttributes

func GetUsageAttributes() []attribute.KeyValue

Returns all usage attributes set.

func IncrementUsageAttribute

func IncrementUsageAttribute(attr attribute.KeyValue)

Sets or increments a possibly stored usage attribute. The attribute is expected to be a numeric-type or string-type value, and matches the existing type of a previously stored usage attribute. Otherwise, a strict replacement is performed.

func SetAttributesInContext

func SetAttributesInContext(ctx context.Context, attributes ...attribute.KeyValue)

SetAttributesInContext sets the given attributes for the current running span.

func SetBaggageInContext

func SetBaggageInContext(ctx context.Context, attributes ...attribute.KeyValue) context.Context

SetBaggageInContext sets the given attributes as baggage. Baggage attributes are set for the current running span, and for any child spans created.

func SetGlobalAttributes

func SetGlobalAttributes(attributes ...attribute.KeyValue)

Sets global attributes that are included with all telemetry events emitted. If the attribute already exists, the value is replaced.

func SetUsageAttributes

func SetUsageAttributes(attributes ...attribute.KeyValue)

Sets usage attributes that are included with usage events emitted. If the attribute already exists, the value is replaced.

Types

type Span

type Span interface {

	// EndWithStatus calls End, but also sets Status based on the value of err (nil mean success).
	EndWithStatus(err error, options ...trace.SpanEndOption)
	// contains filtered or unexported methods
}

Span is the individual component of a trace. It represents a single named and timed operation of a workflow that is traced. A Tracer is used to create a Span and it is then up to the operation the Span represents to properly end the Span when the operation itself ends.

func Start

func Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, Span)

Start creates a span and a context.Context containing the newly-created span.

If the context.Context provided in `ctx` contains a Span then the newly-created Span will be a child of that span, otherwise it will be a root span. This behavior can be overridden by providing `WithNewRoot()` as a SpanOption, causing the newly-created Span to be a root span even if `ctx` contains a Span.

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.

type Tracer

type Tracer interface {
	Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, Span)
}

Tracer is the creator of Spans.

This is simply trace.Tracer except returning our Span instead of trace.Span.

Directories

Path Synopsis
Package baggage provides an implementation of storing trace-level context data, i.e.
Package baggage provides an implementation of storing trace-level context data, i.e.
Package events provides definitions and functions related to the definition of telemetry events.
Package events provides definitions and functions related to the definition of telemetry events.
Package fields provides definitions and functions related to the definition of telemetry fields.
Package fields provides definitions and functions related to the definition of telemetry fields.
Package resource provides application-level resource attributes for telemetry purposes.
Package resource provides application-level resource attributes for telemetry purposes.

Jump to

Keyboard shortcuts

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