mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
loki: backend-mode: add "limit" dataframe meta attribute (#48894)
This commit is contained in:
parent
a1217ef8da
commit
44e7602ad2
@ -91,6 +91,37 @@ describe('loki backendResultTransformer', () => {
|
|||||||
expect(result).toEqual(expected);
|
expect(result).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('applies maxLines correctly', () => {
|
||||||
|
const response: DataQueryResponse = { data: [cloneDeep(inputFrame)] };
|
||||||
|
|
||||||
|
const frame1: DataFrame = transformBackendResult(
|
||||||
|
response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
refId: 'A',
|
||||||
|
expr: LOKI_EXPR,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
).data[0];
|
||||||
|
|
||||||
|
expect(frame1.meta?.limit).toBeUndefined();
|
||||||
|
|
||||||
|
const frame2 = transformBackendResult(
|
||||||
|
response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
refId: 'A',
|
||||||
|
expr: LOKI_EXPR,
|
||||||
|
maxLines: 42,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
).data[0];
|
||||||
|
|
||||||
|
expect(frame2.meta?.limit).toBe(42);
|
||||||
|
});
|
||||||
|
|
||||||
it('processed derived fields correctly', () => {
|
it('processed derived fields correctly', () => {
|
||||||
const input: DataFrame = {
|
const input: DataFrame = {
|
||||||
length: 1,
|
length: 1,
|
||||||
|
@ -27,6 +27,7 @@ function processStreamFrame(
|
|||||||
): DataFrame {
|
): DataFrame {
|
||||||
const meta: QueryResultMeta = {
|
const meta: QueryResultMeta = {
|
||||||
preferredVisualisationType: 'logs',
|
preferredVisualisationType: 'logs',
|
||||||
|
limit: query?.maxLines,
|
||||||
searchWords: query !== undefined ? getHighlighterExpressionsFromQuery(formatQuery(query.expr)) : undefined,
|
searchWords: query !== undefined ? getHighlighterExpressionsFromQuery(formatQuery(query.expr)) : undefined,
|
||||||
custom: {
|
custom: {
|
||||||
// used by logs_model
|
// used by logs_model
|
||||||
|
Loading…
Reference in New Issue
Block a user