diff --git a/public/app/plugins/datasource/tempo/datasource.test.ts b/public/app/plugins/datasource/tempo/datasource.test.ts index 96ea7bf8a6a..d0cc4e726a1 100644 --- a/public/app/plugins/datasource/tempo/datasource.test.ts +++ b/public/app/plugins/datasource/tempo/datasource.test.ts @@ -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', diff --git a/public/app/plugins/datasource/tempo/datasource.ts b/public/app/plugins/datasource/tempo/datasource.ts index f0c36737a8d..028e177bbe1 100644 --- a/public/app/plugins/datasource/tempo/datasource.ts +++ b/public/app/plugins/datasource/tempo/datasource.ts @@ -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, 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])`, diff --git a/public/app/plugins/datasource/tempo/graphTransform.ts b/public/app/plugins/datasource/tempo/graphTransform.ts index 8164109f4c5..9f385f3f443 100644 --- a/public/app/plugins/datasource/tempo/graphTransform.ts +++ b/public/app/plugins/datasource/tempo/graphTransform.ts @@ -133,14 +133,13 @@ function findTraceDuration(view: DataFrameView): 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',