Documentation ¶
Overview ¶
Package exptel is a fork of core Span types from opentelemetry-go v0.2.0.
https://github.com/open-telemetry/opentelemetry-go/tree/v0.2.0
These are used to maintain serialization compatibility for the `experimental_telemetry_cmd` output, which uses the JSON serialization of these directly. The canonical JSON serialization for OTLP is not standardized as of Sept 2021 and was removed as a requirement for v1.0 GA.
See https://github.com/open-telemetry/opentelemetry-proto/issues/230.
Index ¶
- type Code
- type Event
- type ExperimentalTelemetrySpan
- type Key
- func (k Key) Bool(v bool) KeyValue
- func (k Key) Defined() bool
- func (k Key) Float32(v float32) KeyValue
- func (k Key) Float64(v float64) KeyValue
- func (k Key) Int(v int) KeyValue
- func (k Key) Int32(v int32) KeyValue
- func (k Key) Int64(v int64) KeyValue
- func (k Key) String(v string) KeyValue
- func (k Key) Uint(v uint) KeyValue
- func (k Key) Uint32(v uint32) KeyValue
- func (k Key) Uint64(v uint64) KeyValue
- type KeyValue
- type Link
- type SpanContext
- type SpanID
- type SpanKind
- type TraceID
- type Value
- func (v *Value) AsBool() bool
- func (v *Value) AsFloat32() float32
- func (v *Value) AsFloat64() float64
- func (v *Value) AsInt32() int32
- func (v *Value) AsInt64() int64
- func (v *Value) AsInterface() interface{}
- func (v *Value) AsString() string
- func (v *Value) AsUint32() uint32
- func (v *Value) AsUint64() uint64
- func (v *Value) Emit() string
- func (v *Value) MarshalJSON() ([]byte, error)
- func (v *Value) Type() ValueType
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { // Message describes the Event. Message string // Attributes contains a list of keyvalue pairs. Attributes []KeyValue // Time is the time at which this event was recorded. Time time.Time }
Event is used to describe an Event with a message string and set of Attributes.
func NewEventsFromOtel ¶
type ExperimentalTelemetrySpan ¶
type ExperimentalTelemetrySpan struct { SpanContext SpanContext ParentSpanID SpanID SpanKind SpanKind Name string StartTime time.Time // The wall clock time of EndTime will be adjusted to always be offset // from StartTime by the duration of the span. EndTime time.Time Attributes []KeyValue MessageEvents []Event Links []Link Status Code HasRemoteParent bool DroppedAttributeCount int DroppedMessageEventCount int DroppedLinkCount int // ChildSpanCount holds the number of child span created for this span. ChildSpanCount int }
ExperimentalTelemetrySpan contains all the information collected by a span.
func NewSpanFromOtel ¶
func NewSpanFromOtel(sd sdktrace.ReadOnlySpan, spanNamePrefix string) ExperimentalTelemetrySpan
NewSpanFromOtel converts an OpenTelemetry span to a type suitable for JSON marshaling for usage with `experimental_telemetry_cmd`.
This format corresponds to the JSON marshaling from opentelemetry-go v0.2.0. See the package docs for more details.
spanNamePrefix can be used to provide a prefix for the outgoing span name to mimic old opentelemetry-go behavior which would prepend the tracer name to each span. (See https://github.com/open-telemetry/opentelemetry-go/pull/430).
func NewSpanFromSpanSnapshot ¶ added in v0.22.11
func NewSpanFromSpanSnapshot(s *sdktrace.SpanSnapshot, spanNamePrefix string) ExperimentalTelemetrySpan
NewSpanFromOtel converts an OpenTelemetry span to a type suitable for JSON marshaling for usage with `experimental_telemetry_cmd`.
This format corresponds to the JSON marshaling from opentelemetry-go v0.2.0. See the package docs for more details.
spanNamePrefix can be used to provide a prefix for the outgoing span name to mimic old opentelemetry-go behavior which would prepend the tracer name to each span. (See https://github.com/open-telemetry/opentelemetry-go/pull/430).
type Key ¶
type Key string
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.
func (Key) Int ¶
Int creates a KeyValue instance with either an INT32 or an INT64 Value, depending on whether the int type is 32 or 64 bits wide.
func (Key) Uint ¶
Uint creates a KeyValue instance with either an UINT32 or an UINT64 Value, depending on whether the uint type is 32 or 64 bits wide.
type Link ¶
type Link struct { SpanContext Attributes []KeyValue }
Link is used to establish relationship between two spans within the same Trace or across different Traces. Few examples of Link usage.
- Batch Processing: A batch of elements may contain elements associated with one or more traces/spans. Since there can only be one parent SpanContext, Link is used to keep reference to SpanContext of all elements in the batch.
- Public Endpoint: A SpanContext in incoming client request on a public endpoint is untrusted from service provider perspective. In such case it is advisable to start a new trace with appropriate sampling decision. However, it is desirable to associate incoming SpanContext to new trace initiated on service provider side so two traces (from Client and from Service Provider) can be correlated.
func NewLinksFromOtel ¶
type SpanContext ¶
SpanContext contains basic information about the span - its trace ID, span ID and trace flags.
func NewSpanContextFromOtel ¶
func NewSpanContextFromOtel(c trace.SpanContext) SpanContext
type SpanID ¶
type SpanID [8]byte
SpanID is a unique identify of a span in a trace.
func (SpanID) MarshalJSON ¶
MarshalJSON implements a custom marshal function to encode SpanID as a hex string.
type SpanKind ¶
type SpanKind int
SpanKind represents the role of a Span inside a Trace. Often, this defines how a Span will be processed and visualized by various backends.
type TraceID ¶
type TraceID [16]byte
TraceID is a unique identity of a trace.
func (TraceID) MarshalJSON ¶
MarshalJSON implements a custom marshal function to encode TraceID as a hex string.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value represents the value part in key-value pairs.
func Int ¶
Int creates either an INT32 or an INT64 Value, depending on whether the int type is 32 or 64 bits wide.
func Uint ¶
Uint creates either a UINT32 or a UINT64 Value, depending on whether the uint type is 32 or 64 bits wide.
func (*Value) AsFloat32 ¶
AsFloat32 returns the float32 value. Make sure that the Value's type is FLOAT32.
func (*Value) AsFloat64 ¶
AsFloat64 returns the float64 value. Make sure that the Value's type is FLOAT64.
func (*Value) AsInterface ¶
func (v *Value) AsInterface() interface{}
AsInterface returns Value's data as interface{}.
func (*Value) AsString ¶
AsString returns the string value. Make sure that the Value's type is STRING.
func (*Value) AsUint32 ¶
AsUint32 returns the uint32 value. Make sure that the Value's type is UINT32.
func (*Value) AsUint64 ¶
AsUint64 returns the uint64 value. Make sure that the Value's type is UINT64.
func (*Value) MarshalJSON ¶
MarshalJSON returns the JSON encoding of the Value.
type ValueType ¶
type ValueType int
ValueType describes the type of the data Value holds.
const ( INVALID ValueType = iota // No value. BOOL // Boolean value, use AsBool() to get it. INT32 // 32 bit signed integral value, use AsInt32() to get it. INT64 // 64 bit signed integral value, use AsInt64() to get it. UINT32 // 32 bit unsigned integral value, use AsUint32() to get it. UINT64 // 64 bit unsigned integral value, use AsUint64() to get it. FLOAT32 // 32 bit floating point value, use AsFloat32() to get it. FLOAT64 // 64 bit floating point value, use AsFloat64() to get it. STRING // String value, use AsString() to get it. )