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

feat: Optional include label value cardinality in /LabelNames #3563

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 100 additions & 75 deletions api/gen/proto/go/types/v1/types.pb.go

Large diffs are not rendered by default.

159 changes: 159 additions & 0 deletions api/gen/proto/go/types/v1/types_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api/openapiv2/gen/phlare.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,13 @@
"items": {
"type": "string"
}
},
"estimatedCardinality": {
"type": "array",
"items": {
"type": "string",
"format": "int64"
}
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions api/types/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ message LabelNamesRequest {
repeated string matchers = 1;
int64 start = 2;
int64 end = 3;
optional bool include_cardinality = 4;
}

message LabelNamesResponse {
repeated string names = 1;
repeated int64 estimated_cardinality = 2;
}

message BlockInfo {
Expand Down
57 changes: 57 additions & 0 deletions load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import http from 'k6/http';
import { check } from 'k6';

export let options = {
vus: 5,
duration: '10m',
};

export default function () {
// 24h query
const start = 1726473370933;
const end = 1726617370933;

const response = labelNamesRequest({
matchers: ["{service_name=\"fire-dev-001/querier\"}"],
start: start,
end: end
});

const names = response.json('names');
check(response, {
'Label names response is 200': (r) => r.status === 200,
'Label names response has data': (r) => names.length > 0,
});

for (let name of names) {
const response = labelValuesRequest({
matchers: [`{service_name=\"fire-dev-001/querier\", metric_name=\"${name}\"}`],
start: start,
end: end
});

const values = response.json('names');
check(response, {
'Label values response is 200': (r) => r.status === 200,
'Label values response has data': () => values !== undefined && values.length > 0,
});
}
}

function labelNamesRequest(body) {
return http.post('http://localhost:4100/querier.v1.QuerierService/LabelNames', JSON.stringify(body), {
headers: {
'Content-Type': 'application/json',
'X-Scope-OrgID': '1218'
},
});
}

function labelValuesRequest(body) {
return http.post('http://localhost:4100/querier.v1.QuerierService/LabelValues', JSON.stringify(body), {
headers: {
'Content-Type': 'application/json',
'X-Scope-OrgID': '1218'
},
});
}
Loading