mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Tempo/Prometheus links select ds in new tab (cmd + click) (#52319)
* Set tempo/prom ds name when clicking trace links * Updated tests * Removed vars
This commit is contained in:
parent
7b7b9ff4a7
commit
6c89bf53f2
@ -578,6 +578,14 @@ const backendSrvWithPrometheus = {
|
||||
}
|
||||
throw new Error('unexpected uid');
|
||||
},
|
||||
getDataSourceSettingsByUid(uid: string) {
|
||||
if (uid === 'prom') {
|
||||
return { name: 'Prometheus' };
|
||||
} else if (uid === 'gdev-tempo') {
|
||||
return { name: 'Tempo' };
|
||||
}
|
||||
return '';
|
||||
},
|
||||
};
|
||||
|
||||
function setupBackendSrv(frame: DataFrame) {
|
||||
@ -598,7 +606,7 @@ function setupBackendSrv(frame: DataFrame) {
|
||||
|
||||
const defaultSettings: DataSourceInstanceSettings<TempoJsonData> = {
|
||||
id: 0,
|
||||
uid: '0',
|
||||
uid: 'gdev-tempo',
|
||||
type: 'tracing',
|
||||
name: 'tempo',
|
||||
access: 'proxy',
|
||||
@ -777,7 +785,7 @@ const serviceGraphLinks = [
|
||||
queryType: 'nativeSearch',
|
||||
serviceName: '${__data.fields[0]}',
|
||||
} as TempoQuery,
|
||||
datasourceUid: 'tempo',
|
||||
datasourceUid: 'gdev-tempo',
|
||||
datasourceName: 'Tempo',
|
||||
},
|
||||
},
|
||||
|
@ -237,18 +237,19 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
||||
});
|
||||
|
||||
const dsId = this.serviceMap.datasourceUid;
|
||||
const tempoDsUid = this.uid;
|
||||
if (config.featureToggles.tempoApmTable) {
|
||||
subQueries.push(
|
||||
serviceMapQuery(options, dsId, this.name).pipe(
|
||||
serviceMapQuery(options, dsId, tempoDsUid).pipe(
|
||||
concatMap((result) =>
|
||||
rateQuery(options, result, dsId).pipe(
|
||||
concatMap((result) => errorAndDurationQuery(options, result, dsId, this.name))
|
||||
concatMap((result) => errorAndDurationQuery(options, result, dsId, tempoDsUid))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
subQueries.push(serviceMapQuery(options, dsId, this.name));
|
||||
subQueries.push(serviceMapQuery(options, dsId, tempoDsUid));
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,7 +586,7 @@ function makePromLink(title: string, expr: string, datasourceUid: string, instan
|
||||
instant: instant,
|
||||
} as PromQuery,
|
||||
datasourceUid,
|
||||
datasourceName: 'Prometheus',
|
||||
datasourceName: getDatasourceSrv().getDataSourceSettingsByUid(datasourceUid)?.name ?? '',
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -604,8 +605,8 @@ export function makeTempoLink(title: string, serviceName: string, spanName: stri
|
||||
title,
|
||||
internal: {
|
||||
query,
|
||||
datasourceUid: datasourceUid,
|
||||
datasourceName: 'Tempo',
|
||||
datasourceUid,
|
||||
datasourceName: getDatasourceSrv().getDataSourceSettingsByUid(datasourceUid)?.name ?? '',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user