-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new metrics for compressed size, streams and tenants
- Loading branch information
1 parent
e1dee72
commit 7208d9c
Showing
7 changed files
with
150 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package wal | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
type ManagerMetrics struct { | ||
NumAvailable prometheus.Gauge | ||
NumPending prometheus.Gauge | ||
NumFlushing prometheus.Gauge | ||
} | ||
|
||
func NewManagerMetrics(r prometheus.Registerer) *ManagerMetrics { | ||
return &ManagerMetrics{ | ||
NumAvailable: promauto.With(r).NewGauge(prometheus.GaugeOpts{ | ||
Name: "wal_segments_available", | ||
Help: "The number of WAL segments accepting writes.", | ||
}), | ||
NumPending: promauto.With(r).NewGauge(prometheus.GaugeOpts{ | ||
Name: "wal_segments_pending", | ||
Help: "The number of WAL segments waiting to be flushed.", | ||
}), | ||
NumFlushing: promauto.With(r).NewGauge(prometheus.GaugeOpts{ | ||
Name: "wal_segments_flushing", | ||
Help: "The number of WAL segments being flushed.", | ||
}), | ||
} | ||
} | ||
|
||
type SegmentMetrics struct { | ||
outputSizeBytes prometheus.Histogram | ||
inputSizeBytes prometheus.Histogram | ||
streams prometheus.Histogram | ||
tenants prometheus.Histogram | ||
} | ||
|
||
func NewSegmentMetrics(r prometheus.Registerer) *SegmentMetrics { | ||
return &SegmentMetrics{ | ||
outputSizeBytes: promauto.With(r).NewHistogram(prometheus.HistogramOpts{ | ||
Name: "loki_ingester_rf1_segment_output_size_bytes", | ||
Help: "The segment size as written to disk (compressed).", | ||
Buckets: prometheus.ExponentialBuckets(100, 10, 8), | ||
NativeHistogramBucketFactor: 1.1, | ||
}), | ||
inputSizeBytes: promauto.With(r).NewHistogram(prometheus.HistogramOpts{ | ||
Name: "loki_ingester_rf1_segment_input_size_bytes", | ||
Help: "The segment size (uncompressed).", | ||
Buckets: prometheus.ExponentialBuckets(100, 10, 8), | ||
NativeHistogramBucketFactor: 1.1, | ||
}), | ||
streams: promauto.With(r).NewHistogram(prometheus.HistogramOpts{ | ||
Name: "loki_ingester_rf1_per_segment_streams", | ||
Help: "The number of streams per segment.", | ||
Buckets: prometheus.ExponentialBuckets(1, 2, 10), | ||
NativeHistogramBucketFactor: 1.1, | ||
}), | ||
tenants: promauto.With(r).NewHistogram(prometheus.HistogramOpts{ | ||
Name: "loki_ingester_rf1_per_segment_tenants", | ||
Help: "The number of tenants per segment.", | ||
Buckets: prometheus.ExponentialBuckets(1, 2, 10), | ||
NativeHistogramBucketFactor: 1.1, | ||
}), | ||
} | ||
} | ||
|
||
type Metrics struct { | ||
SegmentMetrics *SegmentMetrics | ||
ManagerMetrics *ManagerMetrics | ||
} | ||
|
||
func NewMetrics(r prometheus.Registerer) *Metrics { | ||
return &Metrics{ | ||
ManagerMetrics: NewManagerMetrics(r), | ||
SegmentMetrics: NewSegmentMetrics(r), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters