import { css } from '@emotion/css';
import { useState, type Dispatch, type SetStateAction } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
import { useStyles2, useTheme2, Alert, Button } from '@grafana/ui';
import { t, Trans } from 'app/core/internationalization';
import { DataTrail } from '../DataTrail';
import { reportExploreMetrics } from '../interactions';
import { MetricSelectedEvent } from '../shared';
interface NativeHistogramInfoProps {
histogramsLoaded: boolean;
nativeHistograms: string[];
trail: DataTrail;
}
export function NativeHistogramBanner(props: NativeHistogramInfoProps) {
const { histogramsLoaded, nativeHistograms, trail } = props;
const [histogramMessage, setHistogramMessage] = useState(true);
const [showHistogramExamples, setShowHistogramExamples] = useState(false);
const styles = useStyles2(getStyles, 0);
if (bannerHasBeenShown() || !histogramsLoaded || nativeHistograms.length === 0 || !histogramMessage) {
return null;
}
return (
<>
{
{
// when a user explicitly closes the banner, save that it has been closed in local storage to not show again
setBannerHasBeenShown();
setHistogramMessage(false);
}}
className={styles.banner}
>
Prometheus native histograms offer high resolution, high precision, simple usage in instrumentation and
a way to combine and manipulate histograms in queries and in Grafana.