github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/storage/stores/indexshipper/downloads/metrics.go (about) 1 package downloads 2 3 import ( 4 "github.com/prometheus/client_golang/prometheus" 5 "github.com/prometheus/client_golang/prometheus/promauto" 6 ) 7 8 const ( 9 statusFailure = "failure" 10 statusSuccess = "success" 11 ) 12 13 type metrics struct { 14 queryTimeTableDownloadDurationSeconds *prometheus.CounterVec 15 tablesSyncOperationTotal *prometheus.CounterVec 16 tablesDownloadOperationDurationSeconds prometheus.Gauge 17 } 18 19 func newMetrics(r prometheus.Registerer) *metrics { 20 m := &metrics{ 21 queryTimeTableDownloadDurationSeconds: promauto.With(r).NewCounterVec(prometheus.CounterOpts{ 22 Name: "query_time_table_download_duration_seconds", 23 Help: "Time (in seconds) spent in downloading of files per table at query time", 24 }, []string{"table"}), 25 tablesSyncOperationTotal: promauto.With(r).NewCounterVec(prometheus.CounterOpts{ 26 Name: "tables_sync_operation_total", 27 Help: "Total number of tables sync operations done by status", 28 }, []string{"status"}), 29 tablesDownloadOperationDurationSeconds: promauto.With(r).NewGauge(prometheus.GaugeOpts{ 30 Name: "tables_download_operation_duration_seconds", 31 Help: "Time (in seconds) spent in downloading updated files for all the tables", 32 }), 33 } 34 35 return m 36 }