From ac94e814236e938e57cde52895ff2d6ed70aefe5 Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Fri, 17 Jan 2025 09:32:22 -0600 Subject: [PATCH] Explore metrics: Update copy for missing metrics message when OTel is on (#99056) * Update copy for missing metrics when OTel is on * update message * Add OTel message in no metrics found message, not the warning banner * Otel > OTel --- .../trails/MetricSelect/MetricSelectScene.tsx | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/public/app/features/trails/MetricSelect/MetricSelectScene.tsx b/public/app/features/trails/MetricSelect/MetricSelectScene.tsx index 62603ef1879..c16ef0e1b7c 100644 --- a/public/app/features/trails/MetricSelect/MetricSelectScene.tsx +++ b/public/app/features/trails/MetricSelect/MetricSelectScene.tsx @@ -69,6 +69,7 @@ export interface MetricSelectSceneState extends SceneObjectState { metricNamesLoading?: boolean; metricNamesError?: string; metricNamesWarning?: string; + missingOtelTargets?: boolean; } const ROW_PREVIEW_HEIGHT = '175px'; @@ -290,10 +291,6 @@ export class MetricSelectScene extends SceneObjectBase i metricNamesWarning = undefined; } - if (response.missingOtelTargets) { - metricNamesWarning = `${metricNamesWarning ?? ''} The list of metrics is not complete. Select more OTel resource attributes to see a full list of metrics.`; - } - let bodyLayout = this.state.body; // generate groups based on the search metrics input @@ -306,6 +303,7 @@ export class MetricSelectScene extends SceneObjectBase i metricNamesLoading: false, metricNamesWarning, metricNamesError: response.error, + missingOtelTargets: response.missingOtelTargets, }); } catch (err: unknown) { let error = 'Unknown error'; @@ -504,8 +502,16 @@ export class MetricSelectScene extends SceneObjectBase i }; public static Component = ({ model }: SceneComponentProps) => { - const { body, metricNames, metricNamesError, metricNamesLoading, metricNamesWarning, rootGroup, metricPrefix } = - model.useState(); + const { + body, + metricNames, + metricNamesError, + metricNamesLoading, + metricNamesWarning, + rootGroup, + metricPrefix, + missingOtelTargets, + } = model.useState(); const { children } = body.useState(); const trail = getTrailFor(model); const styles = useStyles2(getStyles); @@ -521,9 +527,11 @@ export class MetricSelectScene extends SceneObjectBase i const blockingMessage = isLoading ? undefined - : (noMetrics && 'There are no results found. Try a different time range or a different data source.') || - (tooStrict && 'There are no results found. Try adjusting your search or filters.') || - undefined; + : missingOtelTargets + ? 'There are no metrics found. Please adjust your filters based on your OTel resource attributes.' + : (noMetrics && 'There are no results found. Try a different time range or a different data source.') || + (tooStrict && 'There are no results found. Try adjusting your search or filters.') || + undefined; const metricNamesWarningIcon = metricNamesWarning ? ( i