Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Limits to required labels when querying for App #856

Merged
merged 4 commits into from
Jul 13, 2023
Merged
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
24 changes: 22 additions & 2 deletions public/app/overrides/services/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ function removeDuplicateApps(app: App[]) {
export async function fetchApps(): Promise<
Result<App[], RequestError | ZodError>
> {
// TODO: is this the best query?
const response = await requestWithOrgID('/querier.v1.QuerierService/Series', {
let response = await requestWithOrgID('/querier.v1.QuerierService/Series', {
method: 'POST',
body: JSON.stringify({
matchers: [],
labelNames: [
PyroscopeAppLabel,
ServiceNameLabel,
'__profile_type__',
'__type__',
'__name__',
],
}),
headers: {
'content-type': 'application/json',
Expand All @@ -95,5 +101,19 @@ export async function fetchApps(): Promise<
return parseResponse(response, ListOfAppsSchema);
}

// try without labelNames in case of an error since this has been added in a later version
response = await requestWithOrgID('/querier.v1.QuerierService/Series', {
method: 'POST',
body: JSON.stringify({
matchers: [],
}),
headers: {
'content-type': 'application/json',
},
});
if (response.isOk) {
return parseResponse(response, ListOfAppsSchema);
}

return Result.err<App[], RequestError>(response.error);
}
Loading