Skip to content

Commit 74f6703

Browse files
remove provider label from metrics, add metrics for bytes scanned
1 parent 6f0c689 commit 74f6703

File tree

5 files changed

+137
-305
lines changed

5 files changed

+137
-305
lines changed

src/metrics/mod.rs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub static TOTAL_OBJECT_STORE_CALLS_BY_DATE: Lazy<IntCounterVec> = Lazy::new(||
279279
"Total object store calls by date",
280280
)
281281
.namespace(METRICS_NAMESPACE),
282-
&["provider", "method", "date"],
282+
&["method", "date"],
283283
)
284284
.expect("metric can be created")
285285
});
@@ -292,7 +292,20 @@ pub static TOTAL_FILES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE: Lazy<IntCounterVec
292292
"Total files scanned in object store calls by date",
293293
)
294294
.namespace(METRICS_NAMESPACE),
295-
&["provider", "method", "date"],
295+
&["method", "date"],
296+
)
297+
.expect("metric can be created")
298+
});
299+
300+
pub static TOTAL_BYTES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE: Lazy<IntCounterVec> =
301+
Lazy::new(|| {
302+
IntCounterVec::new(
303+
Opts::new(
304+
"total_bytes_scanned_in_object_store_calls_by_date",
305+
"Total bytes scanned in object store calls by date",
306+
)
307+
.namespace(METRICS_NAMESPACE),
308+
&["method", "date"],
296309
)
297310
.expect("metric can be created")
298311
});
@@ -304,7 +317,7 @@ pub static TOTAL_INPUT_LLM_TOKENS_BY_DATE: Lazy<IntCounterVec> = Lazy::new(|| {
304317
"Total input LLM tokens used by date",
305318
)
306319
.namespace(METRICS_NAMESPACE),
307-
&["provider", "model", "date"],
320+
&["model", "date"],
308321
)
309322
.expect("metric can be created")
310323
});
@@ -409,6 +422,11 @@ fn custom_metrics(registry: &Registry) {
409422
TOTAL_FILES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE.clone(),
410423
))
411424
.expect("metric can be registered");
425+
registry
426+
.register(Box::new(
427+
TOTAL_BYTES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE.clone(),
428+
))
429+
.expect("metric can be registered");
412430
registry
413431
.register(Box::new(TOTAL_INPUT_LLM_TOKENS_BY_DATE.clone()))
414432
.expect("metric can be registered");
@@ -518,23 +536,24 @@ pub fn increment_bytes_scanned_in_query_by_date(bytes: u64, date: &str) {
518536
.inc_by(bytes);
519537
}
520538

521-
pub fn increment_object_store_calls_by_date(provider: &str, method: &str, date: &str) {
539+
pub fn increment_object_store_calls_by_date(method: &str, date: &str) {
522540
TOTAL_OBJECT_STORE_CALLS_BY_DATE
523-
.with_label_values(&[provider, method, date])
541+
.with_label_values(&[method, date])
524542
.inc();
525543
}
526544

527-
pub fn increment_files_scanned_in_object_store_calls_by_date(
528-
provider: &str,
529-
method: &str,
530-
count: u64,
531-
date: &str,
532-
) {
545+
pub fn increment_files_scanned_in_object_store_calls_by_date(method: &str, count: u64, date: &str) {
533546
TOTAL_FILES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE
534-
.with_label_values(&[provider, method, date])
547+
.with_label_values(&[method, date])
535548
.inc_by(count);
536549
}
537550

551+
pub fn increment_bytes_scanned_in_object_store_calls_by_date(method: &str, bytes: u64, date: &str) {
552+
TOTAL_BYTES_SCANNED_IN_OBJECT_STORE_CALLS_BY_DATE
553+
.with_label_values(&[method, date])
554+
.inc_by(bytes);
555+
}
556+
538557
pub fn increment_input_llm_tokens_by_date(provider: &str, model: &str, tokens: u64, date: &str) {
539558
TOTAL_INPUT_LLM_TOKENS_BY_DATE
540559
.with_label_values(&[provider, model, date])

0 commit comments

Comments
 (0)