Documentation ¶
Overview ¶
Package model contains the Zipkin V2 model which is used by the Zipkin Go tracer implementation.
Third party instrumentation libraries can use the model and transport packages found in this Zipkin Go library to directly interface with the Zipkin Server or Zipkin Collectors without the need to use the tracer implementation itself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrValidTraceIDRequired = errors.New("valid traceId required") ErrValidIDRequired = errors.New("valid span id required") ErrValidDurationRequired = errors.New("valid duration required") )
unmarshal errors
var ErrValidTimestampRequired = errors.New("valid annotation timestamp required")
ErrValidTimestampRequired error
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
Annotation associates an event that explains latency with a timestamp.
func (*Annotation) MarshalJSON ¶
func (a *Annotation) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON encoding
func (*Annotation) UnmarshalJSON ¶
func (a *Annotation) UnmarshalJSON(b []byte) error
UnmarshalJSON implements custom JSON decoding
type Endpoint ¶
type Endpoint struct { ServiceName string `json:"serviceName,omitempty"` IPv4 net.IP `json:"ipv4,omitempty"` IPv6 net.IP `json:"ipv6,omitempty"` Port uint16 `json:"port,omitempty"` }
Endpoint holds the network context of a node in the service graph.
type ID ¶
type ID uint64
ID type
func (ID) MarshalJSON ¶
MarshalJSON serializes an ID type (SpanID, ParentSpanID) to HEX.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON deserializes an ID type (SpanID, ParentSpanID) from HEX.
type Kind ¶
type Kind string
Kind clarifies context of timestamp, duration and remoteEndpoint in a span.
type SpanContext ¶
type SpanContext struct { TraceID TraceID `json:"traceId"` ID ID `json:"id"` ParentID *ID `json:"parentId,omitempty"` Debug bool `json:"debug,omitempty"` Sampled *bool `json:"-"` Err error `json:"-"` }
SpanContext holds the context of a Span.
type SpanModel ¶
type SpanModel struct { SpanContext Name string `json:"name,omitempty"` Kind Kind `json:"kind,omitempty"` Timestamp time.Time `json:"-"` Duration time.Duration `json:"-"` LocalEndpoint *Endpoint `json:"localEndpoint,omitempty"` RemoteEndpoint *Endpoint `json:"remoteEndpoint,omitempty"` Annotations []Annotation `json:"annotations,omitempty"` Tags map[string]string `json:"tags,omitempty"` }
SpanModel structure.
If using this library to instrument your application you will not need to directly access or modify this representation. The SpanModel is exported for use cases involving 3rd party Go instrumentation libraries desiring to export data to a Zipkin server using the Zipkin V2 Span model.
func (SpanModel) MarshalJSON ¶
MarshalJSON exports our Model into the correct format for the Zipkin V2 API.
func (*SpanModel) UnmarshalJSON ¶
UnmarshalJSON imports our Model from a Zipkin V2 API compatible span representation.
type TraceID ¶
TraceID is a 128 bit number internally stored as 2x uint64 (high & low). In case of 64 bit traceIDs, the value can be found in Low.
func TraceIDFromHex ¶
TraceIDFromHex returns the TraceID from a hex string.
func (TraceID) MarshalJSON ¶
MarshalJSON custom JSON serializer to export the TraceID in the required zero padded hex representation.
func (*TraceID) UnmarshalJSON ¶
UnmarshalJSON custom JSON deserializer to retrieve the traceID from the hex encoded representation.