Documentation ¶
Overview ¶
Package model describes the internal data model for Trace and Span
Index ¶
- func DurationAsMicroseconds(d time.Duration) uint64
- func EpochMicrosecondsAsTime(ts uint64) time.Time
- func HashCode(o Hashable) (uint64, error)
- func MicrosecondsAsDuration(v uint64) time.Duration
- func SortSpan(span *Span)
- func SortTrace(trace *Trace)
- func SortTraces(traces []*Trace)
- func TimeAsEpochMicroseconds(t time.Time) uint64
- type DependencyLink
- type Flags
- type Hashable
- type KeyValue
- func (kv *KeyValue) AsString() string
- func (kv *KeyValue) Binary() []byte
- func (kv *KeyValue) Bool() bool
- func (kv *KeyValue) Equal(other *KeyValue) bool
- func (kv *KeyValue) Float64() float64
- func (kv KeyValue) Hash(w io.Writer) error
- func (kv *KeyValue) Int64() int64
- func (kv *KeyValue) IsLess(two *KeyValue) bool
- func (kv *KeyValue) Value() interface{}
- type KeyValues
- type Log
- type Process
- type Span
- type SpanID
- type SpanRef
- type SpanRefType
- type Trace
- type TraceID
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationAsMicroseconds ¶
DurationAsMicroseconds converts time.Duration to microseconds, which is the format the Duration field is stored in the Span.
func EpochMicrosecondsAsTime ¶
EpochMicrosecondsAsTime converts microseconds since epoch to time.Time value.
func MicrosecondsAsDuration ¶
MicrosecondsAsDuration converts duration in microseconds to time.Duration value.
func SortSpan ¶ added in v0.5.2
func SortSpan(span *Span)
SortSpan deep sorts a span: this sorts its tags, logs by timestamp, tags in logs, and tags in process.
func SortTrace ¶ added in v0.5.2
func SortTrace(trace *Trace)
SortTrace deep sorts a trace's spans by SpanID.
func SortTraces ¶ added in v0.5.2
func SortTraces(traces []*Trace)
SortTraces deep sorts a list of traces by TraceID.
func TimeAsEpochMicroseconds ¶
TimeAsEpochMicroseconds converts time.Time to microseconds since epoch, which is the format the StartTime field is stored in the Span.
Types ¶
type DependencyLink ¶
type DependencyLink struct { Parent string `json:"parent"` Child string `json:"child"` CallCount uint64 `json:"callCount"` }
DependencyLink shows dependencies between services
type Flags ¶
type Flags uint32
Flags is a bit map of flags for a span
func (Flags) IsDebug ¶
IsDebug returns true if the Flags denote debugging Debugging can be useful in testing tracing availability or correctness
type Hashable ¶
Hashable interface is for type that can participate in a hash computation by writing their data into io.Writer, which is usually an instance of hash.Hash.
type KeyValue ¶
type KeyValue struct { Key string `json:"key"` VType ValueType `json:"vType"` VStr string `json:"vStr,omitempty"` VNum int64 `json:"vNum,omitempty"` VBlob []byte `json:"vBlob,omitempty"` }
KeyValue describes a tag or a log field that consists of a key and a typed value. Before accessing a value, the caller must check the type. Boolean and numeric values should be accessed via accessor methods Bool(), Int64(), and Float64().
This struct is designed to minimize heap allocations.
func (*KeyValue) AsString ¶
AsString returns a potentially lossy string representation of the value.
func (*KeyValue) Binary ¶
Binary returns the blob ([]byte) value stored in this KeyValue or nil if it stores a different type. The caller must check VType before using this method.
func (*KeyValue) Bool ¶
Bool returns the Boolean value stored in this KeyValue or false if it stores a different type. The caller must check VType before using this method.
func (*KeyValue) Float64 ¶
Float64 returns the Float64 value stored in this KeyValue or 0 if it stores a different type. The caller must check VType before using this method.
func (*KeyValue) Int64 ¶
Int64 returns the Int64 value stored in this KeyValue or 0 if it stores a different type. The caller must check VType before using this method.
type KeyValues ¶
type KeyValues []KeyValue
KeyValues is a type alias that exposes convenience functions like Sort, FindByKey.
func (KeyValues) Equal ¶
Equal compares KeyValues with another list. Both lists must be already sorted.
func (KeyValues) FindByKey ¶
FindByKey scans the list of key-values searching for the first one with the given key. Returns found tag and a boolean flag indicating if the search was successful.
type Log ¶
Log describes a micro-log entry that consists of a timestamp and one or more key-value fields
type Process ¶
type Process struct { ServiceName string `json:"serviceName"` Tags KeyValues `json:"tags,omitempty"` }
Process describes an instance of an application or service that emits tracing data.
func NewProcess ¶
NewProcess creates a new Process for given serviceName and tags. The tags are sorted in place and kept in the the same array/slice, in order to store the Process in a canonical form that is relied upon by the Equal and Hash functions.
type Span ¶
type Span struct { TraceID TraceID `json:"traceID"` SpanID SpanID `json:"spanID"` ParentSpanID SpanID `json:"parentSpanID"` OperationName string `json:"operationName"` References []SpanRef `json:"references,omitempty"` Flags Flags `json:"flags,omitempty"` StartTime time.Time `json:"startTime"` Duration time.Duration `json:"duration"` Tags KeyValues `json:"tags,omitempty"` Logs []Log `json:"logs,omitempty"` Process *Process `json:"process"` Warnings []string `json:"warnings,omitempty"` }
Span represents a unit of work in an application, such as an RPC, a database call, etc.
func (*Span) HasSpanKind ¶
func (s *Span) HasSpanKind(kind ext.SpanKindEnum) bool
HasSpanKind returns true if the span has a `span.kind` tag set to `kind`.
func (*Span) IsRPCClient ¶
IsRPCClient returns true if the span represents a client side of an RPC, as indicated by the `span.kind` tag set to `client`.
func (*Span) IsRPCServer ¶
IsRPCServer returns true if the span represents a server side of an RPC, as indicated by the `span.kind` tag set to `server`.
func (*Span) NormalizeTimestamps ¶
func (s *Span) NormalizeTimestamps()
NormalizeTimestamps changes all timestamps in this span to UTC.
type SpanID ¶
type SpanID uint64
SpanID is a random 64bit identifier for a span
func SpanIDFromString ¶
SpanIDFromString creates a SpanID from a hexadecimal string
func (SpanID) MarshalText ¶
MarshalText allows SpanID to serialize itself in JSON as a string.
func (*SpanID) UnmarshalText ¶
UnmarshalText allows SpanID to deserialize itself from a JSON string.
type SpanRef ¶
type SpanRef struct { RefType SpanRefType `json:"refType"` TraceID TraceID `json:"traceID"` SpanID SpanID `json:"spanID"` }
SpanRef describes a reference from one span to another
type SpanRefType ¶
type SpanRefType int
SpanRefType describes the type of a span reference
const ( // ChildOf span reference type describes a reference to a parent span // that depends on the response from the current (child) span ChildOf SpanRefType = iota // FollowsFrom span reference type describes a reference to a "parent" span // that does not depend on the response from the current (child) span FollowsFrom )
func SpanRefTypeFromString ¶
func SpanRefTypeFromString(s string) (SpanRefType, error)
SpanRefTypeFromString converts a string into SpanRefType enum.
func (SpanRefType) MarshalText ¶
func (p SpanRefType) MarshalText() ([]byte, error)
MarshalText allows SpanRefType to serialize itself in JSON as a string.
func (SpanRefType) String ¶
func (p SpanRefType) String() string
func (*SpanRefType) UnmarshalText ¶
func (p *SpanRefType) UnmarshalText(text []byte) error
UnmarshalText allows SpanRefType to deserialize itself from a JSON string.
type Trace ¶
type Trace struct { Spans []*Span `json:"spans,omitempty"` Warnings []string `json:"warnings,omitempty"` }
Trace is a directed acyclic graph of Spans
func (*Trace) FindSpanByID ¶
FindSpanByID looks for a span with given span ID and returns the first one it finds (search order is unspecified), or nil if no spans have that ID.
func (*Trace) NormalizeTimestamps ¶
func (t *Trace) NormalizeTimestamps()
NormalizeTimestamps changes all timestamps in this trace to UTC.
type TraceID ¶
TraceID is a random 128bit identifier for a trace
func TraceIDFromString ¶
TraceIDFromString creates a TraceID from a hexadecimal string
func (TraceID) MarshalText ¶
MarshalText allows TraceID to serialize itself in JSON as a string.
func (*TraceID) UnmarshalText ¶
UnmarshalText allows TraceID to deserialize itself from a JSON string.
type ValueType ¶
type ValueType int
ValueType describes the type of value contained in a KeyValue struct
const ( // StringType indicates the value is a unicode string StringType ValueType = iota // BoolType indicates the value is a Boolean encoded as int64 number 0 or 1 BoolType // Int64Type indicates the value is an int64 number Int64Type // Float64Type indicates the value is a float64 number stored as int64 Float64Type // BinaryType indicates the value is binary blob stored as a byte array BinaryType )
func ValueTypeFromString ¶
ValueTypeFromString converts a string into ValueType enum.
func (ValueType) MarshalText ¶
MarshalText allows ValueType to serialize itself in JSON as a string.
func (*ValueType) UnmarshalText ¶
UnmarshalText allows ValueType to deserialize itself from a JSON string.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package adjuster contains various adjusters for model.Trace.
|
Package adjuster contains various adjusters for model.Trace. |
Package converter contains various utilities for converting model.Trace to/from other data modes, like Thrift, or UI JSON.
|
Package converter contains various utilities for converting model.Trace to/from other data modes, like Thrift, or UI JSON. |
json
Package json allows converting model.Trace to external JSON data model.
|
Package json allows converting model.Trace to external JSON data model. |
thrift
Package thrift allows converting model.Trace to/from various thrift models.
|
Package thrift allows converting model.Trace to/from various thrift models. |
thrift/jaeger
Package jaeger allows converting model.Trace to/from jaeger.thrift model.
|
Package jaeger allows converting model.Trace to/from jaeger.thrift model. |
thrift/zipkin
Package zipkin allows converting model.Trace to/from zipkin.thrift model.
|
Package zipkin allows converting model.Trace to/from zipkin.thrift model. |
Package json defines the external JSON representation for Jaeger traces.
|
Package json defines the external JSON representation for Jaeger traces. |