mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Trace to logs: Add service name and namespace to default tags (#71776)
* Add service name and namespace to default trace to logs tags * Add deployment.environment. Update docs * Revert metrics query tags type
This commit is contained in:
parent
427714f8d0
commit
f3b6e7d7eb
@ -105,11 +105,11 @@ To use a variable you need to wrap it in `${}`. For example: `${__span.name}`.
|
|||||||
The following table describes the ways in which you can configure your trace to logs settings:
|
The following table describes the ways in which you can configure your trace to logs settings:
|
||||||
|
|
||||||
| Setting name | Description |
|
| Setting name | Description |
|
||||||
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
||||||
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
||||||
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
||||||
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`, `service.name`, `service.namespace`, `deployment.environment`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
||||||
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
||||||
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
||||||
| **Use custom query** | Toggles use of custom query with interpolation. |
|
| **Use custom query** | Toggles use of custom query with interpolation. |
|
||||||
|
@ -105,11 +105,11 @@ To use a variable you need to wrap it in `${}`. For example `${__span.name}`.
|
|||||||
The following table describes the ways in which you can configure your trace to logs settings:
|
The following table describes the ways in which you can configure your trace to logs settings:
|
||||||
|
|
||||||
| Setting name | Description |
|
| Setting name | Description |
|
||||||
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
||||||
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
||||||
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
||||||
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`, `service.name`, `service.namespace`, `deployment.environment`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
||||||
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
||||||
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
||||||
| **Use custom query** | Toggles use of custom query with interpolation. |
|
| **Use custom query** | Toggles use of custom query with interpolation. |
|
||||||
|
@ -103,11 +103,11 @@ To use a variable you need to wrap it in `${}`. For example `${__span.name}`.
|
|||||||
The following table describes the ways in which you can configure your trace to logs settings:
|
The following table describes the ways in which you can configure your trace to logs settings:
|
||||||
|
|
||||||
| Setting name | Description |
|
| Setting name | Description |
|
||||||
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
| **Data source** | Defines the target data source. You can select only Loki or Splunk \[logs\] data sources. |
|
||||||
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
| **Span start time shift** | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. |
|
||||||
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
| **Span end time shift** | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. |
|
||||||
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
| **Tags** | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`, `service.name`, `service.namespace`, `deployment.environment`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. |
|
||||||
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
| **Filter by trace ID** | Toggles whether to append the trace ID to the logs query. |
|
||||||
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
| **Filter by span ID** | Toggles whether to append the span ID to the logs query. |
|
||||||
| **Use custom query** | Toggles use of custom query with interpolation. |
|
| **Use custom query** | Toggles use of custom query with interpolation. |
|
||||||
|
@ -4,9 +4,11 @@ import React from 'react';
|
|||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { SegmentInput, useStyles2, InlineLabel, Icon } from '@grafana/ui';
|
import { SegmentInput, useStyles2, InlineLabel, Icon } from '@grafana/ui';
|
||||||
|
|
||||||
|
import { TraceToLogsTag } from './TraceToLogsSettings';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
values: Array<{ key: string; value?: string }>;
|
values: TraceToLogsTag[];
|
||||||
onChange: (values: Array<{ key: string; value?: string }>) => void;
|
onChange: (values: TraceToLogsTag[]) => void;
|
||||||
id?: string;
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,16 @@ import { IntervalInput } from '../IntervalInput/IntervalInput';
|
|||||||
|
|
||||||
import { TagMappingInput } from './TagMappingInput';
|
import { TagMappingInput } from './TagMappingInput';
|
||||||
|
|
||||||
|
export interface TraceToLogsTag {
|
||||||
|
key: string;
|
||||||
|
value?: string;
|
||||||
|
}
|
||||||
|
|
||||||
// @deprecated use getTraceToLogsOptions to get the v2 version of this config from jsonData
|
// @deprecated use getTraceToLogsOptions to get the v2 version of this config from jsonData
|
||||||
export interface TraceToLogsOptions {
|
export interface TraceToLogsOptions {
|
||||||
datasourceUid?: string;
|
datasourceUid?: string;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
mappedTags?: Array<{ key: string; value?: string }>;
|
mappedTags?: TraceToLogsTag[];
|
||||||
mapTagNamesEnabled?: boolean;
|
mapTagNamesEnabled?: boolean;
|
||||||
spanStartTimeShift?: string;
|
spanStartTimeShift?: string;
|
||||||
spanEndTimeShift?: string;
|
spanEndTimeShift?: string;
|
||||||
@ -26,7 +31,7 @@ export interface TraceToLogsOptions {
|
|||||||
|
|
||||||
export interface TraceToLogsOptionsV2 {
|
export interface TraceToLogsOptionsV2 {
|
||||||
datasourceUid?: string;
|
datasourceUid?: string;
|
||||||
tags?: Array<{ key: string; value?: string }>;
|
tags?: TraceToLogsTag[];
|
||||||
spanStartTimeShift?: string;
|
spanStartTimeShift?: string;
|
||||||
spanEndTimeShift?: string;
|
spanEndTimeShift?: string;
|
||||||
filterByTraceID?: boolean;
|
filterByTraceID?: boolean;
|
||||||
@ -151,7 +156,7 @@ export function TraceToLogsSettings({ options, onOptionsChange }: Props) {
|
|||||||
|
|
||||||
<InlineFieldRow>
|
<InlineFieldRow>
|
||||||
<InlineField
|
<InlineField
|
||||||
tooltip="Tags that will be used in the query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'"
|
tooltip="Tags that will be used in the query. Default tags: 'cluster', 'hostname', 'namespace', 'pod', 'service.name', 'service.namespace', 'deployment.environment'"
|
||||||
label="Tags"
|
label="Tags"
|
||||||
labelWidth={26}
|
labelWidth={26}
|
||||||
>
|
>
|
||||||
|
@ -61,7 +61,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(linkDef!.href).toBe(
|
expect(linkDef!.href).toBe(
|
||||||
`/explore?left=${encodeURIComponent(
|
`/explore?left=${encodeURIComponent(
|
||||||
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\"}","refId":""}]}'
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\", service_namespace=\\"namespace1\\"}","refId":""}]}'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -163,7 +163,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
datasource: 'loki1_uid',
|
datasource: 'loki1_uid',
|
||||||
queries: [
|
queries: [
|
||||||
{
|
{
|
||||||
expr: '{cluster="cluster1", hostname="hostname1"} |="7946b05c2e2e4e5a" |="6605c7b08e715d6c"',
|
expr: '{cluster="cluster1", hostname="hostname1", service_namespace="namespace1"} |="7946b05c2e2e4e5a" |="6605c7b08e715d6c"',
|
||||||
refId: '',
|
refId: '',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -265,10 +265,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
createTraceSpan({
|
createTraceSpan({
|
||||||
process: {
|
process: {
|
||||||
serviceName: 'service',
|
serviceName: 'service',
|
||||||
tags: [
|
tags: [{ key: 'k8s.pod.name', value: 'podName' }],
|
||||||
{ key: 'service.name', value: 'serviceName' },
|
|
||||||
{ key: 'k8s.pod.name', value: 'podName' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -351,7 +348,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(linkDef!.href).toBe(
|
expect(linkDef!.href).toBe(
|
||||||
`/explore?left=${encodeURIComponent(
|
`/explore?left=${encodeURIComponent(
|
||||||
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"cluster=\\"cluster1\\" hostname=\\"hostname1\\" \\"7946b05c2e2e4e5a\\" \\"6605c7b08e715d6c\\"","refId":""}]}'
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"cluster=\\"cluster1\\" hostname=\\"hostname1\\" service_namespace=\\"namespace1\\" \\"7946b05c2e2e4e5a\\" \\"6605c7b08e715d6c\\"","refId":""}]}'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -692,7 +689,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef).toBeDefined();
|
expect(linkDef).toBeDefined();
|
||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(decodeURIComponent(linkDef!.href)).toContain(
|
expect(decodeURIComponent(linkDef!.href)).toContain(
|
||||||
`datasource":"${searchUID}","queries":[{"query":"cluster:\\"cluster1\\" AND hostname:\\"hostname1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]`
|
`datasource":"${searchUID}","queries":[{"query":"cluster:\\"cluster1\\" AND hostname:\\"hostname1\\" AND service_namespace:\\"namespace1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -731,7 +728,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(linkDef!.href).toBe(
|
expect(linkDef!.href).toBe(
|
||||||
`/explore?left=${encodeURIComponent(
|
`/explore?left=${encodeURIComponent(
|
||||||
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster:\\"cluster1\\" AND hostname:\\"hostname1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster:\\"cluster1\\" AND hostname:\\"hostname1\\" AND service_namespace:\\"namespace1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -882,7 +879,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef).toBeDefined();
|
expect(linkDef).toBeDefined();
|
||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(decodeURIComponent(linkDef!.href)).toContain(
|
expect(decodeURIComponent(linkDef!.href)).toContain(
|
||||||
`datasource":"${searchUID}","queries":[{"query":"cluster=\\"cluster1\\" AND hostname=\\"hostname1\\"","refId":""}]`
|
`datasource":"${searchUID}","queries":[{"query":"cluster=\\"cluster1\\" AND hostname=\\"hostname1\\" AND service_namespace=\\"namespace1\\"","refId":""}]`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -921,7 +918,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(linkDef!.href).toBe(
|
expect(linkDef!.href).toBe(
|
||||||
`/explore?left=${encodeURIComponent(
|
`/explore?left=${encodeURIComponent(
|
||||||
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster=\\"cluster1\\" AND hostname=\\"hostname1\\"","refId":""}]}`
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster=\\"cluster1\\" AND hostname=\\"hostname1\\" AND service_namespace=\\"namespace1\\"","refId":""}]}`
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -1145,7 +1142,7 @@ describe('createSpanLinkFactory', () => {
|
|||||||
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
||||||
expect(linkDef!.href).toBe(
|
expect(linkDef!.href).toBe(
|
||||||
`/explore?left=${encodeURIComponent(
|
`/explore?left=${encodeURIComponent(
|
||||||
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"cluster=\\"cluster1\\" OR hostname=\\"hostname1\\" or \\"7946b05c2e2e4e5a\\" or \\"6605c7b08e715d6c\\"","refId":""}]}'
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"cluster=\\"cluster1\\" OR hostname=\\"hostname1\\" OR service_namespace=\\"namespace1\\" or \\"7946b05c2e2e4e5a\\" or \\"6605c7b08e715d6c\\"","refId":""}]}'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -1326,6 +1323,10 @@ function createTraceSpan(overrides: Partial<TraceSpan> = {}) {
|
|||||||
key: 'label2',
|
key: 'label2',
|
||||||
value: 'val2',
|
value: 'val2',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'service.namespace',
|
||||||
|
value: 'namespace1',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
...overrides,
|
...overrides,
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
import { getTemplateSrv } from '@grafana/runtime';
|
import { getTemplateSrv } from '@grafana/runtime';
|
||||||
import { DataQuery } from '@grafana/schema';
|
import { DataQuery } from '@grafana/schema';
|
||||||
import { Icon } from '@grafana/ui';
|
import { Icon } from '@grafana/ui';
|
||||||
import { TraceToLogsOptionsV2 } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
import { TraceToLogsOptionsV2, TraceToLogsTag } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
||||||
import { TraceToMetricQuery, TraceToMetricsOptions } from 'app/core/components/TraceToMetrics/TraceToMetricsSettings';
|
import { TraceToMetricQuery, TraceToMetricsOptions } from 'app/core/components/TraceToMetrics/TraceToMetricsSettings';
|
||||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||||
import { PromQuery } from 'app/plugins/datasource/prometheus/types';
|
import { PromQuery } from 'app/plugins/datasource/prometheus/types';
|
||||||
@ -115,7 +115,18 @@ export function createSpanLinkFactory({
|
|||||||
/**
|
/**
|
||||||
* Default keys to use when there are no configured tags.
|
* Default keys to use when there are no configured tags.
|
||||||
*/
|
*/
|
||||||
const defaultKeys = ['cluster', 'hostname', 'namespace', 'pod'].map((k) => ({ key: k }));
|
const defaultKeys = [
|
||||||
|
'cluster',
|
||||||
|
'hostname',
|
||||||
|
'namespace',
|
||||||
|
'pod',
|
||||||
|
'service.name',
|
||||||
|
'service.namespace',
|
||||||
|
'deployment.environment',
|
||||||
|
].map((k) => ({
|
||||||
|
key: k,
|
||||||
|
value: k.includes('.') ? k.replace('.', '_') : undefined,
|
||||||
|
}));
|
||||||
|
|
||||||
function legacyCreateSpanLinkFactory(
|
function legacyCreateSpanLinkFactory(
|
||||||
splitOpenFn: SplitOpen,
|
splitOpenFn: SplitOpen,
|
||||||
@ -149,7 +160,8 @@ function legacyCreateSpanLinkFactory(
|
|||||||
// deprecated blob format and we can map the link easily in data frame.
|
// deprecated blob format and we can map the link easily in data frame.
|
||||||
if (logsDataSourceSettings && traceToLogsOptions) {
|
if (logsDataSourceSettings && traceToLogsOptions) {
|
||||||
const customQuery = traceToLogsOptions.customQuery ? traceToLogsOptions.query : undefined;
|
const customQuery = traceToLogsOptions.customQuery ? traceToLogsOptions.query : undefined;
|
||||||
const tagsToUse = traceToLogsOptions.tags || defaultKeys;
|
const tagsToUse =
|
||||||
|
traceToLogsOptions.tags && traceToLogsOptions.tags.length > 0 ? traceToLogsOptions.tags : defaultKeys;
|
||||||
switch (logsDataSourceSettings?.type) {
|
switch (logsDataSourceSettings?.type) {
|
||||||
case 'loki':
|
case 'loki':
|
||||||
tags = getFormattedTags(span, tagsToUse);
|
tags = getFormattedTags(span, tagsToUse);
|
||||||
@ -480,7 +492,7 @@ function getQueryForFalconLogScale(span: TraceSpan, options: TraceToLogsOptionsV
|
|||||||
*/
|
*/
|
||||||
function getFormattedTags(
|
function getFormattedTags(
|
||||||
span: TraceSpan,
|
span: TraceSpan,
|
||||||
tags: Array<{ key: string; value?: string }>,
|
tags: TraceToLogsTag[],
|
||||||
{ labelValueSign = '=', joinBy = ', ' }: { labelValueSign?: string; joinBy?: string } = {}
|
{ labelValueSign = '=', joinBy = ', ' }: { labelValueSign?: string; joinBy?: string } = {}
|
||||||
) {
|
) {
|
||||||
// In order, try to use mapped tags -> tags -> default tags
|
// In order, try to use mapped tags -> tags -> default tags
|
||||||
|
Loading…
Reference in New Issue
Block a user