From 68383b1035f64bb4289fd1543ee39b01fae3365e Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Thu, 13 Jul 2023 16:54:41 +0200 Subject: [PATCH] Limits to required labels when querying for App (https://github.com/grafana/phlare/issues/856) * Limits to required labels when querying for App * yarn format * Add back missing labels * support old version --- public/app/overrides/services/apps.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/public/app/overrides/services/apps.ts b/public/app/overrides/services/apps.ts index 4e6cc2d106..aeac3b72e1 100644 --- a/public/app/overrides/services/apps.ts +++ b/public/app/overrides/services/apps.ts @@ -80,11 +80,17 @@ function removeDuplicateApps(app: App[]) { export async function fetchApps(): Promise< Result > { - // 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', @@ -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(response.error); }