Skip to content

Instantly share code, notes, and snippets.

@ngotzmann
Created September 13, 2025 12:23
Show Gist options
  • Select an option

  • Save ngotzmann/2f1368e63dfd7129a76ef13bd3051a24 to your computer and use it in GitHub Desktop.

Select an option

Save ngotzmann/2f1368e63dfd7129a76ef13bd3051a24 to your computer and use it in GitHub Desktop.
function sendDummyMetric(config: any) {
const otelRequest = {
resource_metrics: [
{
resource: {
attributes: [
{ key: 'service.name', value: { string_value: 'k6-otlp-test' } },
],
},
scope_metrics: [
{
scope: { name: 'k6' },
metrics: [
{
name: 'k6_dummy_metric',
description: 'a test metric sent by k6 test',
unit: '1',
gauge: {
data_points: [
{
attributes: [{ key: 'env', value: { string_value: 'k6-dev' } }],
as_double: 42.0
}
],
},
},
],
},
],
},
],
};
const headers = { headers: { 'Content-Type': 'application/json' } };
const res = http.post(config.group_vars.otel_url, JSON.stringify(otelRequest), headers);
expect(res.status).to.be.equal(200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment