mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Unified observability] Track disabled features when loading overview page (#130230)
This commit is contained in:
parent
37ebf93c02
commit
6dbe26f2f7
1 changed files with 25 additions and 3 deletions
|
@ -19,7 +19,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import React, { useMemo, useRef, useCallback, useState } from 'react';
|
||||
import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react';
|
||||
import { observabilityFeatureId } from '../../../common';
|
||||
import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
|
||||
import { useTrackPageview, useUiTracker } from '../..';
|
||||
|
@ -52,6 +52,9 @@ interface Props {
|
|||
routeParams: RouteParams<'/overview'>;
|
||||
}
|
||||
export type BucketSize = ReturnType<typeof calculateBucketSize>;
|
||||
|
||||
const CAPABILITIES_KEYS = ['logs', 'infrastructure', 'apm', 'uptime'];
|
||||
|
||||
function calculateBucketSize({ start, end }: { start?: number; end?: number }) {
|
||||
if (start && end) {
|
||||
return getBucketSize({ start, end, minInterval: '60s' });
|
||||
|
@ -72,9 +75,14 @@ export function OverviewPage({ routeParams }: Props) {
|
|||
const [isFlyoutVisible, setIsFlyoutVisible] = useState(false);
|
||||
|
||||
const indexNames = useAlertIndexNames();
|
||||
const { cases, docLinks, http } = useKibana<ObservabilityAppServices>().services;
|
||||
const { ObservabilityPageTemplate, config } = usePluginContext();
|
||||
const {
|
||||
cases,
|
||||
docLinks,
|
||||
http,
|
||||
application: { capabilities },
|
||||
} = useKibana<ObservabilityAppServices>().services;
|
||||
|
||||
const { ObservabilityPageTemplate, config } = usePluginContext();
|
||||
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useDatePickerContext();
|
||||
|
||||
const { data: newsFeed } = useFetcher(() => getNewsFeed({ http }), [http]);
|
||||
|
@ -112,6 +120,20 @@ export function OverviewPage({ routeParams }: Props) {
|
|||
const CasesContext = cases.ui.getCasesContext();
|
||||
const userPermissions = useGetUserCasesPermissions();
|
||||
|
||||
useEffect(() => {
|
||||
if (hasAnyData !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
CAPABILITIES_KEYS.forEach((feature) => {
|
||||
if (capabilities[feature].show === false) {
|
||||
trackMetric({
|
||||
metric: `oblt_disabled_feature_${feature === 'infrastructure' ? 'metrics' : feature}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [capabilities, hasAnyData, trackMetric]);
|
||||
|
||||
if (hasAnyData === undefined) {
|
||||
return <LoadingObservability />;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue