mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Correlations: Handle special field for loki labels (using data plane) (#94033)
Use dataplane data if available
This commit is contained in:
@@ -19,11 +19,13 @@ import {
|
||||
DataLinkPostProcessor,
|
||||
ExploreUrlState,
|
||||
urlUtil,
|
||||
DataFrameType,
|
||||
} from '@grafana/data';
|
||||
import { getTemplateSrv, reportInteraction, VariableInterpolation } from '@grafana/runtime';
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
import { getTransformationVars } from 'app/features/correlations/transformations';
|
||||
import { parseDataplaneLogsFrame } from 'app/features/logs/logsFrame';
|
||||
import { ExploreItemState } from 'app/types/explore';
|
||||
|
||||
import { getLinkSrv } from '../../panel/panellinks/link_srv';
|
||||
@@ -137,6 +139,18 @@ export const getFieldLinksForExplore = (options: {
|
||||
text: 'Data',
|
||||
};
|
||||
|
||||
if (dataFrame.meta?.type === DataFrameType.LogLines) {
|
||||
const dataPlane = parseDataplaneLogsFrame(dataFrame);
|
||||
const labels = dataPlane?.getLogFrameLabels();
|
||||
if (labels != null) {
|
||||
Object.entries(labels[rowIndex]).forEach((value) => {
|
||||
scopedVars[value[0]] = {
|
||||
value: value[1],
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
dataFrame.fields.forEach((f) => {
|
||||
if (fieldDisplayValuesProxy && fieldDisplayValuesProxy[f.name]) {
|
||||
scopedVars[f.name] = {
|
||||
|
||||
@@ -45,7 +45,7 @@ export function logFrameLabelsToLabels(logFrameLabels: LogFrameLabels): Labels {
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseDataplaneLogsFrame(frame: DataFrame): LogsFrame | null {
|
||||
export function parseDataplaneLogsFrame(frame: DataFrame): LogsFrame | null {
|
||||
const cache = new FieldCache(frame);
|
||||
|
||||
const timestampField = getField(cache, DATAPLANE_TIMESTAMP_NAME, FieldType.time);
|
||||
|
||||
Reference in New Issue
Block a user