|
|
|
@ -1790,16 +1790,17 @@ describe('PrometheusDatasource for POST', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('When querying prometheus via check headers X-Dashboard-Id and X-Panel-Id', () => { |
|
|
|
describe('When querying prometheus via check headers X-Dashboard-Id X-Panel-Id and X-Dashboard-UID', () => { |
|
|
|
const options = { dashboardId: 1, panelId: 2 }; |
|
|
|
const options = { dashboardId: 1, panelId: 2, dashboardUID: 'WFlOM-jM1' }; |
|
|
|
const httpOptions = { |
|
|
|
const httpOptions = { |
|
|
|
headers: {} as { [key: string]: number | undefined }, |
|
|
|
headers: {} as { [key: string]: number | undefined }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
it('with proxy access tracing headers should be added', () => { |
|
|
|
it('with proxy access tracing headers should be added', () => { |
|
|
|
ds._addTracingHeaders(httpOptions as any, options as any); |
|
|
|
ds._addTracingHeaders(httpOptions as any, options as any); |
|
|
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(1); |
|
|
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(options.dashboardId); |
|
|
|
expect(httpOptions.headers['X-Panel-Id']).toBe(2); |
|
|
|
expect(httpOptions.headers['X-Panel-Id']).toBe(options.panelId); |
|
|
|
|
|
|
|
expect(httpOptions.headers['X-Dashboard-UID']).toBe(options.dashboardUID); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('with direct access tracing headers should not be added', () => { |
|
|
|
it('with direct access tracing headers should not be added', () => { |
|
|
|
@ -1811,6 +1812,7 @@ describe('PrometheusDatasource for POST', () => { |
|
|
|
mockDs._addTracingHeaders(httpOptions as any, options as any); |
|
|
|
mockDs._addTracingHeaders(httpOptions as any, options as any); |
|
|
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(undefined); |
|
|
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(undefined); |
|
|
|
expect(httpOptions.headers['X-Panel-Id']).toBe(undefined); |
|
|
|
expect(httpOptions.headers['X-Panel-Id']).toBe(undefined); |
|
|
|
|
|
|
|
expect(httpOptions.headers['X-Dashboard-UID']).toBe(undefined); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -1877,6 +1879,7 @@ describe('prepareTargets', () => { |
|
|
|
expr: 'up', |
|
|
|
expr: 'up', |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
|
|
|
|
'X-Dashboard-UID': undefined, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
}, |
|
|
|
}, |
|
|
|
hinting: undefined, |
|
|
|
hinting: undefined, |
|
|
|
@ -2038,6 +2041,7 @@ describe('prepareTargets', () => { |
|
|
|
expr: 'up', |
|
|
|
expr: 'up', |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
|
|
|
|
'X-Dashboard-UID': undefined, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
}, |
|
|
|
}, |
|
|
|
hinting: undefined, |
|
|
|
hinting: undefined, |
|
|
|
@ -2059,6 +2063,7 @@ describe('prepareTargets', () => { |
|
|
|
expr: 'up', |
|
|
|
expr: 'up', |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
|
|
|
|
'X-Dashboard-UID': undefined, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
}, |
|
|
|
}, |
|
|
|
hinting: undefined, |
|
|
|
hinting: undefined, |
|
|
|
@ -2099,6 +2104,7 @@ describe('prepareTargets', () => { |
|
|
|
expr: 'up', |
|
|
|
expr: 'up', |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
|
|
|
|
'X-Dashboard-UID': undefined, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
}, |
|
|
|
}, |
|
|
|
hinting: undefined, |
|
|
|
hinting: undefined, |
|
|
|
@ -2135,6 +2141,7 @@ describe('prepareTargets', () => { |
|
|
|
expr: 'up', |
|
|
|
expr: 'up', |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
'X-Dashboard-Id': undefined, |
|
|
|
|
|
|
|
'X-Dashboard-UID': undefined, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
'X-Panel-Id': panelId, |
|
|
|
}, |
|
|
|
}, |
|
|
|
hinting: undefined, |
|
|
|
hinting: undefined, |
|
|
|
|