/
telemetry.go
47 lines (40 loc) · 1.85 KB
/
telemetry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
package listeners
import (
"github.com/DataDog/datadog-agent/pkg/telemetry"
)
var (
// UDP
tlmUDPPackets = telemetry.NewCounter("dogstatsd", "udp_packets",
[]string{"state"}, "Dogstatsd UDP packets count")
tlmUDPPacketsBytes = telemetry.NewCounter("dogstatsd", "udp_packets_bytes",
nil, "Dogstatsd UDP packets bytes count")
// UDS
tlmUDSPackets = telemetry.NewCounter("dogstatsd", "uds_packets",
[]string{"listener_id", "transport", "state"}, "Dogstatsd UDS packets count")
tlmUDSOriginDetectionError = telemetry.NewCounter("dogstatsd", "uds_origin_detection_error",
[]string{"listener_id", "transport"}, "Dogstatsd UDS origin detection error count")
tlmUDSPacketsBytes = telemetry.NewCounter("dogstatsd", "uds_packets_bytes",
[]string{"listener_id", "transport"}, "Dogstatsd UDS packets bytes")
tlmUDSConnections = telemetry.NewGauge("dogstatsd", "uds_connections",
[]string{"listener_id", "transport"}, "Dogstatsd UDS connections count")
tlmListener = telemetry.NewHistogramNoOp()
defaultListenerBuckets = []float64{300, 500, 1000, 1500, 2000, 2500, 3000, 10000, 20000, 50000}
)
// InitTelemetry initialize the telemetry.Histogram buckets for the internal
// telemetry. This will be called once the first dogstatsd server is created
// since we need the configuration to be fully loaded.
func InitTelemetry(buckets []float64) {
if buckets == nil {
buckets = defaultListenerBuckets
}
tlmListener = telemetry.NewHistogram(
"dogstatsd",
"listener_read_latency",
[]string{"listener_id", "transport", "listener_type"},
"Time in nanoseconds while the listener is not reading data",
buckets)
}