@@ -41,8 +41,13 @@ local variable = import 'dashboard/variable.libsonnet';
4141 ).addTarget(
4242 if cfg.type == variable.datasource_type.prometheus then
4343 prometheus.target(
44- expr='sum(tnt_memory{job=~"$job"}) + sum(tnt_memory_virt{job=~"$job"})' ,
45- legendFormat='{{alias}}' ,
44+ expr=std.format (
45+ '%s + %s' ,
46+ [
47+ aggregate_expr(cfg, 'tnt_memory' ),
48+ aggregate_expr(cfg, 'tnt_memory_virt' ),
49+ ]
50+ ),
4651 )
4752 else if cfg.type == variable.datasource_type.influxdb then
4853 influxdb.target()
@@ -64,7 +69,10 @@ local variable = import 'dashboard/variable.libsonnet';
6469 ).addTarget(
6570 common.target(cfg, 'tnt_memory' )
6671 ).addTarget(
67- common.target(cfg, 'sum(tnt_memory{job=~"$job"})' ),
72+ if cfg.type == variable.datasource_type.prometheus then
73+ prometheus.target(expr=aggregate_expr(cfg, 'tnt_memory' ),)
74+ else if cfg.type == variable.datasource_type.influxdb then
75+ influxdb.target()
6876 ),
6977
7078 virt_memory(
@@ -83,7 +91,10 @@ local variable = import 'dashboard/variable.libsonnet';
8391 ).addTarget(
8492 common.target(cfg, 'tnt_memory_virt' )
8593 ).addTarget(
86- common.target(cfg, 'sum(tnt_memory_virt{job=~"$job"})' ),
94+ if cfg.type == variable.datasource_type.prometheus then
95+ prometheus.target(expr=aggregate_expr(cfg, 'tnt_memory_virt' ),)
96+ else if cfg.type == variable.datasource_type.influxdb then
97+ influxdb.target()
8798 ),
8899
89100 lua_memory(
0 commit comments