Explore: Traces query that will work with either logs drilldown or explore (#115837)
* fix: use query that will work with either logs drilldown or explore
This commit is contained in:
@@ -200,7 +200,7 @@ describe('createSpanLinkFactory', () => {
|
||||
datasource: 'loki1_uid',
|
||||
queries: [
|
||||
{
|
||||
expr: '{cluster="cluster1", hostname="hostname1", service_namespace="namespace1"} | label_format log_line_contains_trace_id=`{{ contains "7946b05c2e2e4e5a" __line__ }}` | log_line_contains_trace_id="true" or trace_id="7946b05c2e2e4e5a" | label_format log_line_contains_span_id=`{{ contains "6605c7b08e715d6c" __line__ }}` | log_line_contains_span_id="true" or span_id="6605c7b08e715d6c"',
|
||||
expr: '{cluster="cluster1", hostname="hostname1", service_namespace="namespace1"} | logfmt | json | drop __error__, __error_details__ | trace_id="7946b05c2e2e4e5a" | span_id="6605c7b08e715d6c"',
|
||||
refId: '',
|
||||
datasource: { uid: 'loki1_uid' },
|
||||
},
|
||||
|
||||
@@ -446,12 +446,12 @@ function getQueryForLoki(
|
||||
|
||||
let expr = '{${__tags}}';
|
||||
if (filterByTraceID && span.traceID) {
|
||||
expr +=
|
||||
' | label_format log_line_contains_trace_id=`{{ contains "${__span.traceId}" __line__ }}` | log_line_contains_trace_id="true" or trace_id="${__span.traceId}"';
|
||||
}
|
||||
if (filterBySpanID && span.spanID) {
|
||||
expr +=
|
||||
' | label_format log_line_contains_span_id=`{{ contains "${__span.spanId}" __line__ }}` | log_line_contains_span_id="true" or span_id="${__span.spanId}"';
|
||||
expr += ' | logfmt | json | drop __error__, __error_details__ | trace_id="${__span.traceId}"';
|
||||
if (filterBySpanID && span.spanID) {
|
||||
expr += ' | span_id="${__span.spanId}"';
|
||||
}
|
||||
} else if (filterBySpanID && span.spanID) {
|
||||
expr += ' | logfmt | json | drop __error__, __error_details__ | span_id="${__span.spanId}"';
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user