Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: limit the number of buckets for prom metrics #114

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions load_tests/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {check} from 'k6';
import http from 'k6/http';
import {Trend} from 'k6/metrics';

const host = __ENV.HOST || '127.0.0.1:3000';
const host = __ENV.HOST || '127.0.0.1:8080';

const totalTime = new Trend('total_time', true);
const tokenizationTIme = new Trend('tokenization_time', true);
Expand Down Expand Up @@ -41,7 +41,7 @@ export default function () {
});

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

Expand Down
2 changes: 1 addition & 1 deletion load_tests/load_grpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {check} from 'k6';
import grpc from 'k6/experimental/grpc';
import {Trend} from 'k6/metrics';

const host = __ENV.HOST || '127.0.0.1:3000';
const host = __ENV.HOST || '127.0.0.1:8080';

const totalTime = new Trend('total_time', true);
const tokenizationTIme = new Trend('tokenization_time', true);
Expand Down
2 changes: 1 addition & 1 deletion load_tests/load_grpc_stream.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import grpc from 'k6/experimental/grpc';
import {Counter, Trend} from 'k6/metrics';

const host = __ENV.HOST || '127.0.0.1:3000';
const host = __ENV.HOST || '127.0.0.1:8080';

const streamCounter = new Counter('stream_counter');
const totalTime = new Trend('total_time', true);
Expand Down
9 changes: 5 additions & 4 deletions router/src/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ pub(crate) fn prometheus_builer(max_input_length: usize) -> Result<PrometheusBui

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

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

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

// Prometheus handler
PrometheusBuilder::new()
Expand Down