Skip to content

Commit e0968bc

Browse files
committed
parquet converter: include user id in converter counter metrics (#11966)
Adding user id to the converter metrics to better track converter progress through tenants. Signed-off-by: Jesus Vazquez <[email protected]>
1 parent d2c7065 commit e0968bc

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pkg/parquetconverter/metrics.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ import (
1010
)
1111

1212
type parquetConverterMetrics struct {
13-
blocksConverted prometheus.Counter
14-
blocksConvertedFailed prometheus.Counter
15-
conversionDuration prometheus.Histogram
13+
blocksConverted *prometheus.CounterVec
14+
blocksConvertedFailed *prometheus.CounterVec
15+
conversionDuration *prometheus.HistogramVec
1616
tenantsDiscovered prometheus.Gauge
1717
}
1818

1919
func newParquetConverterMetrics(reg prometheus.Registerer) parquetConverterMetrics {
2020
var m parquetConverterMetrics
2121

22-
m.blocksConverted = promauto.With(reg).NewCounter(prometheus.CounterOpts{
22+
m.blocksConverted = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
2323
Name: "cortex_parquet_converter_blocks_converted_total",
2424
Help: "Total number of blocks converted to parquet format",
25-
})
25+
}, []string{"user"})
2626

27-
m.blocksConvertedFailed = promauto.With(reg).NewCounter(prometheus.CounterOpts{
27+
m.blocksConvertedFailed = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
2828
Name: "cortex_parquet_converter_blocks_converted_failed_total",
2929
Help: "Total number of blocks that failed to convert to parquet format",
30-
})
30+
}, []string{"user"})
3131

32-
m.conversionDuration = promauto.With(reg).NewHistogram(prometheus.HistogramOpts{
32+
m.conversionDuration = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
3333
Name: "cortex_parquet_converter_conversion_duration_seconds",
3434
Help: "Time taken to convert a block to parquet format",
3535
NativeHistogramBucketFactor: 1.1,
3636
NativeHistogramMaxBucketNumber: 100,
3737
NativeHistogramMinResetDuration: 1 * time.Hour,
38-
})
38+
}, []string{"user"})
3939

4040
m.tenantsDiscovered = promauto.With(reg).NewGauge(prometheus.GaugeOpts{
4141
Name: "cortex_parquet_converter_tenants_discovered",

pkg/parquetconverter/parquet_converter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ func (c *ParquetConverter) processBlock(ctx context.Context, userID string, meta
304304
var skipped bool
305305
defer func() {
306306
duration := time.Since(start)
307-
c.metrics.conversionDuration.Observe(duration.Seconds())
307+
c.metrics.conversionDuration.WithLabelValues(userID).Observe(duration.Seconds())
308308
if err != nil {
309-
c.metrics.blocksConvertedFailed.Inc()
309+
c.metrics.blocksConvertedFailed.WithLabelValues(userID).Inc()
310310
} else if !skipped {
311-
c.metrics.blocksConverted.Inc()
311+
c.metrics.blocksConverted.WithLabelValues(userID).Inc()
312312
}
313313
}()
314314

0 commit comments

Comments
 (0)