Hi. Thank for Prometheus exporter and your job. This is only one solution for scrapping metrics with prometheus.
I encountered an error. When I started tests with custom tags in scenario for grpc service I receive error Not all tags used as labels from line https://github.com/szkiba/xk6-prometheus/blob/master/internal/prometheus.go#L114
I did't see scenario tag or another tag which I add in scenario script.
grpc test scenario.
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
export const options = {
scenarios: {
shared_iter_scenario: {
executor: 'shared-iterations',
vus: 10,
iterations: 10000,
startTime: '0s',
tags: {
testid: 'someTestId-for-shared',
},
},
per_vu_scenario: {
executor: 'per-vu-iterations',
vus: 10,
iterations: 1000,
startTime: '5s',
tags: {
testid: 'someTestId-for-per-vu',
},
},
},
};
const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
export default function () {
client.connect('grpcb.in:9001', {
// plaintext: false
});
const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
console.log(JSON.stringify(response.message));
client.close();
sleep(1);
};
http test scenario.
import http from 'k6/http';
export const options = {
scenarios: {
shared_iter_scenario: {
executor: 'shared-iterations',
vus: 10,
iterations: 10000,
startTime: '0s',
tags: {
testid: 'someTestId-for-shared',
},
},
per_vu_scenario: {
executor: 'per-vu-iterations',
vus: 10,
iterations: 1000,
startTime: '5s',
tags: {
testid: 'someTestId-for-per-vu',
},
},
},
};
export default function () {
http.get('https://test.k6.io/');
}
I'm getting this error only when start test for grpc service. When I start test for http protocol it's work as expected - all tags is setted.
http
k6_data_received{instance="k6-test-runner:5656", job="k6_job", scenario="per_vu_scenario", testid="someTestId-for-per-vu"} | 16995 @1685451227.496
-- | --
k6_data_received{instance="k6-test-runner:5656", job="k6_job", scenario="shared_iter_scenario", testid="someTestId-for-shared"} | 261966 @1685451227.496
k6_data_sent{instance="k6-test-runner:5656", job="k6_job", scenario="per_vu_scenario", testid="someTestId-for-per-vu"} | 438 @1685451227.496
k6_data_sent{instance="k6-test-runner:5656", job="k6_job", scenario="shared_iter_scenario", testid="someTestId-for-shared"}
grpc
k6_checks_sum{check="server is healthy", group="::setup", instance="k6-test-runner:5656", job="k6_job"} | 1 @1685453357.4961 @1685453362.4961 @1685453367.496
-- | --
k6_checks_sum{check="status is OK", instance="k6-test-runner:5656", job="k6_job"} | 4 @1685453362.4968 @1685453367.496
k6_data_received{group="::setup", instance="k6-test-runner:5656", job="k6_job"} | 213489 @1685453357.496213489 @1685453362.496213489 @1685453367.496
k6_data_received{instance="k6-test-runner:5656", job="k6_job"} | 10579 @1685453362.49621035 @1685453367.496
k6_data_sent{group="::setup", instance="k6-test-runner:5656", job="k6_job"} | 441 @1685453357.496441 @1685453362.496441 @1685453367.496
k6_data_sent{instance="k6-test-runner:5656", job="k6_job"}
I notice two things
- Only iteration metrics have tags as label when I start test for grpc.
k6_iterations{instance="k6-test-runner:5656", job="k6_job", scenario="searchFast", testid="searchScenarios--002"}
- Custom tags work is good.
k6_errors_response_not_ok_sum{instance="k6-test-runner:5656", job="k6_job", scenario="searchFast", testid="searchScenarios--002"}
Below is screen from prometheus for same metrics for http and grpc.

Hi. Thank for Prometheus exporter and your job. This is only one solution for scrapping metrics with prometheus.
I encountered an error. When I started tests with custom tags in scenario for grpc service I receive error Not all tags used as labels from line https://github.com/szkiba/xk6-prometheus/blob/master/internal/prometheus.go#L114
I did't see scenario tag or another tag which I add in scenario script.
grpc test scenario.
http test scenario.
I'm getting this error only when start test for grpc service. When I start test for http protocol it's work as expected - all tags is setted.
http
grpc
I notice two things
Below is screen from prometheus for same metrics for http and grpc.
