types

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTimestamp

func ConvertTimestamp(tsMicros int64) time.Time

ConvertTimestamp turns a Zipkin timestamp (a Unix timestamp in microseconds) into a time.Time value.

func GuessAnnotationType

func GuessAnnotationType(v interface{}) interface{}

GuessAnnotationType takes a value and, if it is a string, turns it into a bool, int64 or float64 value when possible. This is a workaround for the fact that Zipkin v1 BinaryAnnotation values are always transmitted as strings. (See e.g. the Zipkin API spec here: https://github.com/openzipkin/zipkin-api/blob/72280f3/zipkin-api.yaml#L235-L245)

However it considers the possibility that the value is not a string in case the BinaryAnnotation does not implement the Zipkin API v1 spec. In this case it will just return the same value, without modifying it. See this issue for such an example: https://github.com/honeycombio/honeycomb-opentracing-proxy/issues/37

Types

type CoreSpanMetadata

type CoreSpanMetadata struct {
	TraceID      string  `json:"traceId"`
	TraceIDAsInt int64   `json:"-"` // Zipkin trace ID as integer; not added to events, but used for sampling decisions
	Name         string  `json:"name"`
	ID           string  `json:"id"`
	ParentID     string  `json:"parentId,omitempty"`
	ServiceName  string  `json:"serviceName,omitempty"`
	HostIPv4     string  `json:"hostIPv4,omitempty"`
	Port         int     `json:"port,omitempty"`
	Debug        bool    `json:"debug,omitempty"`
	DurationMs   float64 `json:"durationMs,omitempty"`
}

CoreSpanMetadata is the subset of span data that can be added directly into a libhoney event. Annotations, BinaryAnnotations and Timestamp need special handling.

type Span

type Span struct {
	CoreSpanMetadata
	Annotations       []*annotation          `json:"annotations,omitempty"` // TODO lift annotation struct definition into this file
	BinaryAnnotations map[string]interface{} `json:"binaryAnnotations,omitempty"`
	Timestamp         time.Time              `json:"timestamp,omitempty"`
}

Span represents a Zipkin span in a format more useful for consumption in Honeycomb.

  • BinaryAnnotations are turned into a key: value map.
  • Endpoint values in BinaryAnnotations are lifted into top-level HostIPv4/Port/ServiceName values on the span.
  • Timestamp and Duration values are turned into time.Time and millisecond values, respectively.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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