-
Notifications
You must be signed in to change notification settings - Fork 10
/
metrics.go
67 lines (59 loc) · 2.76 KB
/
metrics.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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 metrics
import (
"expvar"
"github.com/n9e/n9e-agentd/staging/datadog-agent/pkg/telemetry"
)
var (
// LogsExpvars contains metrics for the logs agent.
LogsExpvars *expvar.Map
// LogsDecoded is the total number of decoded logs
LogsDecoded = expvar.Int{}
// TlmLogsDecoded is the total number of decoded logs
TlmLogsDecoded = telemetry.NewCounter("logs", "decoded",
nil, "Total number of decoded logs")
// LogsProcessed is the total number of processed logs.
LogsProcessed = expvar.Int{}
// TlmLogsProcessed is the total number of processed logs.
TlmLogsProcessed = telemetry.NewCounter("logs", "processed",
nil, "Total number of processed logs")
// LogsSent is the total number of sent logs.
LogsSent = expvar.Int{}
// TlmLogsSent is the total number of sent logs.
TlmLogsSent = telemetry.NewCounter("logs", "sent",
nil, "Total number of sent logs")
// DestinationErrors is the total number of network errors.
DestinationErrors = expvar.Int{}
// TlmDestinationErrors is the total number of network errors.
TlmDestinationErrors = telemetry.NewCounter("logs", "network_errors",
nil, "Total number of network errors")
// DestinationLogsDropped is the total number of logs dropped per Destination
DestinationLogsDropped = expvar.Map{}
// TlmLogsDropped is the total number of logs dropped per Destination
TlmLogsDropped = telemetry.NewCounter("logs", "dropped",
[]string{"destination"}, "Total number of logs dropped per Destination")
// BytesSent is the total number of sent bytes before encoding if any
BytesSent = expvar.Int{}
// TlmBytesSent is the total number of sent bytes before encoding if any
TlmBytesSent = telemetry.NewCounter("logs", "bytes_sent",
nil, "Total number of bytes send before encoding if any")
// EncodedBytesSent is the total number of sent bytes after encoding if any
EncodedBytesSent = expvar.Int{}
// TlmEncodedBytesSent is the total number of sent bytes after encoding if any
TlmEncodedBytesSent = telemetry.NewCounter("logs", "encoded_bytes_sent",
nil, "Total number of sent bytes after encoding if any")
// TODO: Add LogsCollected for the total number of collected logs.
)
func init() {
LogsExpvars = expvar.NewMap("logs-agent")
LogsExpvars.Set("LogsDecoded", &LogsDecoded)
LogsExpvars.Set("LogsProcessed", &LogsProcessed)
LogsExpvars.Set("LogsSent", &LogsSent)
LogsExpvars.Set("DestinationErrors", &DestinationErrors)
LogsExpvars.Set("DestinationLogsDropped", &DestinationLogsDropped)
LogsExpvars.Set("BytesSent", &BytesSent)
LogsExpvars.Set("EncodedBytesSent", &EncodedBytesSent)
}