Skip to content

Commit a66258c

Browse files
committed
Metrics prefix netobserv
1 parent cb17208 commit a66258c

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

loki/client.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,43 @@ const (
4141

4242
LatencyLabel = "filename"
4343
HostLabel = "host"
44+
MetricPrefix = "netobserv"
4445
)
4546

4647
var (
4748
encodedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
48-
Namespace: "promtail",
49-
Name: "encoded_bytes_total",
49+
Namespace: MetricPrefix,
50+
Name: "loki_encoded_bytes_total",
5051
Help: "Number of bytes encoded and ready to send.",
5152
}, []string{HostLabel})
5253
sentBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
53-
Namespace: "promtail",
54-
Name: "sent_bytes_total",
54+
Namespace: MetricPrefix,
55+
Name: "loki_sent_bytes_total",
5556
Help: "Number of bytes sent.",
5657
}, []string{HostLabel})
5758
droppedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
58-
Namespace: "promtail",
59-
Name: "dropped_bytes_total",
59+
Namespace: MetricPrefix,
60+
Name: "loki_dropped_bytes_total",
6061
Help: "Number of bytes dropped because failed to be sent to the ingester after all retries.",
6162
}, []string{HostLabel})
6263
sentEntries = prometheus.NewCounterVec(prometheus.CounterOpts{
63-
Namespace: "promtail",
64-
Name: "sent_entries_total",
64+
Namespace: MetricPrefix,
65+
Name: "loki_sent_entries_total",
6566
Help: "Number of log entries sent to the ingester.",
6667
}, []string{HostLabel})
6768
droppedEntries = prometheus.NewCounterVec(prometheus.CounterOpts{
68-
Namespace: "promtail",
69-
Name: "dropped_entries_total",
69+
Namespace: MetricPrefix,
70+
Name: "loki_dropped_entries_total",
7071
Help: "Number of log entries dropped because failed to be sent to the ingester after all retries.",
7172
}, []string{HostLabel})
7273
requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
73-
Namespace: "promtail",
74-
Name: "request_duration_seconds",
74+
Namespace: MetricPrefix,
75+
Name: "loki_request_duration_seconds",
7576
Help: "Duration of send requests.",
7677
}, []string{"status_code", HostLabel})
7778
batchRetries = prometheus.NewCounterVec(prometheus.CounterOpts{
78-
Namespace: "promtail",
79-
Name: "batch_retries_total",
79+
Namespace: MetricPrefix,
80+
Name: "loki_batch_retries_total",
8081
Help: "Number of times batches has had to be retried.",
8182
}, []string{HostLabel})
8283
streamLag *metric.Gauges
@@ -97,7 +98,7 @@ func init() {
9798
prometheus.MustRegister(requestDuration)
9899
prometheus.MustRegister(batchRetries)
99100
var err error
100-
streamLag, err = metric.NewGauges("promtail_stream_lag_seconds",
101+
streamLag, err = metric.NewGauges(MetricPrefix+"_loki_stream_lag_seconds",
101102
"Difference between current time and last batch timestamp for successful sends",
102103
metric.GaugeConfig{Action: "set"},
103104
int64(1*time.Minute.Seconds()), // This strips out files which update slowly and reduces noise in this metric.

0 commit comments

Comments
 (0)