@@ -3,9 +3,12 @@ package fracmanager
33import (
44 "github.com/prometheus/client_golang/prometheus"
55 "github.com/prometheus/client_golang/prometheus/promauto"
6+
7+ "github.com/ozontech/seq-db/metric"
68)
79
810var (
11+ // cache's metrics
912 cacheOldest = promauto .NewGaugeVec (prometheus.GaugeOpts {
1013 Namespace : "seq_db_store" ,
1114 Subsystem : "cache" ,
3134 Subsystem : "cache" ,
3235 Name : "change_generations" ,
3336 }, []string {"cleaner" })
34-
3537 cacheSizeReleased = promauto .NewCounterVec (prometheus.CounterOpts {
3638 Namespace : "seq_db_store" ,
3739 Subsystem : "cache" ,
@@ -88,10 +90,94 @@ var (
8890 Name : "miss_latency_sec" ,
8991 }, []string {"layer" })
9092
93+ // fetcher's metrics
94+ fetcherStagesSeconds = promauto .NewHistogramVec (prometheus.HistogramOpts {
95+ Namespace : "seq_db_store" ,
96+ Subsystem : "fetcher" ,
97+ Name : "stages_seconds" ,
98+ Buckets : metric .SecondsBuckets ,
99+ }, []string {"stage" })
100+ fetcherIDsPerFraction = promauto .NewSummary (prometheus.SummaryOpts {
101+ Namespace : "seq_db_store" ,
102+ Subsystem : "fetcher" ,
103+ Name : "ids_per_fraction" ,
104+ })
105+ fetcherWithHints = promauto .NewCounter (prometheus.CounterOpts {
106+ Namespace : "seq_db_store" ,
107+ Subsystem : "fetcher" ,
108+ Name : "requests_with_hints" ,
109+ })
110+ fetcherWithoutHint = promauto .NewCounter (prometheus.CounterOpts {
111+ Namespace : "seq_db_store" ,
112+ Subsystem : "fetcher" ,
113+ Name : "requests_without_hints" ,
114+ })
115+ fetcherHintMisses = promauto .NewCounter (prometheus.CounterOpts {
116+ Namespace : "seq_db_store" ,
117+ Subsystem : "fetcher" ,
118+ Name : "hint_misses" ,
119+ })
120+
121+ // searchers's metrics
122+ searchSubSearches = promauto .NewHistogram (prometheus.HistogramOpts {
123+ Namespace : "seq_db_store" ,
124+ Subsystem : "search" ,
125+ Name : "sub_searches" ,
126+ Buckets : []float64 {0.99 , 1 , 1.01 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 },
127+ })
128+
129+ // fraction lifecycle metrics
130+ sealsTotal = promauto .NewCounter (prometheus.CounterOpts {
131+ Namespace : "seq_db" ,
132+ Subsystem : "main" ,
133+ Name : "seals_total" ,
134+ })
135+ sealsDoneSeconds = promauto .NewSummary (prometheus.SummaryOpts {
136+ Namespace : "seq_db" ,
137+ Subsystem : "main" ,
138+ Name : "seals_done_seconds" ,
139+ })
140+ maintenanceTruncateTotal = promauto .NewCounter (prometheus.CounterOpts {
141+ Namespace : "seq_db_store" ,
142+ Subsystem : "maintenance" ,
143+ Name : "truncate_total" ,
144+ Help : "" ,
145+ })
146+ offloadingTotal = promauto .NewCounterVec (prometheus.CounterOpts {
147+ Namespace : "seq_db_store" ,
148+ Subsystem : "offloading" ,
149+ Name : "total" ,
150+ Help : "How many fractions were offloaded" ,
151+ }, []string {"status" })
152+ offloadingDurationSeconds = promauto .NewHistogram (prometheus.HistogramOpts {
153+ Namespace : "seq_db_store" ,
154+ Subsystem : "offloading" ,
155+ Name : "duration_seconds" ,
156+ Help : "How many seconds it took to offload fraction to remote storage" ,
157+ Buckets : metric .SecondsBuckets ,
158+ })
159+ dataSizeTotal = promauto .NewGaugeVec (prometheus.GaugeOpts {
160+ Namespace : "seq_db_store" ,
161+ Subsystem : "common" ,
162+ Name : "data_size_total" ,
163+ }, []string {"kind" , "storage_type" })
164+ oldestFracTime = promauto .NewGaugeVec (prometheus.GaugeOpts {
165+ Namespace : "seq_db_store" ,
166+ Subsystem : "common" ,
167+ Name : "oldest_frac_time" ,
168+ Help : "" ,
169+ }, []string {"storage_type" })
91170 fractionLoadErrors = promauto .NewCounter (prometheus.CounterOpts {
92171 Namespace : "seq_db_store" ,
93172 Subsystem : "main" ,
94173 Name : "fraction_load_errors" ,
95174 Help : "Doc file load errors (missing or invalid doc file)" ,
96175 })
176+
177+ // disk load metric
178+ storeBytesRead = promauto .NewCounter (prometheus.CounterOpts {
179+ Namespace : "seq_db_store" ,
180+ Subsystem : "common" ,
181+ Name : "bytes_read" ,
182+ })
97183)
0 commit comments