types

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIKeyHeader = "X-Honeycomb-Team"
	// libhoney-js uses this
	APIKeyHeaderShort = "X-Hny-Team"
	SampleRateHeader  = "X-Honeycomb-Samplerate"
	TimestampHeader   = "X-Honeycomb-Event-Time"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Context    context.Context
	Type       EventType
	Target     TargetType
	APIHost    string
	APIKey     string
	Dataset    string
	SampleRate uint
	Timestamp  time.Time
	Data       map[string]interface{}
}

event is not part of a trace - it's an event that showed up with no trace ID

type EventType

type EventType int
const (
	EventTypeUnknown EventType = iota
	EventTypeSpan
	EventTypeEvent
)

func (EventType) String

func (et EventType) String() string

type RequestIDContextKey

type RequestIDContextKey struct{}

used to put a request ID into the request context for logging

type Span

type Span struct {
	Event
	TraceID string
}

Span is an event that shows up with a trace ID, so will be part of a Trace

type TargetType

type TargetType int
const (
	TargetUnknown TargetType = iota
	TargetPeer
	TargetUpstream
)

func (TargetType) String

func (tt TargetType) String() string

type Trace

type Trace struct {
	APIHost string
	APIKey  string
	Dataset string
	TraceID string

	// SampleRate should only be changed if the changer holds the SendSampleLock
	SampleRate uint
	// KeepSample should only be changed if the changer holds the SendSampleLock
	KeepSample bool
	// Sent should only be changed if the changer holds the SendSampleLock
	Sent bool

	// StartTime is the server time when the first span arrived for this trace.
	// Used to calculate how long traces spend sitting in Samproxy
	StartTime time.Time
	// FinishTime is when a trace is prepared for sending; it does not include
	// any additional delay imposed by the DelaySend config option.
	FinishTime time.Time

	// CanceSending is a channel used to abort the trace timeout if we send or
	// sample this trace so that we're not sitting around with tons of goroutines
	// waiting a full minute (or whatever the trace timeout is) then doing nothing.
	// Closing this channel will cause any still-waiting send timers to exit.
	CancelSending chan struct{}

	SendOnce sync.Once
	// contains filtered or unexported fields
}

Trace isn't something that shows up on the wire; it gets created within Samproxy. Traces are not thread-safe; only one goroutine should be working with a trace object at a time.

func (*Trace) AddSpan

func (t *Trace) AddSpan(sp *Span)

AddSpan adds a span to this trace

func (*Trace) GetSent

func (t *Trace) GetSent() bool

GetSent returns true if this trace has already been sent, false if it has not yet been sent.

func (*Trace) GetSpans

func (t *Trace) GetSpans() []*Span

GetSpans returns the list of spans in this trace

Jump to

Keyboard shortcuts

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