Skip to content

Commit 8c43390

Browse files
fix: limit the number of buckets for prom metrics (#114)
1 parent 5218224 commit 8c43390

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

load_tests/load.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {check} from 'k6';
22
import http from 'k6/http';
33
import {Trend} from 'k6/metrics';
44

5-
const host = __ENV.HOST || '127.0.0.1:3000';
5+
const host = __ENV.HOST || '127.0.0.1:8080';
66

77
const totalTime = new Trend('total_time', true);
88
const tokenizationTIme = new Trend('tokenization_time', true);
@@ -41,7 +41,7 @@ export default function () {
4141
});
4242

4343
const headers = {'Content-Type': 'application/json'};
44-
const res = http.post(`http://${host}`, payload, {
44+
const res = http.post(`http://${host}/predict`, payload, {
4545
headers, timeout: '20m'
4646
});
4747

load_tests/load_grpc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {check} from 'k6';
22
import grpc from 'k6/experimental/grpc';
33
import {Trend} from 'k6/metrics';
44

5-
const host = __ENV.HOST || '127.0.0.1:3000';
5+
const host = __ENV.HOST || '127.0.0.1:8080';
66

77
const totalTime = new Trend('total_time', true);
88
const tokenizationTIme = new Trend('tokenization_time', true);

load_tests/load_grpc_stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import grpc from 'k6/experimental/grpc';
22
import {Counter, Trend} from 'k6/metrics';
33

4-
const host = __ENV.HOST || '127.0.0.1:3000';
4+
const host = __ENV.HOST || '127.0.0.1:8080';
55

66
const streamCounter = new Counter('stream_counter');
77
const totalTime = new Trend('total_time', true);

router/src/prometheus.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ pub(crate) fn prometheus_builer(max_input_length: usize) -> Result<PrometheusBui
1515

1616
// Input Length buckets
1717
let input_length_matcher = Matcher::Full(String::from("te_request_input_length"));
18-
let input_length_buckets: Vec<f64> = (0..100)
19-
.map(|x| (max_input_length as f64 / 100.0) * (x + 1) as f64)
18+
let input_length_buckets: Vec<f64> = (0..20)
19+
.map(|x| 2.0_f64.powi(x))
20+
.filter(|x| (*x as usize) <= max_input_length)
2021
.collect();
2122

2223
// Batch size buckets
2324
let batch_size_matcher = Matcher::Full(String::from("te_batch_next_size"));
24-
let batch_size_buckets: Vec<f64> = (0..2048).map(|x| (x + 1) as f64).collect();
25+
let batch_size_buckets: Vec<f64> = (0..13).map(|x| 2.0_f64.powi(x)).collect();
2526

2627
// Batch tokens buckets
2728
let batch_tokens_matcher = Matcher::Full(String::from("te_batch_next_tokens"));
28-
let batch_tokens_buckets: Vec<f64> = (0..100_000).map(|x| (x + 1) as f64).collect();
29+
let batch_tokens_buckets: Vec<f64> = (0..21).map(|x| 2.0_f64.powi(x)).collect();
2930

3031
// Prometheus handler
3132
PrometheusBuilder::new()

0 commit comments

Comments
 (0)