// Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/configuration/ExemplarSetting.tsx import { useState } from 'react'; import { DataSourceInstanceSettings } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { config, DataSourcePicker } from '@grafana/runtime'; import { Button, InlineField, Input, Switch, useTheme2 } from '@grafana/ui'; import { ExemplarTraceIdDestination } from '../types'; import { docsTip, overhaulStyles, PROM_CONFIG_LABEL_WIDTH } from './ConfigEditor'; type Props = { value: ExemplarTraceIdDestination; onChange: (value: ExemplarTraceIdDestination) => void; onDelete: () => void; disabled?: boolean; }; export function ExemplarSetting({ value, onChange, onDelete, disabled }: Props) { const [isInternalLink, setIsInternalLink] = useState(Boolean(value.datasourceUid)); const theme = useTheme2(); const styles = overhaulStyles(theme); return (
Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. {docsTip()} } interactive={true} className={styles.switchField} > <> setIsInternalLink(ev.currentTarget.checked)} /> {isInternalLink ? ( The data source the exemplar is going to navigate to. {docsTip()}} disabled={disabled} interactive={true} > ds.type !== 'grafana-azure-monitor-datasource' } tracing={true} current={value.datasourceUid} noDefault={true} width={40} onChange={(ds: DataSourceInstanceSettings) => onChange({ ...value, datasourceUid: ds.uid, url: undefined, }) } /> ) : ( The URL of the trace backend the user would go to see its trace. {docsTip()}} disabled={disabled} interactive={true} > onChange({ ...value, datasourceUid: undefined, url: event.currentTarget.value, }) } /> )} Use to override the button label on the exemplar traceID field. {docsTip()}} disabled={disabled} interactive={true} > onChange({ ...value, urlDisplayLabel: event.currentTarget.value, }) } /> The name of the field in the labels object that should be used to get the traceID. {docsTip()}} disabled={disabled} interactive={true} > onChange({ ...value, name: event.currentTarget.value, }) } /> {!disabled && (
); }