mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
Tempo: Update service graph linked queries from totals to rates (#43866)
* Tempo: Update service graph linked queries from totals to rates * Interpolate server name and interval
This commit is contained in:
parent
55ec05b560
commit
17f7f0dc93
@ -106,7 +106,10 @@ describe('Tempo data source', () => {
|
||||
expect(response.data).toHaveLength(2);
|
||||
expect(response.data[0].name).toBe('Nodes');
|
||||
expect(response.data[0].fields[0].values.length).toBe(3);
|
||||
|
||||
// Test Links
|
||||
expect(response.data[0].fields[0].config.links.length).toBeGreaterThan(0);
|
||||
expect(response.data[0].fields[0].config.links).toEqual(serviceGraphLinks);
|
||||
|
||||
expect(response.data[1].name).toBe('Edges');
|
||||
expect(response.data[1].fields[0].values.length).toBe(2);
|
||||
@ -337,3 +340,28 @@ const mockInvalidJson = {
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const serviceGraphLinks = [
|
||||
{
|
||||
url: '',
|
||||
title: 'Request rate',
|
||||
internal: {
|
||||
query: {
|
||||
expr: 'rate(traces_service_graph_request_total{server="${__data.fields.id}"}[$__interval])',
|
||||
},
|
||||
datasourceUid: 'prom',
|
||||
datasourceName: 'Prometheus',
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '',
|
||||
title: 'Failed request rate',
|
||||
internal: {
|
||||
query: {
|
||||
expr: 'rate(traces_service_graph_request_failed_total{server="${__data.fields.id}"}[$__interval])',
|
||||
},
|
||||
datasourceUid: 'prom',
|
||||
datasourceName: 'Prometheus',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -313,8 +313,16 @@ function serviceMapQuery(request: DataQueryRequest<TempoQuery>, datasourceUid: s
|
||||
const { nodes, edges } = mapPromMetricsToServiceMap(responses, request.range);
|
||||
nodes.fields[0].config = {
|
||||
links: [
|
||||
makePromLink('Total requests', totalsMetric, datasourceUid),
|
||||
makePromLink('Failed requests', failedMetric, datasourceUid),
|
||||
makePromLink(
|
||||
'Request rate',
|
||||
`rate(${totalsMetric}{server="\${__data.fields.id}"}[$__interval])`,
|
||||
datasourceUid
|
||||
),
|
||||
makePromLink(
|
||||
'Failed request rate',
|
||||
`rate(${failedMetric}{server="\${__data.fields.id}"}[$__interval])`,
|
||||
datasourceUid
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user