model

package
Version: v0.0.0-...-24d4c76 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package model is a generated protocol buffer package.

It is generated from these files:

span.proto
trace.proto
trace_payload.proto

It has these top-level messages:

Span
APITrace
TracePayload

Index

Constants

View Source
const (
	// MaxServiceLen the maximum length a service can have
	MaxServiceLen = 100
	// MaxNameLen the maximum length a name can have
	MaxNameLen = 100
	// MaxTypeLen the maximum length a span type can have
	MaxTypeLen = 100
	// MaxEndDateOffset the maximum amount of time in the future we
	// tolerate for span end dates
	MaxEndDateOffset = 10 * time.Minute
)
View Source
const (
	HITS     string = "hits"
	ERRORS          = "errors"
	DURATION        = "duration"
)

Hardcoded measures names for ease of reference

View Source
const (
	// MaxResourceLen the maximum length the resource can have
	MaxResourceLen = 5000
	// MaxMetaKeyLen the maximum length of metadata key
	MaxMetaKeyLen = 100
	// MaxMetaValLen the maximum length of metadata value
	MaxMetaValLen = 5000
	// MaxMetricsKeyLen the maximum length of a metric name key
	MaxMetricsKeyLen = MaxMetaKeyLen
)
View Source
const AppType = "app_type"

AppType is one of the pieces of information embedded in ServiceMetadata

View Source
const ServiceApp = "app"

ServiceApp represents the app to which certain integration belongs to

View Source
const (
	// SpanSampleRateMetricKey is the metric key holding the sample rate
	SpanSampleRateMetricKey = "_sample_rate"
)
View Source
const (
	// TraceMetricsKey is a tag key which, if set to true,
	// ensures all statistics are computed for this span.
	// [FIXME] *not implemented yet*
	TraceMetricsKey = "datadog.trace_metrics"
)

Variables

View Source
var (
	ErrInvalidLengthSpan = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSpan   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// DefaultCounts is an array of the measures we represent as Count by default
	DefaultCounts = [...]string{HITS, ERRORS, DURATION}
	// DefaultDistributions is an array of the measures we represent as Distribution by default
	// Not really used right now as we don't have a way to easily add new distros
	DefaultDistributions = [...]string{DURATION}
)
View Source
var (
	ErrInvalidLengthTrace = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTrace   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthTracePayload = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTracePayload   = fmt.Errorf("proto: integer overflow")
)
View Source
var ErrLimitedReaderLimitReached = errors.New("read limit reached")

ErrLimitedReaderLimitReached indicates that the read limit has been reached.

View Source
var (
	// GlobalAgentPayloadVersion is a default that will be used
	// in all the AgentPayload method. Override for special cases.
	GlobalAgentPayloadVersion = AgentPayloadV01
)
View Source
var (
	// Year2000NanosecTS is an arbitrary cutoff to spot weird-looking values
	Year2000NanosecTS = time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC).UnixNano()
)

Functions

func AgentPayloadAPIPath

func AgentPayloadAPIPath() string

AgentPayloadAPIPath returns the path (after the first slash) to which the payload should be sent to be understood by the API given the configured payload version.

func EncodeAgentPayload

func EncodeAgentPayload(p *AgentPayload) ([]byte, error)

EncodeAgentPayload will return a slice of bytes representing the payload (according to GlobalAgentPayloadVersion)

func EncodeServicesPayload

func EncodeServicesPayload(sm ServicesMetadata) ([]byte, error)

EncodeServicesPayload will return a slice of bytes representing the services metadata, this uses the same versioned endpoint that AgentPayload uses for serialization. Hence watch for GlobalAgentPayloadVersion's value.

func EncodeStatsPayload

func EncodeStatsPayload(payload *StatsPayload) ([]byte, error)

EncodeStatsPayload encodes the stats payload as json/gzip.

func FilterTags

func FilterTags(tags, groups []string) []string

FilterTags will return the tags that have the given group.

func GrainKey

func GrainKey(name, measure, aggr string) string

GrainKey generates the key used to aggregate counts and distributions which is of the form: name|measure|aggr for example: serve|duration|service:webserver

func NormalizeTag

func NormalizeTag(tag string) string

NormalizeTag applies some normalization to ensure the tags match the backend requirements taken from dd-go.model.NormalizeTag

func Now

func Now() int64

Now returns a timestamp in our nanoseconds default format

func RandomID

func RandomID() uint64

RandomID generates a random uint64 that we use for IDs

func SetAgentPayloadHeaders

func SetAgentPayloadHeaders(h http.Header, extras map[string]string)

SetAgentPayloadHeaders takes a Header struct and adds the appropriate header keys for the API to be able to decode the data.

func SetServicesPayloadHeaders

func SetServicesPayloadHeaders(h http.Header)

SetServicesPayloadHeaders takes a Header struct and adds the appropriate header keys for the API to be able to decode the services metadata.

func SetSublayersOnSpan

func SetSublayersOnSpan(span *Span, values []SublayerValue)

SetSublayersOnSpan takes some sublayers and pins them on the given span.Metrics

func SplitTag

func SplitTag(tag string) (group, value string)

SplitTag splits the tag into group and value. If it doesn't have a seperator the empty string will be used for the group.

func TagGroup

func TagGroup(tag string) string

TagGroup will return the tag group from the given string. For example, "host:abc" => "host"

Types

type APITrace

type APITrace struct {
	TraceID   uint64  `protobuf:"varint,1,opt,name=traceID,proto3" json:"traceID,omitempty"`
	Spans     []*Span `protobuf:"bytes,2,rep,name=spans" json:"spans,omitempty"`
	StartTime int64   `protobuf:"varint,6,opt,name=startTime,proto3" json:"startTime,omitempty"`
	EndTime   int64   `protobuf:"varint,7,opt,name=endTime,proto3" json:"endTime,omitempty"`
}

func (*APITrace) Descriptor

func (*APITrace) Descriptor() ([]byte, []int)

func (*APITrace) GetSpans

func (m *APITrace) GetSpans() []*Span

func (*APITrace) Marshal

func (m *APITrace) Marshal() (data []byte, err error)

func (*APITrace) MarshalTo

func (m *APITrace) MarshalTo(data []byte) (int, error)

func (*APITrace) ProtoMessage

func (*APITrace) ProtoMessage()

func (*APITrace) Reset

func (m *APITrace) Reset()

func (*APITrace) Size

func (m *APITrace) Size() (n int)

func (*APITrace) String

func (m *APITrace) String() string

func (*APITrace) Unmarshal

func (m *APITrace) Unmarshal(data []byte) error

type AgentPayload

type AgentPayload struct {
	HostName string        `json:"hostname"` // the host name that will be resolved by the API
	Env      string        `json:"env"`      // the default environment this agent uses
	Traces   []Trace       `json:"traces"`   // the traces we sampled
	Stats    []StatsBucket `json:"stats"`    // the statistics we pre-computed
	// contains filtered or unexported fields
}

AgentPayload is the main payload to carry data that has been pre-processed to the Datadog mothership. This is a legacy payload format, used in API v0.1.

func (*AgentPayload) Extras

func (p *AgentPayload) Extras() map[string]string

Extras returns this payloads extra metadata fields

func (*AgentPayload) IsEmpty

func (p *AgentPayload) IsEmpty() bool

IsEmpty tells if a payload contains data. If not, it's useless to flush it.

func (*AgentPayload) SetExtra

func (p *AgentPayload) SetExtra(key, val string)

SetExtra sets the given metadata field on a payload

type AgentPayloadVersion

type AgentPayloadVersion string

AgentPayloadVersion is the version the agent agrees to with the API so that they can encode/decode the data accordingly

const (
	// AgentPayloadV01 is a simple json'd/gzip'd dump of the payload
	AgentPayloadV01 AgentPayloadVersion = "v0.1"
)

type Count

type Count struct {
	Key     string `json:"key"`
	Name    string `json:"name"`    // the name of the trace/spans we count (was a member of TagSet)
	Measure string `json:"measure"` // represents the entity we count, e.g. "hits", "errors", "time" (was Name)
	TagSet  TagSet `json:"tagset"`  // set of tags for which we account this Distribution

	TopLevel float64 `json:"top_level"` // number of top-level spans contributing to this count

	Value float64 `json:"value"` // accumulated values
}

Count represents one specific "metric" we track for a given tagset

func NewCount

func NewCount(m, ckey, name string, tgs TagSet) Count

NewCount returns a new Count for a metric and a given tag set

func (Count) Add

func (c Count) Add(v float64) Count

Add adds some values to one count

func (Count) Merge

func (c Count) Merge(c2 Count) Count

Merge is used when 2 Counts represent the same thing and adds Values

type Distribution

type Distribution struct {
	Key     string `json:"key"`
	Name    string `json:"name"`    // the name of the trace/spans we count (was a member of TagSet)
	Measure string `json:"measure"` // represents the entity we count, e.g. "hits", "errors", "time"
	TagSet  TagSet `json:"tagset"`  // set of tags for which we account this Distribution

	TopLevel float64 `json:"top_level"` // number of top-level spans contributing to this count

	Summary *quantile.SliceSummary `json:"summary"` // actual representation of data
}

Distribution represents a true image of the spectrum of values, allowing arbitrary quantile queries

func NewDistribution

func NewDistribution(m, ckey, name string, tgs TagSet) Distribution

NewDistribution returns a new Distribution for a metric and a given tag set

func (Distribution) Add

func (d Distribution) Add(v float64, sampleID uint64)

Add inserts the proper values in a given distribution from a span

func (Distribution) Copy

func (d Distribution) Copy() Distribution

Copy returns a distro with the same data but a different underlying summary

func (Distribution) Merge

func (d Distribution) Merge(d2 Distribution)

Merge is used when 2 Distributions represent the same thing and it merges the 2 underlying summaries

func (Distribution) Weigh

func (d Distribution) Weigh(weight float64) Distribution

Weigh applies a weight factor to a distribution and return the result as a new distribution.

type LimitedReader

type LimitedReader struct {
	Count int64
	// contains filtered or unexported fields
}

LimitedReader reads from a reader up to a specific limit. When this limit has been reached, any subsequent read will return ErrLimitedReaderLimitReached. The underlying reader has to implement io.ReadCloser so that it can be used with http request bodies.

func NewLimitedReader

func NewLimitedReader(r io.ReadCloser, limit int64) *LimitedReader

NewLimitedReader creates a new LimitedReader.

func (*LimitedReader) Close

func (r *LimitedReader) Close() error

Close closes the underlying reader.

func (*LimitedReader) Read

func (r *LimitedReader) Read(buf []byte) (n int, err error)

Read reads from the underlying reader.

type ServicesMetadata

type ServicesMetadata map[string]map[string]string

ServicesMetadata is a standard key/val meta map attached to each named service

func (*ServicesMetadata) DecodeMsg

func (z *ServicesMetadata) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (ServicesMetadata) EncodeMsg

func (z ServicesMetadata) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (ServicesMetadata) Merge

func (s1 ServicesMetadata) Merge(s2 ServicesMetadata)

Merge adds all entries from s2 to s1

func (ServicesMetadata) Msgsize

func (z ServicesMetadata) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Span

type Span struct {
	Service  string             `protobuf:"bytes,1,opt,name=service,proto3" json:"service" msg:"service"`
	Name     string             `protobuf:"bytes,2,opt,name=name,proto3" json:"name" msg:"name"`
	Resource string             `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource" msg:"resource"`
	TraceID  uint64             `protobuf:"varint,4,opt,name=traceID,proto3" json:"trace_id" msg:"trace_id"`
	SpanID   uint64             `protobuf:"varint,5,opt,name=spanID,proto3" json:"span_id" msg:"span_id"`
	ParentID uint64             `protobuf:"varint,6,opt,name=parentID,proto3" json:"parent_id" msg:"parent_id"`
	Start    int64              `protobuf:"varint,7,opt,name=start,proto3" json:"start" msg:"start"`
	Duration int64              `protobuf:"varint,8,opt,name=duration,proto3" json:"duration" msg:"duration"`
	Error    int32              `protobuf:"varint,9,opt,name=error,proto3" json:"error" msg:"error"`
	Meta     map[string]string  `` /* 144-byte string literal not displayed */
	Metrics  map[string]float64 `` /* 155-byte string literal not displayed */
	Type     string             `protobuf:"bytes,12,opt,name=type,proto3" json:"type" msg:"type"`
}

func NewFlushMarker

func NewFlushMarker() *Span

NewFlushMarker returns a new flush marker

func (*Span) DecodeMsg

func (z *Span) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Span) Descriptor

func (*Span) Descriptor() ([]byte, []int)

func (*Span) EncodeMsg

func (z *Span) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Span) End

func (s *Span) End() int64

End returns the end time of the span.

func (*Span) ForceMetrics

func (s *Span) ForceMetrics() bool

ForceMetrics returns true if statistics computation should be forced for this span.

func (*Span) GetMeta

func (m *Span) GetMeta() map[string]string

func (*Span) GetMetrics

func (m *Span) GetMetrics() map[string]float64

func (*Span) IsFlushMarker

func (s *Span) IsFlushMarker() bool

IsFlushMarker tells if this is a marker span, which signals the system to flush

func (*Span) Marshal

func (m *Span) Marshal() (data []byte, err error)

func (*Span) MarshalTo

func (m *Span) MarshalTo(data []byte) (int, error)

func (*Span) Msgsize

func (z *Span) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Span) Normalize

func (s *Span) Normalize() error

Normalize makes sure a Span is properly initialized and encloses the minimum required info

func (*Span) ProtoMessage

func (*Span) ProtoMessage()

func (*Span) Reset

func (m *Span) Reset()

func (*Span) SetMetric

func (s *Span) SetMetric(key string, val float64)

SetMetric sets a value in the span Metrics map.

func (*Span) Size

func (m *Span) Size() (n int)

func (*Span) String

func (m *Span) String() string

func (*Span) TopLevel

func (s *Span) TopLevel() bool

TopLevel returns true if span is top-level.

func (*Span) Truncate

func (s *Span) Truncate()

Truncate checks that the span resource, meta and metrics are within the max length and modifies them if they are not

func (*Span) Unmarshal

func (m *Span) Unmarshal(data []byte) error

func (*Span) Weight

func (s *Span) Weight() float64

Weight returns the weight of the span as defined for sampling, i.e. the inverse of the sampling rate.

type StatsBucket

type StatsBucket struct {
	Start    int64 // Timestamp of start in our format
	Duration int64 // Duration of a bucket in nanoseconds

	// Stats indexed by keys
	Counts           map[string]Count        // All the counts
	Distributions    map[string]Distribution // All the distributions (e.g.: for quantile queries)
	ErrDistributions map[string]Distribution // All the error distributions (e.g.: for apdex, as they account for frustrated)
}

StatsBucket is a time bucket to track statistic around multiple Counts

func NewStatsBucket

func NewStatsBucket(ts, d int64) StatsBucket

NewStatsBucket opens a new bucket for time ts and initializes it properly

func (StatsBucket) IsEmpty

func (sb StatsBucket) IsEmpty() bool

IsEmpty just says if this stats bucket has no information (in which case it's useless)

type StatsPayload

type StatsPayload struct {
	HostName string        `json:"hostname"`
	Env      string        `json:"env"`
	Stats    []StatsBucket `json:"stats"`
}

StatsPayload represents the payload to be flushed to the stats endpoint

type StatsRawBucket

type StatsRawBucket struct {
	// contains filtered or unexported fields
}

StatsRawBucket is used to compute span data and aggregate it within a time-framed bucket. This should not be used outside the agent, use StatsBucket for this.

func NewStatsRawBucket

func NewStatsRawBucket(ts, d int64) *StatsRawBucket

NewStatsRawBucket opens a new calculation bucket for time ts and initializes it properly

func (*StatsRawBucket) Export

func (sb *StatsRawBucket) Export() StatsBucket

Export transforms a StatsRawBucket into a StatsBucket, typically used before communicating data to the API, as StatsRawBucket is the internal type while StatsBucket is the public, shared one.

func (*StatsRawBucket) HandleSpan

func (sb *StatsRawBucket) HandleSpan(s *WeightedSpan, env string, aggregators []string, sublayers []SublayerValue)

HandleSpan adds the span to this bucket stats, aggregated with the finest grain matching given aggregators

type SublayerValue

type SublayerValue struct {
	Metric string
	Tag    Tag
	Value  float64
}

SublayerValue is just a span-metric placeholder for a given sublayer val

func ComputeSublayers

func ComputeSublayers(trace Trace) []SublayerValue

ComputeSublayers extracts sublayer values by type and service for a trace

Description of the algorithm, with the following trace as an example:

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 |===|===|===|===|===|===|===|===|===|===|===|===|===|===|===| <-1------------------------------------------------->

<-2----------------->       <-3--------->
    <-4--------->
  <-5------------------->
                    <--6-------------------->
                                        <-7------------->

1: service=web-server, type=web, parent=nil 2: service=pg, type=db, parent=1 3: service=render, type=web, parent=1 4: service=pg-read, type=db, parent=2 5: service=redis, type=cache, parent=1 6: service=rpc1, type=rpc, parent=1 7: service=alert, type=rpc, parent=6

Step 1: Find all time intervals to consider (set of start/end time

of spans):

[0, 10, 15, 20, 50, 60, 70, 80, 110, 120, 130, 150]

Step 2: Map each time intervals to a set of "active" spans. A span

is considered active for a given time interval if it has no
direct child span at that time interval. This is done by
iterating over the spans, iterating over each time
intervals, and checking if the span has a child running
during that time interval. If not, it is considered active:

{
    0: [ 1 ],
    10: [ 2 ],
    15: [ 2, 5 ],
    20: [ 4, 5 ],
    ...
    110: [ 7 ],
    120: [ 1, 7 ],
    130: [ 7 ],
    150: [],
}

Step 4: Build a service and type duration mapping by:

1. iterating over each time intervals
2. computing the time interval duration portion (time
   interval duration / number of active spans)
3. iterate over each active span of that time interval
4. add to the active span's type and service duration the
   duration portion

{
    web-server: 10,
    render: 15,
    pg: 12.5,
    pg-read: 15,
    redis: 27.5,
    rpc1: 30,
    alert: 40,
}
{
    web: 70,
    cache: 55,
    db: 55,
    rpc: 55,
}

func (SublayerValue) GoString

func (v SublayerValue) GoString() string

GoString returns a description of a sublayer value.

func (SublayerValue) String

func (v SublayerValue) String() string

String returns a description of a sublayer value.

type Subtrace

type Subtrace struct {
	Root  *Span
	Trace Trace
}

Subtrace represents the combination of a root span and the trace consisting of all its descendant spans

type Tag

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Tag represents a key / value dimension on traces and stats.

func NewTagFromString

func NewTagFromString(raw string) Tag

NewTagFromString returns a new Tag from a raw string

func (Tag) String

func (t Tag) String() string

String returns a string representation of a tag

type TagSet

type TagSet []Tag

TagSet is an ordered and unique combination of tags

func MergeTagSets

func MergeTagSets(t1, t2 TagSet) TagSet

MergeTagSets merge two tag sets lazily

func NewTagSetFromString

func NewTagSetFromString(raw string) TagSet

NewTagSetFromString returns a new TagSet from a raw string

func (TagSet) Get

func (t TagSet) Get(name string) Tag

Get the tag with the particular name

func (TagSet) HasExactly

func (t TagSet) HasExactly(groups []string) bool

HasExactly returns true if we have tags only for the given groups.

func (TagSet) Key

func (t TagSet) Key() string

Key returns a string representing a new set of tags.

func (TagSet) Len

func (t TagSet) Len() int

func (TagSet) Less

func (t TagSet) Less(i, j int) bool

func (TagSet) Match

func (t TagSet) Match(groups []string) TagSet

Match returns a new tag set with only the tags matching the given groups.

func (TagSet) MatchFilters

func (t TagSet) MatchFilters(filters []string) TagSet

MatchFilters returns a tag set of the tags that match certain filters. A filter is defined as : "KEY:VAL" where:

* KEY is a non-empty string
* VALUE is a string (can be empty)

A tag {Name:k, Value:v} from the input tag set will match if:

* KEY==k and VALUE is non-empty and v==VALUE
* KEY==k and VALUE is empty (don't care about v)

func (TagSet) Swap

func (t TagSet) Swap(i, j int)

func (TagSet) TagKey

func (t TagSet) TagKey(m string) string

TagKey returns a unique key from the string given and the tagset, useful to index stuff on tagsets

func (TagSet) Unset

func (t TagSet) Unset(name string) TagSet

Unset returns a new tagset without a given value

type Trace

type Trace []*Span

Trace is a collection of spans with the same trace ID

func NewTraceFlushMarker

func NewTraceFlushMarker() Trace

NewTraceFlushMarker returns a trace with a single span as flush marker

func NormalizeTrace

func NormalizeTrace(t Trace) (Trace, error)

NormalizeTrace takes a trace and * rejects the trace if there is a trace ID discrepancy between 2 spans * rejects the trace if two spans have the same span_id * rejects empty traces * rejects traces where at least one span cannot be normalized * return the normalized trace and an error:

- nil if the trace can be accepted
- an error string if the trace needs to be dropped

func (Trace) APITrace

func (t Trace) APITrace() *APITrace

APITrace returns an APITrace from the trace, as required by the Datadog API.

func (Trace) ChildrenMap

func (t Trace) ChildrenMap() map[uint64][]*Span

ChildrenMap returns a map containing for each span id the list of its direct children.

func (Trace) ComputeTopLevel

func (t Trace) ComputeTopLevel()

ComputeTopLevel updates all the spans top-level attribute.

A span is considered top-level if: - it's a root span - its parent is unknown (other part of the code, distributed trace) - its parent belongs to another service (in that case it's a "local root"

being the highest ancestor of other spans belonging to this service and
attached to it).

func (*Trace) DecodeMsg

func (z *Trace) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Trace) EncodeMsg

func (z Trace) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Trace) ExtractTopLevelSubtraces

func (t Trace) ExtractTopLevelSubtraces(root *Span) []Subtrace

ExtractTopLevelSubtraces extracts all subtraces rooted in a toplevel span, ComputeTopLevel should be called before.

func (Trace) GetEnv

func (t Trace) GetEnv() string

GetEnv returns the meta value for the "env" key for the first trace it finds or an empty string

func (Trace) GetRoot

func (t Trace) GetRoot() *Span

GetRoot extracts the root span from a trace

func (Trace) Msgsize

func (z Trace) Msgsize() (s int)

type TracePayload

type TracePayload struct {
	HostName     string      `protobuf:"bytes,1,opt,name=hostName,proto3" json:"hostName,omitempty"`
	Env          string      `protobuf:"bytes,2,opt,name=env,proto3" json:"env,omitempty"`
	Traces       []*APITrace `protobuf:"bytes,3,rep,name=traces" json:"traces,omitempty"`
	Transactions []*Span     `protobuf:"bytes,4,rep,name=transactions" json:"transactions,omitempty"`
}

func (*TracePayload) Descriptor

func (*TracePayload) Descriptor() ([]byte, []int)

func (*TracePayload) GetTraces

func (m *TracePayload) GetTraces() []*APITrace

func (*TracePayload) GetTransactions

func (m *TracePayload) GetTransactions() []*Span

func (*TracePayload) Marshal

func (m *TracePayload) Marshal() (data []byte, err error)

func (*TracePayload) MarshalTo

func (m *TracePayload) MarshalTo(data []byte) (int, error)

func (*TracePayload) ProtoMessage

func (*TracePayload) ProtoMessage()

func (*TracePayload) Reset

func (m *TracePayload) Reset()

func (*TracePayload) Size

func (m *TracePayload) Size() (n int)

func (*TracePayload) String

func (m *TracePayload) String() string

func (*TracePayload) Unmarshal

func (m *TracePayload) Unmarshal(data []byte) error

type Traces

type Traces []Trace

Traces is a list of traces. This model matters as this is what we unpack from msgp.

func TracesFromSpans

func TracesFromSpans(spans []Span) Traces

TracesFromSpans transforms a slice of spans into a slice of traces grouping them by trace IDs FIXME[1.x] this can be removed as we get pre-assembled traces from clients

func (*Traces) DecodeMsg

func (z *Traces) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Traces) EncodeMsg

func (z Traces) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Traces) Msgsize

func (z Traces) Msgsize() (s int)

type WeightedSpan

type WeightedSpan struct {
	Weight   float64 // Span weight. Similar to the trace root.Weight().
	TopLevel bool    // Is this span a service top-level or not. Similar to span.TopLevel().

	*Span
}

WeightedSpan extends Span to contain weights required by the Concentrator.

type WeightedTrace

type WeightedTrace []*WeightedSpan

WeightedTrace is a slice of WeightedSpan pointers.

func NewWeightedTrace

func NewWeightedTrace(trace Trace, root *Span) WeightedTrace

NewWeightedTrace returns a weighted trace, with coefficient required by the concentrator.

Jump to

Keyboard shortcuts

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