types

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func IsLegacyAPIKey added in v1.11.0

func IsLegacyAPIKey(apiKey string) bool

Types

type Event

type Event struct {
	Context     context.Context
	APIHost     string
	APIKey      string
	Dataset     string
	Environment 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 RequestIDContextKey

type RequestIDContextKey struct{}

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

type Span

type Span struct {
	Event
	TraceID     string
	DataSize    int
	ArrivalTime time.Time
}

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

func (*Span) CacheImpact added in v1.19.0

func (sp *Span) CacheImpact(traceTimeout time.Duration) int

CacheImpact calculates an abstract value for something we're calling cache impact, which is the product of the size of the span and a factor related to the amount of time the span has been stored in the cache, based on the TraceTimeout value.

func (*Span) GetDataSize added in v1.19.0

func (sp *Span) GetDataSize() int

GetDataSize computes the size of the Data element of the Span. Note that it's not the full size of the span, but we're mainly using this for relative ordering, not absolute calculations.

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

	SendBy time.Time

	// ArrivalTime is the server time when the first span arrived for this trace.
	// Used to calculate how long traces spend sitting in Refinery
	ArrivalTime time.Time

	RootSpan *Span

	// DataSize is the sum of the DataSize of spans that are added.
	// It's used to help expire the most expensive traces.
	DataSize int
	// contains filtered or unexported fields
}

Trace isn't something that shows up on the wire; it gets created within Refinery. 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) CacheImpact added in v1.19.0

func (t *Trace) CacheImpact(traceTimeout time.Duration) int

CacheImpact calculates an abstract value for something we're calling cache impact, which is the sum of the CacheImpact of all of the spans in a trace. We use it to order traces so we can eject the ones that having the most impact on the cache size, but balancing that against preferring to keep newer spans.

func (*Trace) DescendantCount added in v1.20.0

func (t *Trace) DescendantCount() uint

DescendantCount gets the number of descendants of all kinds currently in this trace

func (*Trace) GetSamplerKey added in v1.11.0

func (t *Trace) GetSamplerKey() (string, bool)

func (*Trace) GetSpans

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

GetSpans returns the list of descendants in this trace

Jump to

Keyboard shortcuts

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