Documentation ¶
Index ¶
- Constants
- func ContextWithBaggage(parent context.Context, b Baggage) context.Context
- func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context
- func ContextWithSpan(parent context.Context, span Span) context.Context
- func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context
- func ContextWithoutBaggage(parent context.Context) context.Context
- func Handle(err error)
- func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue)
- func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue)
- func SetErrorHandler(h ErrorHandler)
- func SetGlobalMeterProvider(mp MeterProvider)
- func SetLogger(logger logr.Logger)
- func SetTextMapPropagator(propagator TextMapPropagator)
- func SetTracerProvider(tp TracerProvider)
- func TraceIDFromHex(h string) (trace.TraceID, error)
- func Version() string
- type AsyncFloat64Counter
- type AsyncFloat64Gauge
- type AsyncFloat64InstrumentProvider
- type AsyncFloat64UpDownCounter
- type AsyncInt64Counter
- type AsyncInt64InstrumentProvider
- type AsyncInt64UpDownCounter
- type Asynchronous
- type AttributeIterator
- type AttributeMergeIterator
- type Baggage
- type BaggageMember
- type BaggageProperty
- type Code
- type Distinct
- type Encoder
- type EncoderID
- type ErrorHandler
- type ErrorHandlerFunc
- type EventConfig
- type EventOption
- type Filter
- type Gauge
- type HeaderCarrier
- type InstrumentConfig
- type InstrumentOption
- type InstrumentProvider
- type Key
- type KeyValue
- func AttributeBool(k string, v bool) KeyValue
- func AttributeBoolSlice(k string, v []bool) KeyValue
- func AttributeFloat64(k string, v float64) KeyValue
- func AttributeFloat64Slice(k string, v []float64) KeyValue
- func AttributeInt(k string, v int) KeyValue
- func AttributeInt64(k string, v int64) KeyValue
- func AttributeInt64Slice(k string, v []int64) KeyValue
- func AttributeIntSlice(k string, v []int) KeyValue
- func AttributeString(k, v string) KeyValue
- func AttributeStringSlice(k string, v []string) KeyValue
- func AttributeStringer(k string, v fmt.Stringer) KeyValue
- type Link
- type MapCarrier
- type Meter
- type MeterConfig
- type MeterOption
- type MeterProvider
- type MetricUnit
- type PropagationBaggage
- type Set
- type Sortable
- type Span
- type SpanConfig
- type SpanContext
- type SpanContextConfig
- type SpanEndEventOption
- type SpanEndOption
- type SpanEventOption
- type SpanID
- type SpanKind
- type SpanOption
- type SpanStartEventOption
- type SpanStartOption
- type SyncFloat64Counter
- type SyncFloat64Histogram
- type SyncFloat64UpDownCounter
- type SyncInt64Counter
- type SyncInt64Histogram
- type SyncInt64InstrumentProvider
- type SyncInt64UpDownCounter
- type Synchronous
- type TextMapCarrier
- type TextMapPropagator
- type TraceContext
- type TraceFlags
- type TraceID
- type TraceState
- type Tracer
- type TracerConfig
- type TracerOption
- type TracerProvider
- type Type
- type Value
- func BoolSliceValue(v []bool) Value
- func BoolValue(v bool) Value
- func Float64SliceValue(v []float64) Value
- func Float64Value(v float64) Value
- func Int64SliceValue(v []int64) Value
- func Int64Value(v int64) Value
- func IntSliceValue(v []int) Value
- func IntValue(v int) Value
- func StringSliceValue(v []string) Value
- func StringValue(v string) Value
Constants ¶
const ( // INVALID is used for a Value with no value set. INVALID = attribute.INVALID // BOOL is a boolean Type Value. BOOL = attribute.BOOL // INT64 is a 64-bit signed integral Type Value. INT64 = attribute.INT64 // FLOAT64 is a 64-bit floating point Type Value. FLOAT64 = attribute.FLOAT64 // STRING is a string Type Value. STRING = attribute.STRING // BOOLSLICE is a slice of booleans Type Value. BOOLSLICE = attribute.BOOLSLICE // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. INT64SLICE = attribute.INT64SLICE // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. FLOAT64SLICE = attribute.FLOAT64SLICE // STRINGSLICE is a slice of strings Type Value. STRINGSLICE = attribute.STRINGSLICE )
const ( Dimensionless = unit.Dimensionless Bytes = unit.Bytes Milliseconds = unit.Milliseconds )
Units defined by OpenTelemetry.
const ( // SpanKindUnspecified is an unspecified SpanKind and is not a valid // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal // if it is received. SpanKindUnspecified = trace.SpanKindUnspecified // SpanKindInternal is a SpanKind for a Span that represents an internal // operation within an application. SpanKindInternal = trace.SpanKindInternal // SpanKindServer is a SpanKind for a Span that represents the operation // of handling a request from a client. SpanKindServer = trace.SpanKindServer // SpanKindClient is a SpanKind for a Span that represents the operation // of client making a request to a server. SpanKindClient = trace.SpanKindClient // SpanKindProducer is a SpanKind for a Span that represents the operation // of a producer sending a message to a message broker. Unlike // SpanKindClient and SpanKindServer, there is often no direct // relationship between this kind of Span and a SpanKindConsumer kind. A // SpanKindProducer Span will end once the message is accepted by the // message broker which might not overlap with the processing of that // message. SpanKindProducer = trace.SpanKindProducer // SpanKindConsumer is a SpanKind for a Span that represents the operation // of a consumer receiving a message from a message broker. Like // SpanKindProducer Spans, there is often no direct relationship between // this Span and the Span that produced the message. SpanKindConsumer = trace.SpanKindConsumer )
As a convenience, these match the proto definition, see https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129
The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` to coerce a span kind to a valid value.
const FlagsSampled = TraceFlags(0x01)
FlagsSampled is a bitmask with the sampled bit set. A SpanContext with the sampling bit set means the span is sampled.
Variables ¶
This section is empty.
Functions ¶
func ContextWithBaggage ¶
ContextWithBaggage returns a copy of parent with baggage.
func ContextWithRemoteSpanContext ¶
func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context
ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly as a remote SpanContext and as the current Span. The Span implementation that wraps rsc is non-recording and performs no operations other than to return rsc as the SpanContext from the SpanContext method.
func ContextWithSpan ¶
ContextWithSpan returns a copy of parent with span set as the current Span.
func ContextWithSpanContext ¶
func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context
ContextWithSpanContext returns a copy of parent with sc as the current Span. The Span implementation that wraps sc is non-recording and performs no operations other than to return sc as the SpanContext from the SpanContext method.
func ContextWithoutBaggage ¶
ContextWithoutBaggage returns a copy of parent with no baggage.
func Handle ¶
func Handle(err error)
Handle is a convenience function for ErrorHandler().Handle(err).
func NewSetWithFiltered ¶
NewSetWithFiltered returns a new Set. See the documentation for NewSetWithSortableFiltered for more details.
This call includes a Filter to include/exclude attribute keys from the return value. Excluded keys are returned as a slice of attribute values.
func NewSetWithSortableFiltered ¶
NewSetWithSortableFiltered returns a new Set.
Duplicate keys are eliminated by taking the last value. This re-orders the input slice so that unique last-values are contiguous at the end of the slice.
This ensures the following:
- Last-value-wins semantics - Caller sees the reordering, but doesn't lose values - Repeated call preserve last-value wins.
Note that methods are defined on Set, although this returns Set. Callers can avoid memory allocations by:
- allocating a Sortable for use as a temporary in this method - allocating a Set for storing the return value of this constructor.
The result maintains a cache of encoded attributes, by attribute.EncoderID. This value should not be copied after its first use.
The second []KeyValue return value is a list of attributes that were excluded by the Filter (if non-nil).
func SetErrorHandler ¶
func SetErrorHandler(h ErrorHandler)
SetErrorHandler sets the global ErrorHandler to h.
The first time this is called all ErrorHandler previously returned from GetErrorHandler will send errors to h instead of the default logging ErrorHandler. Subsequent calls will set the global ErrorHandler, but not delegate errors to h.
func SetGlobalMeterProvider ¶
func SetGlobalMeterProvider(mp MeterProvider)
SetGlobalMeterProvider registers `mp` as the global meter provider.
func SetTextMapPropagator ¶
func SetTextMapPropagator(propagator TextMapPropagator)
SetTextMapPropagator sets propagator as the global TextMapPropagator.
func SetTracerProvider ¶
func SetTracerProvider(tp TracerProvider)
SetTracerProvider registers `tp` as the global trace provider.
func TraceIDFromHex ¶
TraceIDFromHex returns a TraceID from a hex string if it is compliant with the W3C trace-context specification. See more at https://www.w3.org/TR/trace-context/#trace-id nolint:revive // revive complains about stutter of `trace.TraceIDFromHex`.
Types ¶
type AsyncFloat64Counter ¶
type AsyncFloat64Counter = asyncfloat64.Counter
AsyncFloat64Counter is an instrument that records increasing values.
type AsyncFloat64Gauge ¶
type AsyncFloat64Gauge = asyncfloat64.Gauge
AsyncFloat64Gauge is an instrument that records independent readings.
type AsyncFloat64InstrumentProvider ¶
type AsyncFloat64InstrumentProvider = asyncfloat64.InstrumentProvider
InstrumentProvider provides access to individual instruments.
type AsyncFloat64UpDownCounter ¶
type AsyncFloat64UpDownCounter = asyncfloat64.UpDownCounter
AsyncFloat64UpDownCounter is an instrument that records increasing or decresing values.
type AsyncInt64Counter ¶
type AsyncInt64Counter = asyncint64.Counter
AsyncInt64Counter is an instrument that records increasing values.
type AsyncInt64InstrumentProvider ¶
type AsyncInt64InstrumentProvider = asyncint64.InstrumentProvider
AsyncInt64InstrumentProvider provides access to individual instruments.
type AsyncInt64UpDownCounter ¶
type AsyncInt64UpDownCounter = asyncint64.UpDownCounter
AsyncInt64UpDownCounter is an instrument that records increasing or decresing values.
type Asynchronous ¶
type Asynchronous = instrument.Asynchronous
Asynchronous instruments are instruments that are updated within a Callback. If an instrument is observed outside of it's callback it should be an error.
This interface is used as a grouping mechanism.
type AttributeIterator ¶
AttributeIterator allows iterating over the set of attributes in order, sorted by key.
type AttributeMergeIterator ¶
type AttributeMergeIterator = attribute.MergeIterator
AttributeMergeIterator supports iterating over two sets of attributes while eliminating duplicate values from the combined set. The first iterator value takes precedence.
func AttributeNewMergeIterator ¶
func AttributeNewMergeIterator(s1, s2 *Set) AttributeMergeIterator
AttributeNewMergeIterator returns a MergeIterator for merging two attribute sets. Duplicates are resolved by taking the value from the first set.
type Baggage ¶
Baggage is a list of baggage members representing the baggage-string as defined by the W3C Baggage specification.
func FromContext ¶
FromContext returns the baggage contained in ctx.
func NewBaggage ¶
func NewBaggage(members ...BaggageMember) (Baggage, error)
NewBaggage returns a new valid Baggage. It returns an error if it results in a Baggage exceeding limits set in that specification.
It expects all the provided members to have already been validated.
func ParseBaggage ¶
ParseBaggage attempts to decode a baggage-string from the passed string. It returns an error if the input is invalid according to the W3C Baggage specification.
If there are duplicate list-members contained in baggage, the last one defined (reading left-to-right) will be the only one kept. This diverges from the W3C Baggage specification which allows duplicate list-members, but conforms to the OpenTelemetry Baggage specification.
type BaggageMember ¶
BaggageMember is a list-member of a baggage-string as defined by the W3C Baggage specification.
func NewMember ¶
func NewMember(key, value string, props ...BaggageProperty) (BaggageMember, error)
NewMember returns a new Member from the passed arguments. An error is returned if the created Member would be invalid according to the W3C Baggage specification.
type BaggageProperty ¶
BaggageProperty is an additional metadata entry for a baggage list-member.
func NewKeyProperty ¶
func NewKeyProperty(key string) (BaggageProperty, error)
func NewKeyValueProperty ¶
func NewKeyValueProperty(key, value string) (BaggageProperty, error)
type Code ¶
Code is an 32-bit representation of a status state.
const ( // Unset is the default status code. Unset Code = codes.Unset // Error indicates the operation contains an error. Error Code = codes.Error // OK indicates operation has been validated by an Application developers // or Operator to have completed successfully, or contain no error. OK Code = codes.Ok )
type Distinct ¶
Distinct wraps a variable-size array of KeyValue, constructed with keys in sorted order. This can be used as a map key or for equality checking between Sets.
type Encoder ¶
Encoder is a mechanism for serializing an attribute set into a specific string representation that supports caching, to avoid repeated serialization. An example could be an exporter encoding the attribute set into a wire representation.
func DefaultEncoder ¶
func DefaultEncoder() Encoder
DefaultEncoder returns an attribute encoder that encodes attributes in such a way that each escaped attribute's key is followed by an equal sign and then by an escaped attribute's value. All key-value pairs are separated by a comma.
Escaping is done by prepending a backslash before either a backslash, equal sign or a comma.
type EncoderID ¶
EncoderID is used to identify distinct Encoder implementations, for caching encoded results.
func NewEncoderID ¶
func NewEncoderID() EncoderID
NewEncoderID returns a unique attribute encoder ID. It should be called once per each type of attribute encoder. Preferably in init() or in var definition.
type ErrorHandler ¶
type ErrorHandler = otel.ErrorHandler
ErrorHandler handles irremediable events.
func GetErrorHandler ¶
func GetErrorHandler() ErrorHandler
GetErrorHandler returns the global ErrorHandler instance.
The default ErrorHandler instance returned will log all errors to STDERR until an override ErrorHandler is set with SetErrorHandler. All ErrorHandler returned prior to this will automatically forward errors to the set instance instead of logging.
Subsequent calls to SetErrorHandler after the first will not forward errors to the new ErrorHandler for prior returned instances.
type ErrorHandlerFunc ¶
type ErrorHandlerFunc = otel.ErrorHandlerFunc
ErrorHandlerFunc is a convenience adapter to allow the use of a function as an ErrorHandler.
type EventConfig ¶
type EventConfig = trace.EventConfig
EventConfig is a group of options for an Event.
func NewEventConfig ¶
func NewEventConfig(options ...EventOption) EventConfig
NewEventConfig applies all the EventOptions to a returned EventConfig. If no timestamp option is passed, the returned EventConfig will have a Timestamp set to the call time, otherwise no validation is performed on the returned EventConfig.
type EventOption ¶
type EventOption = trace.EventOption
EventOption applies span event options to an EventConfig.
type Filter ¶
Filter supports removing certain attributes from attribute sets. When the filter returns true, the attribute will be kept in the filtered attribute set. When the filter returns false, the attribute is excluded from the filtered attribute set, and the attribute instead appears in the removed list of excluded attributes.
type Gauge ¶
type Gauge = asyncint64.Gauge
Gauge is an instrument that records independent readings.
type HeaderCarrier ¶
type HeaderCarrier = propagation.HeaderCarrier
HeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface.
type InstrumentConfig ¶
type InstrumentConfig = instrument.Config
InstrumentConfig contains options for metric instrument descriptors.
func NewInstrumentConfig ¶
func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig
NewInstrumentConfig creates a new Config and applies all the given options.
type InstrumentOption ¶
type InstrumentOption = instrument.Option
InstrumentOption is an interface for applying metric instrument options.
func WithInstrumentDescription ¶
func WithInstrumentDescription(desc string) InstrumentOption
WithInstrumentDescription applies provided description.
func WithInstrumentUnit ¶
func WithInstrumentUnit(unit MetricUnit) InstrumentOption
WithInstrumentUnit applies provided unit.
type InstrumentProvider ¶
type InstrumentProvider = syncfloat64.InstrumentProvider
InstrumentProvider provides access to individual instruments.
type Key ¶
Key represents the key part in key-value pairs. It's a string. The allowed character set in the key depends on the use of the key.
type KeyValue ¶
KeyValue holds a key and value pair.
func AttributeBool ¶
AttributeBool creates a KeyValue with a BOOL Value type.
func AttributeBoolSlice ¶
AttributeBoolSlice creates a KeyValue with a BOOLSLICE Value type.
func AttributeFloat64 ¶
AttributeFloat64 creates a KeyValue with a FLOAT64 Value type.
func AttributeFloat64Slice ¶
AttributeFloat64Slice creates a KeyValue with a FLOAT64SLICE Value type.
func AttributeInt ¶
AttributeInt creates a KeyValue with an INT64 Value type.
func AttributeInt64 ¶
AttributeInt64 creates a KeyValue with an INT64 Value type.
func AttributeInt64Slice ¶
AttributeInt64Slice creates a KeyValue with an INT64SLICE Value type.
func AttributeIntSlice ¶
AttributeIntSlice creates a KeyValue with an INT64SLICE Value type.
func AttributeString ¶
AttributeString creates a KeyValue with a STRING Value type.
func AttributeStringSlice ¶
AttributeStringSlice creates a KeyValue with a STRINGSLICE Value type.
type Link ¶
Link is the relationship between two Spans. The relationship can be within the same Trace or across different Traces.
For example, a Link is used in the following situations:
- Batch Processing: A batch of operations may contain operations associated with one or more traces/spans. Since there can only be one parent SpanContext, a Link is used to keep reference to the SpanContext of all operations in the batch.
- Public Endpoint: A SpanContext for an in incoming client request on a public endpoint should be considered untrusted. In such a case, a new trace with its own identity and sampling decision needs to be created, but this new trace needs to be related to the original trace in some form. A Link is used to keep reference to the original SpanContext and track the relationship.
type MapCarrier ¶
type MapCarrier = propagation.MapCarrier
MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs.
type Meter ¶
Meter provides access to instrument instances for recording metrics.
func GlobalMeter ¶
func GlobalMeter(instrumentationName string, opts ...MeterOption) Meter
Meter returns a Meter from the global MeterProvider. The instrumentationName must be the name of the library providing instrumentation. This name may be the same as the instrumented code only if that code provides built-in instrumentation. If the instrumentationName is empty, then a implementation defined default name will be used instead.
This is short for MeterProvider().Meter(name).
type MeterConfig ¶
type MeterConfig = metric.MeterConfig
MeterConfig contains options for Meters.
func NewMeterConfig ¶
func NewMeterConfig(opts ...MeterOption) MeterConfig
NewMeterConfig creates a new MeterConfig and applies all the given options.
type MeterOption ¶
type MeterOption = metric.MeterOption
MeterOption is an interface for applying Meter options.
func WithInstrumentationVersion ¶
func WithInstrumentationVersion(version string) MeterOption
WithInstrumentationVersion sets the instrumentation version.
func WithSchemaURL ¶
func WithSchemaURL(schemaURL string) MeterOption
WithSchemaURL sets the schema URL.
type MeterProvider ¶
type MeterProvider = metric.MeterProvider
MeterProvider provides access to named Meter instances, for instrumenting an application or library.
func GlobalMeterProvider ¶
func GlobalMeterProvider() MeterProvider
MeterProvider returns the registered global trace provider. If none is registered then a No-op MeterProvider is returned.
type MetricUnit ¶
type PropagationBaggage ¶
type PropagationBaggage = propagation.Baggage
Baggage is a propagator that supports the W3C Baggage format.
This propagates user-defined baggage associated with a trace. The complete specification is defined at https://www.w3.org/TR/baggage/.
type Set ¶
Set is the representation for a distinct attribute set. It manages an immutable set of attributes, with an internal cache for storing attribute encodings.
This type supports the Equivalent method of comparison using values of type Distinct.
func EmptySet ¶
func EmptySet() *Set
EmptySet returns a reference to a Set with no elements.
This is a convenience provided for optimized calling utility.
func NewSet ¶
NewSet returns a new Set. See the documentation for NewSetWithSortableFiltered for more details.
Except for empty sets, this method adds an additional allocation compared with calls that include a Sortable.
func NewSetWithSortable ¶
NewSetWithSortable returns a new Set. See the documentation for NewSetWithSortableFiltered for more details.
This call includes a Sortable option as a memory optimization.
type Sortable ¶
Sortable implements sort.Interface, used for sorting KeyValue. This is an exported type to support a memory optimization. A pointer to one of these is needed for the call to sort.Stable(), which the caller may provide in order to avoid an allocation. See NewSetWithSortable().
type Span ¶
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.
Warning: methods may be added to this interface in minor releases.
func SpanFromContext ¶
SpanFromContext returns the current Span from ctx.
If no Span is currently set in ctx an implementation of a Span that performs no operations is returned.
type SpanConfig ¶
type SpanConfig = trace.SpanConfig
SpanConfig is a group of options for a Span.
func NewSpanEndConfig ¶
func NewSpanEndConfig(options ...SpanEndOption) SpanConfig
NewSpanEndConfig applies all the options to a returned SpanConfig. No validation is performed on the returned SpanConfig (e.g. no uniqueness checking or bounding of data), it is left to the SDK to perform this action.
func NewSpanStartConfig ¶
func NewSpanStartConfig(options ...SpanStartOption) SpanConfig
NewSpanStartConfig applies all the options to a returned SpanConfig. No validation is performed on the returned SpanConfig (e.g. no uniqueness checking or bounding of data), it is left to the SDK to perform this action.
type SpanContext ¶
type SpanContext = trace.SpanContext
SpanContext contains identifying trace information about a Span.
func NewSpanContext ¶
func NewSpanContext(config SpanContextConfig) SpanContext
NewSpanContext constructs a SpanContext using values from the provided SpanContextConfig.
func SpanContextFromContext ¶
func SpanContextFromContext(ctx context.Context) SpanContext
SpanContextFromContext returns the current Span's SpanContext.
type SpanContextConfig ¶
type SpanContextConfig = trace.SpanContextConfig
SpanContextConfig contains mutable fields usable for constructing an immutable SpanContext.
type SpanEndEventOption ¶
type SpanEndEventOption = trace.SpanEndEventOption
SpanEndEventOption are options that can be used at the end of a span, or with an event.
func WithStackTrace ¶
func WithStackTrace(b bool) SpanEndEventOption
WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false).
type SpanEndOption ¶
type SpanEndOption = trace.SpanEndOption
SpanEndOption applies an option to a SpanConfig. These options are applicable only when the span is ended.
type SpanEventOption ¶
type SpanEventOption = trace.SpanEventOption
SpanEventOption are options that can be used with an event or a span.
func WithTimestamp ¶
func WithTimestamp(t time.Time) SpanEventOption
WithTimestamp sets the time of a Span or Event life-cycle moment (e.g. started, stopped, errored).
type SpanID ¶
SpanID is a unique identity of a span in a trace.
func SpanIDFromHex ¶
SpanIDFromHex returns a SpanID from a hex string if it is compliant with the w3c trace-context specification. See more at https://www.w3.org/TR/trace-context/#parent-id
type SpanKind ¶
SpanKind is the role a Span plays in a Trace.
func ValidateSpanKind ¶
ValidateSpanKind returns a valid span kind value. This will coerce invalid values into the default value, SpanKindInternal.
type SpanOption ¶
type SpanOption = trace.SpanOption
SpanOption are options that can be used at both the beginning and end of a span.
type SpanStartEventOption ¶
type SpanStartEventOption = trace.SpanStartEventOption
SpanStartEventOption are options that can be used at the start of a span, or with an event.
func WithAttributes ¶
func WithAttributes(attributes ...KeyValue) SpanStartEventOption
WithAttributes adds the attributes related to a span life-cycle event. These attributes are used to describe the work a Span represents when this option is provided to a Span's start or end events. Otherwise, these attributes provide additional information about the event being recorded (e.g. error, state change, processing progress, system event).
If multiple of these options are passed the attributes of each successive option will extend the attributes instead of overwriting. There is no guarantee of uniqueness in the resulting attributes.
type SpanStartOption ¶
type SpanStartOption = trace.SpanStartOption
SpanStartOption applies an option to a SpanConfig. These options are applicable only when the span is created.
func WithLinks ¶
func WithLinks(links ...Link) SpanStartOption
WithLinks adds links to a Span. The links are added to the existing Span links, i.e. this does not overwrite. Links with invalid span context are ignored.
func WithNewRoot ¶
func WithNewRoot() SpanStartOption
WithNewRoot specifies that the Span should be treated as a root Span. Any existing parent span context will be ignored when defining the Span's trace identifiers.
func WithSpanKind ¶
func WithSpanKind(kind SpanKind) SpanStartOption
WithSpanKind sets the SpanKind of a Span.
type SyncFloat64Counter ¶
type SyncFloat64Counter = syncfloat64.Counter
SyncFloat64Counter is an instrument that records increasing values.
type SyncFloat64Histogram ¶
type SyncFloat64Histogram = syncfloat64.Histogram
SyncFloat64Histogram is an instrument that records a distribution of values.
type SyncFloat64UpDownCounter ¶
type SyncFloat64UpDownCounter = syncfloat64.UpDownCounter
SyncFloat64UpDownCounter is an instrument that records increasing or decresing values.
type SyncInt64Counter ¶
SyncInt64Counter is an instrument that records increasing values.
type SyncInt64Histogram ¶
SyncInt64Histogram is an instrument that records a distribution of values.
type SyncInt64InstrumentProvider ¶
type SyncInt64InstrumentProvider = syncint64.InstrumentProvider
SyncInt64InstrumentProvider provides access to individual instruments.
type SyncInt64UpDownCounter ¶
type SyncInt64UpDownCounter = syncint64.UpDownCounter
SyncInt64UpDownCounter is an instrument that records increasing or decresing values.
type Synchronous ¶
type Synchronous = instrument.Synchronous
Synchronous instruments are updated in line with application code.
This interface is used as a grouping mechanism.
type TextMapCarrier ¶
type TextMapCarrier = propagation.TextMapCarrier
TextMapCarrier is the storage medium used by a TextMapPropagator.
type TextMapPropagator ¶
type TextMapPropagator = propagation.TextMapPropagator
TextMapPropagator propagates cross-cutting concerns as key-value text pairs within a carrier that travels in-band across process boundaries.
func GetTextMapPropagator ¶
func GetTextMapPropagator() TextMapPropagator
GetTextMapPropagator returns the global TextMapPropagator. If none has been set, a No-Op TextMapPropagator is returned.
func NewCompositeTextMapPropagator ¶
func NewCompositeTextMapPropagator(p ...TextMapPropagator) TextMapPropagator
NewCompositeTextMapPropagator returns a unified TextMapPropagator from the group of passed TextMapPropagator. This allows different cross-cutting concerns to be propagates in a unified manner.
The returned TextMapPropagator will inject and extract cross-cutting concerns in the order the TextMapPropagators were provided. Additionally, the Fields method will return a de-duplicated slice of the keys that are set with the Inject method.
type TraceContext ¶
type TraceContext = propagation.TraceContext
TraceContext is a propagator that supports the W3C Trace Context format (https://www.w3.org/TR/trace-context/)
This propagator will propagate the traceparent and tracestate headers to guarantee traces are not broken. It is up to the users of this propagator to choose if they want to participate in a trace by modifying the traceparent header and relevant parts of the tracestate header containing their proprietary information.
type TraceID ¶
TraceID is a unique identity of a trace. nolint:revive // revive complains about stutter of `trace.TraceID`.
type TraceState ¶
type TraceState = trace.TraceState
TraceState provides additional vendor-specific trace identification information across different distributed tracing systems. It represents an immutable list consisting of key/value pairs, each pair is referred to as a list-member.
TraceState conforms to the W3C Trace Context specification (https://www.w3.org/TR/trace-context-1). All operations that create or copy a TraceState do so by validating all input and will only produce TraceState that conform to the specification. Specifically, this means that all list-member's key/value pairs are valid, no duplicate list-members exist, and the maximum number of list-members (32) is not exceeded.
func ParseTraceState ¶
func ParseTraceState(tracestate string) (TraceState, error)
ParseTraceState attempts to decode a TraceState from the passed string. It returns an error if the input is invalid according to the W3C Trace Context specification.
type Tracer ¶
Tracer is the creator of Spans.
Warning: methods may be added to this interface in minor releases.
func NewTracer ¶
func NewTracer(name string, opts ...TracerOption) Tracer
NewTracer creates a named tracer that implements Tracer interface. If the name is an empty string then provider uses default name.
This is short for GetTracerProvider().Tracer(name, opts...)
type TracerConfig ¶
type TracerConfig = trace.TracerConfig
TracerConfig is a group of options for a Tracer.
func NewTracerConfig ¶
func NewTracerConfig(options ...TracerOption) TracerConfig
NewTracerConfig applies all the options to a returned TracerConfig.
type TracerOption ¶
type TracerOption = trace.TracerOption
TracerOption applies an option to a TracerConfig.
func TraceWithInstrumentationVersion ¶
func TraceWithInstrumentationVersion(version string) TracerOption
TraceWithInstrumentationVersion sets the instrumentation version.
func TraceWithSchemaURL ¶
func TraceWithSchemaURL(schemaURL string) TracerOption
TraceWithSchemaURL sets the schema URL for the Tracer.
type TracerProvider ¶
type TracerProvider = trace.TracerProvider
TracerProvider provides access to instrumentation Tracers.
Warning: methods may be added to this interface in minor releases.
func GetTracerProvider ¶
func GetTracerProvider() TracerProvider
GetTracerProvider returns the registered global trace provider. If none is registered then an instance of NoopTracerProvider is returned.
Use the trace provider to create a named tracer. E.g.
tracer := otel.GetTracerProvider().Tracer("example.com/foo")
or
tracer := otel.Tracer("example.com/foo")
func NewNoopTracerProvider ¶
func NewNoopTracerProvider() TracerProvider
NewNoopTracerProvider returns an implementation of TracerProvider that performs no operations. The Tracer and Spans created from the returned TracerProvider also perform no operations.
type Value ¶
Value represents the value part in key-value pairs.
func Float64SliceValue ¶
Float64SliceValue creates a FLOAT64SLICE Value.
func Int64SliceValue ¶
Int64SliceValue creates an INT64SLICE Value.
func StringSliceValue ¶
StringSliceValue creates a STRINGSLICE Value.