mirror of
https://github.com/grafana/grafana.git
synced 2025-01-07 22:53:56 -06:00
Tempo: Set APM table default span kind (#52851)
* Add span kind server to query * Updated test
This commit is contained in:
parent
e2258120e7
commit
dc0ef2913e
@ -487,7 +487,7 @@ describe('Tempo apm table', () => {
|
||||
expect(builtQuery).toBe('sum(rate(traces_spanmetrics_calls_total{}[$__rate_interval]))');
|
||||
});
|
||||
|
||||
it('should build link expr correctly', () => {
|
||||
it('should get field config correctly', () => {
|
||||
let datasourceUid = 's4Jvz8Qnk';
|
||||
let tempoDatasourceUid = 'EbPO1fYnz';
|
||||
let targetField = '__data.fields.target';
|
||||
@ -694,12 +694,12 @@ const defaultSettings: DataSourceInstanceSettings<TempoJsonData> = {
|
||||
};
|
||||
|
||||
const rateMetric = new MutableDataFrame({
|
||||
refId: 'topk(5, sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name))',
|
||||
refId: 'topk(5, sum(rate(traces_spanmetrics_calls_total{span_kind="SPAN_KIND_SERVER"}[$__range])) by (span_name))',
|
||||
fields: [
|
||||
{ name: 'Time', values: [1653725618609, 1653725618609] },
|
||||
{ name: 'span_name', values: ['HTTP Client', 'HTTP GET - root'] },
|
||||
{
|
||||
name: 'Value #topk(5, sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name))',
|
||||
name: 'Value #topk(5, sum(rate(traces_spanmetrics_calls_total{span_kind="SPAN_KIND_SERVER"}[$__range])) by (span_name))',
|
||||
values: [12.75164671814457, 12.121331111401608],
|
||||
},
|
||||
],
|
||||
|
@ -43,6 +43,7 @@ import {
|
||||
rateMetric,
|
||||
durationMetric,
|
||||
errorRateMetric,
|
||||
defaultTableFilter,
|
||||
} from './graphTransform';
|
||||
import {
|
||||
transformTrace,
|
||||
@ -487,7 +488,7 @@ function rateQuery(
|
||||
datasourceUid: string
|
||||
) {
|
||||
const serviceMapRequest = makePromServiceMapRequest(request);
|
||||
serviceMapRequest.targets = makeApmRequest([buildExpr(rateMetric, '', request)]);
|
||||
serviceMapRequest.targets = makeApmRequest([buildExpr(rateMetric, defaultTableFilter, request)]);
|
||||
|
||||
return queryPrometheus(serviceMapRequest, datasourceUid).pipe(
|
||||
toArray(),
|
||||
@ -660,7 +661,7 @@ function getApmTable(
|
||||
) {
|
||||
let df: any = { fields: [] };
|
||||
const rate = rateResponse.data[0]?.filter((x: { refId: string }) => {
|
||||
return x.refId === buildExpr(rateMetric, '', request);
|
||||
return x.refId === buildExpr(rateMetric, defaultTableFilter, request);
|
||||
});
|
||||
const errorRate = secondResponse.data.filter((x) => {
|
||||
return x.refId === errorRateBySpanName;
|
||||
|
@ -148,6 +148,7 @@ export const durationMetric = {
|
||||
expr: 'histogram_quantile(.9, sum(rate(traces_spanmetrics_latency_bucket{}[$__range])) by (le))',
|
||||
params: [],
|
||||
};
|
||||
export const defaultTableFilter = 'span_kind="SPAN_KIND_SERVER"';
|
||||
|
||||
export const serviceMapMetrics = [
|
||||
secondsMetric,
|
||||
|
Loading…
Reference in New Issue
Block a user