Metrics: use Namespace everywhere when declaring metrics (#1320)

Code linting to make things consistent.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
pull/1333/head
Julien Pivotto 6 years ago committed by Cyril Tovena
parent 30ec4eba79
commit eb7b495565
  1. 53
      pkg/ingester/flush.go
  2. 5
      pkg/ingester/instance.go
  3. 10
      pkg/ingester/transfer.go
  4. 10
      pkg/util/validation/validate.go

@ -23,47 +23,56 @@ import (
var (
chunkUtilization = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_utilization",
Help: "Distribution of stored chunk utilization (when stored).",
Buckets: prometheus.LinearBuckets(0, 0.2, 6),
Namespace: "loki",
Name: "ingester_chunk_utilization",
Help: "Distribution of stored chunk utilization (when stored).",
Buckets: prometheus.LinearBuckets(0, 0.2, 6),
})
memoryChunks = promauto.NewGauge(prometheus.GaugeOpts{
Name: "loki_ingester_memory_chunks",
Help: "The total number of chunks in memory.",
Namespace: "loki",
Name: "ingester_memory_chunks",
Help: "The total number of chunks in memory.",
})
chunkEntries = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_entries",
Help: "Distribution of stored lines per chunk (when stored).",
Buckets: prometheus.ExponentialBuckets(200, 2, 9), // biggest bucket is 200*2^(9-1) = 51200
Namespace: "loki",
Name: "ingester_chunk_entries",
Help: "Distribution of stored lines per chunk (when stored).",
Buckets: prometheus.ExponentialBuckets(200, 2, 9), // biggest bucket is 200*2^(9-1) = 51200
})
chunkSize = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_size_bytes",
Help: "Distribution of stored chunk sizes (when stored).",
Buckets: prometheus.ExponentialBuckets(10000, 2, 7), // biggest bucket is 10000*2^(7-1) = 640000 (~640KB)
Namespace: "loki",
Name: "ingester_chunk_size_bytes",
Help: "Distribution of stored chunk sizes (when stored).",
Buckets: prometheus.ExponentialBuckets(10000, 2, 7), // biggest bucket is 10000*2^(7-1) = 640000 (~640KB)
})
chunkCompressionRatio = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_compression_ratio",
Help: "Compression ratio of chunks (when stored).",
Buckets: prometheus.LinearBuckets(.75, 2, 10),
Namespace: "loki",
Name: "ingester_chunk_compression_ratio",
Help: "Compression ratio of chunks (when stored).",
Buckets: prometheus.LinearBuckets(.75, 2, 10),
})
chunksPerTenant = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "loki_ingester_chunks_stored_total",
Help: "Total stored chunks per tenant.",
Namespace: "loki",
Name: "ingester_chunks_stored_total",
Help: "Total stored chunks per tenant.",
}, []string{"tenant"})
chunkSizePerTenant = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "loki_ingester_chunk_stored_bytes_total",
Help: "Total bytes stored in chunks per tenant.",
Namespace: "loki",
Name: "ingester_chunk_stored_bytes_total",
Help: "Total bytes stored in chunks per tenant.",
}, []string{"tenant"})
chunkAge = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_age_seconds",
Help: "Distribution of chunk ages (when stored).",
Namespace: "loki",
Name: "ingester_chunk_age_seconds",
Help: "Distribution of chunk ages (when stored).",
// with default settings chunks should flush between 5 min and 12 hours
// so buckets at 1min, 5min, 10min, 30min, 1hr, 2hr, 4hr, 10hr, 12hr, 16hr
Buckets: []float64{60, 300, 600, 1800, 3600, 7200, 14400, 36000, 43200, 57600},
})
chunkEncodeTime = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "loki_ingester_chunk_encode_time_seconds",
Help: "Distribution of chunk encode times.",
Namespace: "loki",
Name: "ingester_chunk_encode_time_seconds",
Help: "Distribution of chunk encode times.",
// 10ms to 10s.
Buckets: prometheus.ExponentialBuckets(0.01, 4, 6),
})

@ -33,8 +33,9 @@ var (
var (
memoryStreams = promauto.NewGauge(prometheus.GaugeOpts{
Name: "loki_ingester_memory_streams",
Help: "The total number of streams in memory.",
Namespace: "loki",
Name: "ingester_memory_streams",
Help: "The total number of streams in memory.",
})
streamsCreatedTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "loki",

@ -21,12 +21,14 @@ import (
var (
sentChunks = promauto.NewCounter(prometheus.CounterOpts{
Name: "loki_ingester_sent_chunks",
Help: "The total number of chunks sent by this ingester whilst leaving.",
Namespace: "loki",
Name: "ingester_sent_chunks",
Help: "The total number of chunks sent by this ingester whilst leaving.",
})
receivedChunks = promauto.NewCounter(prometheus.CounterOpts{
Name: "loki_ingester_received_chunks",
Help: "The total number of chunks received by this ingester whilst joining.",
Namespace: "loki",
Name: "ingester_received_chunks",
Help: "The total number of chunks received by this ingester whilst joining.",
})
)

@ -13,8 +13,9 @@ const (
// DiscardedBytes is a metric of the total discarded bytes, by reason.
var DiscardedBytes = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "loki_discarded_bytes_total",
Help: "The total number of bytes that were discarded.",
Namespace: "loki",
Name: "discarded_bytes_total",
Help: "The total number of bytes that were discarded.",
},
[]string{discardReasonLabel, "tenant"},
)
@ -22,8 +23,9 @@ var DiscardedBytes = prometheus.NewCounterVec(
// DiscardedSamples is a metric of the number of discarded samples, by reason.
var DiscardedSamples = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "loki_discarded_samples_total",
Help: "The total number of samples that were discarded.",
Namespace: "loki",
Name: "discarded_samples_total",
Help: "The total number of samples that were discarded.",
},
[]string{discardReasonLabel, "tenant"},
)

Loading…
Cancel
Save