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
This commit is contained in:
Brendan O'Handley 2025-01-17 09:32:22 -06:00 committed by GitHub
parent 7ccc811203
commit ac94e81423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<MetricSelectSceneState> 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<MetricSelectSceneState> 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<MetricSelectSceneState> i
};
public static Component = ({ model }: SceneComponentProps<MetricSelectScene>) => {
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<MetricSelectSceneState> 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 ? (
<Tooltip
@ -610,7 +618,7 @@ export class MetricSelectScene extends SceneObjectBase<MetricSelectSceneState> i
<InlineSwitch
disabled={!isStandardOtel}
showLabel={true}
label="Otel experience"
label="OTel experience"
value={useOtelExperience}
onChange={model.onToggleOtelExperience}
/>