Documentation ¶
Index ¶
- type Config
- type ConfigResponse
- type Metric
- type MetricType
- type Span
- func (z *Span) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Span) EncodeMsg(en *msgp.Writer) (err error)
- func (span Span) EndTime() time.Time
- func (z *Span) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Span) Msgsize() (s int)
- func (span Span) StartTime() time.Time
- func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error)
- type SpanList
- type SpanLists
- type Tag
- type Tags
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // A port <= 0 should instruct Java to skip this and use an internal default StatsDPort int `json:"statsd_port"` }
type ConfigResponse ¶
type ConfigResponse struct { Version string `json:"version"` Config Config `json:"config"` // Must not be nil. // These are just paths, not hosts: // - https://github.com/DataDog/dd-trace-java/blob/0f986a71765d0bad85ed4e5c3bc6ef44b8cb78fe/communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java#L39 // - https://github.com/DataDog/dd-trace-java/blob/0f986a71765d0bad85ed4e5c3bc6ef44b8cb78fe/communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java#L59C46-L59C65 // In the java version, whether or not metrics or tracing are enabled is contingent on // whether those paths are found in here. Endpoints []string `json:"endpoints"` ClientDropP0s bool `json:"client_drop_p0s,omitempty"` }
JSON response to 'GET /v0.7/config', sponged out of DDAgentFeaturesDiscovery.java in https://github.com/DataDog/dd-trace-java/
type Metric ¶
type Metric struct { LogType string `json:"_type"` // Useless field to cover over lousy polymorphism support in Go; should always be "metric" At time.Time `json:"at"` From string `json:"from"` // Client that sent the metric. Not part of the protocol, but useful for dumping. Name string `json:"name"` Type ValueType `json:"type"` Int int64 `json:"int"` Ints []int64 `json:"ints,omitempty"` Float float64 `json:"float"` Floats []float64 `json:"floats,omitempty"` Metric MetricType `json:"metric"` Rate float64 `json:"rate"` // [0.0, 1.0] HasRate bool `json:"hasRate"` // false if no rate parsed from msg Tags Tags `json:"tagList,omitempty"` Container string `json:"container,omitempty"` // When this field is provided, the Datadog Agent doesn’t do any processing with the // metrics (no aggregation) except from enriching the metrics with tags. This can be // useful if you already aggregate your metrics in your application, and you want to // send them to Datadog without extra processing. // // The Unix timestamp should be a valid positive number in the past. Only GAUGE and // COUNT metrics are supported. UnixTimeSecs int64 `json:"unixTimeSecs,omitempty"` Unsupported []string `json:"unsupported,omitempty"` }
Metric parsed from a single dogstats entry in a dogstatsd packet.
Note that this does not use a Go generic as there's no ergonomic way to do so and maintain some usefulness with the JSON encoder, but it is effectively a union.
The Type field determines whether the Int, Ints, Float or Floats field should be used.
---
func (Metric) CanMarshalJSON ¶
DogstatsD will handle float values like infinity and NaN just fine, but we can't directly dump those to JSON. This is a stopgap until a better approach emerges that doesn't compromise the usefulness of the Metric type.
func (*Metric) FromMsg ¶
Parses a Metric from a string.
Formats documented here: https://docs.datadoghq.com/developers/dogstatsd/datagram_shell/?tab=metrics
Dogstats 1.0: <METRIC_NAME>:<VALUE>|<TYPE>|@<SAMPLE_RATE>|#<TAG_KEY_1>:<TAG_VALUE_1>,<TAG_2>
Dogstats 1.1: <METRIC_NAME>:<VALUE1>:<VALUE2>:<VALUE3>|<TYPE>|@<SAMPLE_RATE>|#<TAG_KEY_1>:<TAG_VALUE_1>,<TAG_2>
Dogstats 1.2: <METRIC_NAME>:<VALUE>|<TYPE>|#<TAG_KEY_1>:<TAG_VALUE_1>,<TAG_2>|c:<CONTAINER_ID>
Dogstats 1.3: <METRIC_NAME>:<VALUE>|<TYPE>|#<TAG_KEY_1>:<TAG_VALUE_1>,<TAG_2>|T<METRIC_TIMESTAMP>
---
type MetricType ¶
type MetricType string
const ( CountMetric MetricType = "c" GaugeMetric MetricType = "g" TimerMetric MetricType = "ms" HistogramMetric MetricType = "h" SetMetric MetricType = "s" DistributionMetric MetricType = "d" )
func (MetricType) IsValid ¶
func (m MetricType) IsValid() bool
type Span ¶
type Span struct { Name string `msg:"name" json:"name"` Service string `msg:"service" json:"service"` Resource string `msg:"resource" json:"resource"` Type *string `msg:"type" json:"type"` StartUnixNano int64 `msg:"start" json:"start"` // NOTE: This is a float of 'seconds' in /api/v1/trace, but a unixnano here Duration time.Duration `msg:"duration" json:"duration"` Meta map[string]string `msg:"meta,omitempty" json:"meta,omitempty"` Metrics map[string]float64 `msg:"metrics,omitempty" json:"metrics,omitempty"` SpanID uint64 `msg:"span_id" json:"spanId"` TraceID uint64 `msg:"trace_id" json:"traceId"` ParentID uint64 `msg:"parent_id" json:"parentId"` Error int32 `msg:"error" json:"error"` }
func (*Span) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SpanList ¶
type SpanList []Span
func (SpanList) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SpanLists ¶
type SpanLists []SpanList
func (SpanLists) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler