Tempo: Add request histogram to service graph datalink (#44671)

This commit is contained in:
Connor Lindsey 2022-02-01 10:41:14 -07:00 committed by GitHub
parent f81b9c8150
commit de04f19c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 4 deletions

View File

@ -353,6 +353,18 @@ const serviceGraphLinks = [
datasourceName: 'Prometheus',
},
},
{
url: '',
title: 'Request histogram',
internal: {
query: {
expr:
'histogram_quantile(0.9, rate(traces_service_graph_request_server_seconds_bucket{server="${__data.fields.id}"}[$__interval]))',
},
datasourceUid: 'prom',
datasourceName: 'Prometheus',
},
},
{
url: '',
title: 'Failed request rate',

View File

@ -18,7 +18,13 @@ import { identity, pick, pickBy, groupBy, startCase } from 'lodash';
import { LokiOptions, LokiQuery } from '../loki/types';
import { PrometheusDatasource } from '../prometheus/datasource';
import { PromQuery } from '../prometheus/types';
import { failedMetric, mapPromMetricsToServiceMap, serviceMapMetrics, totalsMetric } from './graphTransform';
import {
failedMetric,
histogramMetric,
mapPromMetricsToServiceMap,
serviceMapMetrics,
totalsMetric,
} from './graphTransform';
import {
transformTrace,
transformTraceList,
@ -322,6 +328,11 @@ function serviceMapQuery(request: DataQueryRequest<TempoQuery>, datasourceUid: s
`rate(${totalsMetric}{server="\${__data.fields.id}"}[$__interval])`,
datasourceUid
),
makePromLink(
'Request histogram',
`histogram_quantile(0.9, rate(${histogramMetric}{server="\${__data.fields.id}"}[$__interval]))`,
datasourceUid
),
makePromLink(
'Failed request rate',
`rate(${failedMetric}{server="\${__data.fields.id}"}[$__interval])`,

View File

@ -133,14 +133,13 @@ function findTraceDuration(view: DataFrameView<Row>): number {
export const secondsMetric = 'traces_service_graph_request_server_seconds_sum';
export const totalsMetric = 'traces_service_graph_request_total';
export const failedMetric = 'traces_service_graph_request_failed_total';
export const histogramMetric = 'traces_service_graph_request_server_seconds_bucket';
export const serviceMapMetrics = [
secondsMetric,
totalsMetric,
failedMetric,
// We don't show histogram in node graph at the moment but we could later add that into a node context menu.
// 'traces_service_graph_request_seconds_bucket',
// 'traces_service_graph_request_seconds_count',
histogramMetric,
// These are used for debugging the tempo collection so probably not useful for service map right now.
// 'traces_service_graph_unpaired_spans_total',
// 'traces_service_graph_untagged_spans_total',