|
|
|
@ -226,8 +226,7 @@ export function lokiResultsToTableModel( |
|
|
|
|
lokiResults: Array<LokiMatrixResult | LokiVectorResult>, |
|
|
|
|
resultCount: number, |
|
|
|
|
refId: string, |
|
|
|
|
meta: QueryResultMeta, |
|
|
|
|
valueWithRefId?: boolean |
|
|
|
|
meta: QueryResultMeta |
|
|
|
|
): TableModel { |
|
|
|
|
if (!lokiResults || lokiResults.length === 0) { |
|
|
|
|
return new TableModel(); |
|
|
|
@ -246,7 +245,7 @@ export function lokiResultsToTableModel( |
|
|
|
|
table.columns = [ |
|
|
|
|
{ text: 'Time', type: FieldType.time }, |
|
|
|
|
...sortedLabels.map((label) => ({ text: label, filterable: true, type: FieldType.string })), |
|
|
|
|
{ text: resultCount > 1 || valueWithRefId ? `Value #${refId}` : 'Value', type: FieldType.number }, |
|
|
|
|
{ text: `Value #${refId}`, type: FieldType.number }, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
// Populate rows, set value to empty string when label not present.
|
|
|
|
@ -453,7 +452,6 @@ function rangeQueryResponseToTimeSeries( |
|
|
|
|
response: LokiResponse, |
|
|
|
|
query: LokiRangeQueryRequest, |
|
|
|
|
target: LokiQuery, |
|
|
|
|
responseListLength: number, |
|
|
|
|
scopedVars: ScopedVars |
|
|
|
|
): TimeSeries[] { |
|
|
|
|
/** Show results of Loki metric queries only in graph */ |
|
|
|
@ -461,16 +459,10 @@ function rangeQueryResponseToTimeSeries( |
|
|
|
|
preferredVisualisationType: 'graph', |
|
|
|
|
}; |
|
|
|
|
const transformerOptions: TransformerOptions = { |
|
|
|
|
format: target.format, |
|
|
|
|
legendFormat: target.legendFormat ?? '', |
|
|
|
|
start: query.start!, |
|
|
|
|
end: query.end!, |
|
|
|
|
step: query.step!, |
|
|
|
|
query: query.query, |
|
|
|
|
responseListLength, |
|
|
|
|
refId: target.refId, |
|
|
|
|
meta, |
|
|
|
|
valueWithRefId: target.valueWithRefId, |
|
|
|
|
scopedVars, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -490,10 +482,9 @@ export function rangeQueryResponseToDataFrames( |
|
|
|
|
response: LokiResponse, |
|
|
|
|
query: LokiRangeQueryRequest, |
|
|
|
|
target: LokiQuery, |
|
|
|
|
responseListLength: number, |
|
|
|
|
scopedVars: ScopedVars |
|
|
|
|
): DataFrame[] { |
|
|
|
|
const series = rangeQueryResponseToTimeSeries(response, query, target, responseListLength, scopedVars); |
|
|
|
|
const series = rangeQueryResponseToTimeSeries(response, query, target, scopedVars); |
|
|
|
|
const frames = series.map((s) => toDataFrame(s)); |
|
|
|
|
|
|
|
|
|
const { step } = query; |
|
|
|
@ -517,7 +508,6 @@ export function processRangeQueryResponse( |
|
|
|
|
response: LokiResponse, |
|
|
|
|
target: LokiQuery, |
|
|
|
|
query: LokiRangeQueryRequest, |
|
|
|
|
responseListLength: number, |
|
|
|
|
limit: number, |
|
|
|
|
config: LokiOptions, |
|
|
|
|
scopedVars: ScopedVars |
|
|
|
@ -532,16 +522,7 @@ export function processRangeQueryResponse( |
|
|
|
|
case LokiResultType.Vector: |
|
|
|
|
case LokiResultType.Matrix: |
|
|
|
|
return of({ |
|
|
|
|
data: rangeQueryResponseToDataFrames( |
|
|
|
|
response, |
|
|
|
|
query, |
|
|
|
|
{ |
|
|
|
|
...target, |
|
|
|
|
format: 'time_series', |
|
|
|
|
}, |
|
|
|
|
responseListLength, |
|
|
|
|
scopedVars |
|
|
|
|
), |
|
|
|
|
data: rangeQueryResponseToDataFrames(response, query, target, scopedVars), |
|
|
|
|
key: target.refId, |
|
|
|
|
}); |
|
|
|
|
default: |
|
|
|
|