|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
import { css } from '@emotion/css'; |
|
|
|
|
import { |
|
|
|
|
DataSourceJsonData, |
|
|
|
|
DataSourcePluginOptionsEditorProps, |
|
|
|
@ -5,8 +6,7 @@ import { |
|
|
|
|
updateDatasourcePluginJsonDataOption, |
|
|
|
|
} from '@grafana/data'; |
|
|
|
|
import { DataSourcePicker } from '@grafana/runtime'; |
|
|
|
|
import { InlineFormLabel, TagsInput, useStyles } from '@grafana/ui'; |
|
|
|
|
import { css } from '@emotion/css'; |
|
|
|
|
import { InlineField, InlineFieldRow, TagsInput, useStyles } from '@grafana/ui'; |
|
|
|
|
import React from 'react'; |
|
|
|
|
|
|
|
|
|
export interface TraceToLogsOptions { |
|
|
|
@ -24,43 +24,49 @@ export function TraceToLogsSettings({ options, onOptionsChange }: Props) { |
|
|
|
|
const styles = useStyles(getStyles); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<div className={css({ width: '100%' })}> |
|
|
|
|
<h3 className="page-heading">Trace to logs</h3> |
|
|
|
|
|
|
|
|
|
<div className={styles.infoText}> |
|
|
|
|
Trace to logs let's you navigate from a trace span to the selected data source's log. |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div className="gf-form"> |
|
|
|
|
<InlineFormLabel tooltip="The data source the trace is going to navigate to">Data source</InlineFormLabel> |
|
|
|
|
<DataSourcePicker |
|
|
|
|
pluginId="loki" |
|
|
|
|
current={options.jsonData.tracesToLogs?.datasourceUid} |
|
|
|
|
noDefault={true} |
|
|
|
|
onChange={(ds) => |
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', { |
|
|
|
|
datasourceUid: ds.uid, |
|
|
|
|
tags: options.jsonData.tracesToLogs?.tags, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<InlineFieldRow> |
|
|
|
|
<InlineField tooltip="The data source the trace is going to navigate to" label="Data source" labelWidth={26}> |
|
|
|
|
<DataSourcePicker |
|
|
|
|
pluginId="loki" |
|
|
|
|
current={options.jsonData.tracesToLogs?.datasourceUid} |
|
|
|
|
noDefault={true} |
|
|
|
|
width={40} |
|
|
|
|
onChange={(ds) => |
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', { |
|
|
|
|
datasourceUid: ds.uid, |
|
|
|
|
tags: options.jsonData.tracesToLogs?.tags, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</InlineField> |
|
|
|
|
</InlineFieldRow> |
|
|
|
|
|
|
|
|
|
<div className="gf-form"> |
|
|
|
|
<InlineFormLabel tooltip="Tags that will be used in the Loki query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'"> |
|
|
|
|
Tags |
|
|
|
|
</InlineFormLabel> |
|
|
|
|
<TagsInput |
|
|
|
|
tags={options.jsonData.tracesToLogs?.tags} |
|
|
|
|
onChange={(tags) => |
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', { |
|
|
|
|
datasourceUid: options.jsonData.tracesToLogs?.datasourceUid, |
|
|
|
|
tags: tags, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</> |
|
|
|
|
<InlineFieldRow> |
|
|
|
|
<InlineField |
|
|
|
|
tooltip="Tags that will be used in the Loki query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'" |
|
|
|
|
label="Tags" |
|
|
|
|
labelWidth={26} |
|
|
|
|
> |
|
|
|
|
<TagsInput |
|
|
|
|
tags={options.jsonData.tracesToLogs?.tags} |
|
|
|
|
width={40} |
|
|
|
|
onChange={(tags) => |
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', { |
|
|
|
|
datasourceUid: options.jsonData.tracesToLogs?.datasourceUid, |
|
|
|
|
tags: tags, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</InlineField> |
|
|
|
|
</InlineFieldRow> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|