mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tracing: add way to configure trace to logs start and end time (#34995)
* Tracing: add way to configure trace to logs start and end time * Use the span's time by default * Update docs * Update time inputs to use strings instead of number * Support negative values as well * Add info about using negative value * Don't round up Loki range * Update docs/sources/datasources/jaeger.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Wording for doc * Round adjusted start and end time Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,14 @@ import {
|
||||
updateDatasourcePluginJsonDataOption,
|
||||
} from '@grafana/data';
|
||||
import { DataSourcePicker } from '@grafana/runtime';
|
||||
import { InlineField, InlineFieldRow, TagsInput, useStyles } from '@grafana/ui';
|
||||
import { InlineField, InlineFieldRow, Input, TagsInput, useStyles } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
export interface TraceToLogsOptions {
|
||||
datasourceUid?: string;
|
||||
tags?: string[];
|
||||
spanStartTimeShift?: string;
|
||||
spanEndTimeShift?: string;
|
||||
}
|
||||
|
||||
export interface TraceToLogsData extends DataSourceJsonData {
|
||||
@@ -66,6 +68,50 @@ export function TraceToLogsSettings({ options, onOptionsChange }: Props) {
|
||||
/>
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
|
||||
<InlineFieldRow>
|
||||
<InlineField
|
||||
label="Span start time shift"
|
||||
labelWidth={26}
|
||||
grow
|
||||
tooltip="Shifts the start time of the span. Default 0 (Time units can be used here, for example: 5s, 1m, 3h)"
|
||||
>
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="1h"
|
||||
width={40}
|
||||
onChange={(v) =>
|
||||
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', {
|
||||
...options.jsonData.tracesToLogs,
|
||||
spanStartTimeShift: v.currentTarget.value,
|
||||
})
|
||||
}
|
||||
value={options.jsonData.tracesToLogs?.spanStartTimeShift || ''}
|
||||
/>
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
|
||||
<InlineFieldRow>
|
||||
<InlineField
|
||||
label="Span end time shift"
|
||||
labelWidth={26}
|
||||
grow
|
||||
tooltip="Shifts the end time of the span. Default 0 Time units can be used here, for example: 5s, 1m, 3h"
|
||||
>
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="1h"
|
||||
width={40}
|
||||
onChange={(v) =>
|
||||
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'tracesToLogs', {
|
||||
...options.jsonData.tracesToLogs,
|
||||
spanEndTimeShift: v.currentTarget.value,
|
||||
})
|
||||
}
|
||||
value={options.jsonData.tracesToLogs?.spanEndTimeShift || ''}
|
||||
/>
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user