|
|
|
@ -403,6 +403,81 @@ describe('combineResponses', () => { |
|
|
|
|
expect(combined.errors?.[1]?.message).toBe('errorB'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('combines frames with nanoseconds', () => { |
|
|
|
|
const { logFrameA, logFrameB } = getMockFrames(); |
|
|
|
|
logFrameA.fields[0].nanos = [333333, 444444]; |
|
|
|
|
logFrameB.fields[0].nanos = [111111, 222222]; |
|
|
|
|
const responseA: DataQueryResponse = { |
|
|
|
|
data: [logFrameA], |
|
|
|
|
}; |
|
|
|
|
const responseB: DataQueryResponse = { |
|
|
|
|
data: [logFrameB], |
|
|
|
|
}; |
|
|
|
|
expect(combineResponses(responseA, responseB)).toEqual({ |
|
|
|
|
data: [ |
|
|
|
|
{ |
|
|
|
|
fields: [ |
|
|
|
|
{ |
|
|
|
|
config: {}, |
|
|
|
|
name: 'Time', |
|
|
|
|
type: 'time', |
|
|
|
|
values: [1, 2, 3, 4], |
|
|
|
|
nanos: [111111, 222222, 333333, 444444], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
config: {}, |
|
|
|
|
name: 'Line', |
|
|
|
|
type: 'string', |
|
|
|
|
values: ['line3', 'line4', 'line1', 'line2'], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
config: {}, |
|
|
|
|
name: 'labels', |
|
|
|
|
type: 'other', |
|
|
|
|
values: [ |
|
|
|
|
{ |
|
|
|
|
otherLabel: 'other value', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: 'value', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
otherLabel: 'other value', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
config: {}, |
|
|
|
|
name: 'tsNs', |
|
|
|
|
type: 'string', |
|
|
|
|
values: ['1000000', '2000000', '3000000', '4000000'], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
config: {}, |
|
|
|
|
name: 'id', |
|
|
|
|
type: 'string', |
|
|
|
|
values: ['id3', 'id4', 'id1', 'id2'], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
length: 4, |
|
|
|
|
meta: { |
|
|
|
|
custom: { |
|
|
|
|
frameType: 'LabeledTimeValues', |
|
|
|
|
}, |
|
|
|
|
stats: [ |
|
|
|
|
{ |
|
|
|
|
displayName: 'Summary: total bytes processed', |
|
|
|
|
unit: 'decbytes', |
|
|
|
|
value: 33, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
refId: 'A', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('combine stats', () => { |
|
|
|
|
const { metricFrameA } = getMockFrames(); |
|
|
|
|
const makeResponse = (stats?: QueryResultMetaStat[]): DataQueryResponse => ({ |
|
|
|
|