mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
Jaeger: Add support for traceID field to accept variables. (#45559)
This commit is contained in:
parent
f530775e45
commit
e738896316
@ -159,6 +159,32 @@ describe('JaegerDatasource', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should resolve templates in traceID', async () => {
|
||||
const mock = setupFetchMock({ data: [testResponse] });
|
||||
const ds = new JaegerDatasource(defaultSettings, timeSrvStub);
|
||||
|
||||
await lastValueFrom(
|
||||
ds.query({
|
||||
...defaultQuery,
|
||||
scopedVars: {
|
||||
$traceid: {
|
||||
text: 'traceid',
|
||||
value: '5311b0dd0ca8df3463df93c99cb805a6',
|
||||
},
|
||||
},
|
||||
targets: [
|
||||
{
|
||||
query: '$traceid',
|
||||
refId: '1',
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
expect(mock).toBeCalledWith({
|
||||
url: `${defaultSettings.url}/api/traces/5311b0dd0ca8df3463df93c99cb805a6`,
|
||||
});
|
||||
});
|
||||
|
||||
it('should resolve templates in tags', async () => {
|
||||
const mock = setupFetchMock({ data: [testResponse] });
|
||||
const ds = new JaegerDatasource(defaultSettings, timeSrvStub);
|
||||
|
@ -52,7 +52,9 @@ export class JaegerDatasource extends DataSourceApi<JaegerQuery, JaegerJsonData>
|
||||
}
|
||||
|
||||
if (target.queryType !== 'search' && target.query) {
|
||||
return this._request(`/api/traces/${encodeURIComponent(target.query)}`).pipe(
|
||||
return this._request(
|
||||
`/api/traces/${encodeURIComponent(getTemplateSrv().replace(target.query, options.scopedVars))}`
|
||||
).pipe(
|
||||
map((response) => {
|
||||
const traceData = response?.data?.data?.[0];
|
||||
if (!traceData) {
|
||||
|
Loading…
Reference in New Issue
Block a user