@@ -47,6 +47,181 @@ var (
4747 metric .WithUnit ("{count}" ),
4848 )),
4949 }
50+
51+ // PebbleDB State Store Metrics
52+ PebbleDBMetrics = struct {
53+ // Operation Latencies
54+ GetLatency metric.Int64Histogram
55+ ApplyChangesetLatency metric.Int64Histogram
56+ ApplyChangesetAsyncLatency metric.Int64Histogram
57+ PruneLatency metric.Float64Histogram
58+ ImportLatency metric.Float64Histogram
59+ HashComputationLatency metric.Int64Histogram
60+ BatchWriteLatency metric.Int64Histogram
61+
62+ // Database Internal Metrics
63+ CompactionCount metric.Int64Counter
64+ CompactionDuration metric.Float64Histogram
65+ CompactionBytesRead metric.Int64Counter
66+ CompactionBytesWritten metric.Int64Counter
67+ FlushCount metric.Int64Counter
68+ FlushDuration metric.Float64Histogram
69+ FlushBytesWritten metric.Int64Counter
70+
71+ // Storage Metrics
72+ SSTableCount metric.Int64Gauge
73+ SSTableTotalSize metric.Int64Gauge
74+ MemtableCount metric.Int64Gauge
75+ MemtableTotalSize metric.Int64Gauge
76+ WALSize metric.Int64Gauge
77+
78+ // Cache Metrics
79+ CacheHits metric.Int64Counter
80+ CacheMisses metric.Int64Counter
81+ CacheSize metric.Int64Gauge
82+
83+ // Operational Metrics
84+ BatchSize metric.Int64Histogram
85+ PendingChangesQueueDepth metric.Int64Gauge
86+ IteratorCount metric.Int64Gauge
87+ }{
88+ // Operation Latencies
89+ GetLatency : must (meter .Int64Histogram (
90+ "pebble_get_latency" ,
91+ metric .WithDescription ("Time taken to get a key from PebbleDB" ),
92+ metric .WithUnit ("us" ),
93+ )),
94+ ApplyChangesetLatency : must (meter .Int64Histogram (
95+ "pebble_apply_changeset_latency" ,
96+ metric .WithDescription ("Time taken to apply changeset to PebbleDB" ),
97+ metric .WithUnit ("ms" ),
98+ )),
99+ ApplyChangesetAsyncLatency : must (meter .Int64Histogram (
100+ "pebble_apply_changeset_async_latency" ,
101+ metric .WithDescription ("Time taken to queue changeset for async write" ),
102+ metric .WithUnit ("us" ),
103+ )),
104+ PruneLatency : must (meter .Float64Histogram (
105+ "pebble_prune_latency" ,
106+ metric .WithDescription ("Time taken to prune old versions from PebbleDB" ),
107+ metric .WithUnit ("s" ),
108+ )),
109+ ImportLatency : must (meter .Float64Histogram (
110+ "pebble_import_latency" ,
111+ metric .WithDescription ("Time taken to import snapshot data to PebbleDB" ),
112+ metric .WithUnit ("s" ),
113+ )),
114+ HashComputationLatency : must (meter .Int64Histogram (
115+ "pebble_hash_computation_latency" ,
116+ metric .WithDescription ("Time taken to compute hash for a block range" ),
117+ metric .WithUnit ("ms" ),
118+ )),
119+ BatchWriteLatency : must (meter .Int64Histogram (
120+ "pebble_batch_write_latency" ,
121+ metric .WithDescription ("Time taken to write a batch to PebbleDB" ),
122+ metric .WithUnit ("ms" ),
123+ )),
124+
125+ // Compaction Metrics
126+ CompactionCount : must (meter .Int64Counter (
127+ "pebble_compaction_count" ,
128+ metric .WithDescription ("Total number of compactions" ),
129+ metric .WithUnit ("{count}" ),
130+ )),
131+ CompactionDuration : must (meter .Float64Histogram (
132+ "pebble_compaction_duration" ,
133+ metric .WithDescription ("Duration of compaction operations" ),
134+ metric .WithUnit ("s" ),
135+ )),
136+ CompactionBytesRead : must (meter .Int64Counter (
137+ "pebble_compaction_bytes_read" ,
138+ metric .WithDescription ("Total bytes read during compaction" ),
139+ metric .WithUnit ("By" ),
140+ )),
141+ CompactionBytesWritten : must (meter .Int64Counter (
142+ "pebble_compaction_bytes_written" ,
143+ metric .WithDescription ("Total bytes written during compaction" ),
144+ metric .WithUnit ("By" ),
145+ )),
146+
147+ // Flush Metrics
148+ FlushCount : must (meter .Int64Counter (
149+ "pebble_flush_count" ,
150+ metric .WithDescription ("Total number of memtable flushes" ),
151+ metric .WithUnit ("{count}" ),
152+ )),
153+ FlushDuration : must (meter .Float64Histogram (
154+ "pebble_flush_duration" ,
155+ metric .WithDescription ("Duration of memtable flush operations" ),
156+ metric .WithUnit ("s" ),
157+ )),
158+ FlushBytesWritten : must (meter .Int64Counter (
159+ "pebble_flush_bytes_written" ,
160+ metric .WithDescription ("Total bytes written during memtable flushes" ),
161+ metric .WithUnit ("By" ),
162+ )),
163+
164+ // Storage Metrics
165+ SSTableCount : must (meter .Int64Gauge (
166+ "pebble_sstable_count" ,
167+ metric .WithDescription ("Current number of SSTables" ),
168+ metric .WithUnit ("{count}" ),
169+ )),
170+ SSTableTotalSize : must (meter .Int64Gauge (
171+ "pebble_sstable_total_size" ,
172+ metric .WithDescription ("Total size of all SSTables" ),
173+ metric .WithUnit ("By" ),
174+ )),
175+ MemtableCount : must (meter .Int64Gauge (
176+ "pebble_memtable_count" ,
177+ metric .WithDescription ("Current number of memtables" ),
178+ metric .WithUnit ("{count}" ),
179+ )),
180+ MemtableTotalSize : must (meter .Int64Gauge (
181+ "pebble_memtable_total_size" ,
182+ metric .WithDescription ("Total size of all memtables" ),
183+ metric .WithUnit ("By" ),
184+ )),
185+ WALSize : must (meter .Int64Gauge (
186+ "pebble_wal_size" ,
187+ metric .WithDescription ("Current size of Write-Ahead Log" ),
188+ metric .WithUnit ("By" ),
189+ )),
190+
191+ // Cache Metrics
192+ CacheHits : must (meter .Int64Counter (
193+ "pebble_cache_hits" ,
194+ metric .WithDescription ("Total number of cache hits" ),
195+ metric .WithUnit ("{count}" ),
196+ )),
197+ CacheMisses : must (meter .Int64Counter (
198+ "pebble_cache_misses" ,
199+ metric .WithDescription ("Total number of cache misses" ),
200+ metric .WithUnit ("{count}" ),
201+ )),
202+ CacheSize : must (meter .Int64Gauge (
203+ "pebble_cache_size" ,
204+ metric .WithDescription ("Current cache size" ),
205+ metric .WithUnit ("By" ),
206+ )),
207+
208+ // Operational Metrics
209+ BatchSize : must (meter .Int64Histogram (
210+ "pebble_batch_size" ,
211+ metric .WithDescription ("Size of batches written to PebbleDB" ),
212+ metric .WithUnit ("By" ),
213+ )),
214+ PendingChangesQueueDepth : must (meter .Int64Gauge (
215+ "pebble_pending_changes_queue_depth" ,
216+ metric .WithDescription ("Number of pending changesets in async write queue" ),
217+ metric .WithUnit ("{count}" ),
218+ )),
219+ IteratorCount : must (meter .Int64Gauge (
220+ "pebble_iterator_count" ,
221+ metric .WithDescription ("Current number of active iterators" ),
222+ metric .WithUnit ("{count}" ),
223+ )),
224+ }
50225)
51226
52227// must panics if err is non-nil, otherwise returns v.
0 commit comments