@@ -104,7 +104,7 @@ local variable = import 'dashboard/variable.libsonnet';
104104
105105 total_memory(
106106 cfg,
107- title='Total memory usage ' ,
107+ title='Total memory per cluster ' ,
108108 description=|||
109109 Total memory used by Tarantool.
110110 ||| ,
@@ -130,20 +130,37 @@ local variable = import 'dashboard/variable.libsonnet';
130130 else if cfg.type == variable.datasource_type.influxdb then
131131 influxdb.target(
132132 rawQuery=true ,
133- query=|||
134- SELECT SUM("value") AS total_memory_per_cluster
135- FROM "$policy"."$measurement"
136- WHERE ("metric_name" = 'tnt_memory' OR "metric_name" = 'tnt_memory_virt')
133+ // query=|||
134+ // SELECT SUM("value") AS total_memory_per_cluster
135+ // FROM "$policy"."$measurement"
136+ // WHERE ("metric_name" = 'tnt_memory' OR "metric_name" = 'tnt_memory_virt')
137+ // AND $timeFilter
138+ // GROUP BY time($__interval)
139+ // |||,
140+ query=std.format(|||
141+ SELECT SUM("value")
142+ FROM %(measurement_with_policy)s
143+ WHERE (("metric_name" = '%(metric_memory)s' OR "metric_name" = '%(metric_memory_virt)s') AND %(filters)s)
137144 AND $timeFilter
138145 GROUP BY time($__interval)
139- ||| ,
146+ ||| , {
147+ measurement_with_policy: std.format ('%(policy_prefix)s"%(measurement)s"' , {
148+ policy_prefix: if cfg.policy == 'default' then '' else std.format ('"%(policy)s".' , cfg.policy),
149+ measurement: cfg.measurement,
150+ }),
151+ metric_memory: cfg.metrics_prefix + 'tnt_memory' ,
152+ metric_memory_virt: cfg.metrics_prefix + 'tnt_memory_virt' ,
153+ filters: if common.influxdb_query_filters(common.remove_field(cfg.filters, 'label_pairs_alias' )) != ''
154+ then common.influxdb_query_filters(common.remove_field(cfg.filters, 'label_pairs_alias' ))
155+ else 'true' ,
156+ }),
140157 alias=title,
141158 )
142159 ),
143160
144161 total_resident_memory(
145162 cfg,
146- title='Total resident memory usage ' ,
163+ title='Total resident memory per cluster ' ,
147164 description=|||
148165 Resident memory used by Tarantool instance.
149166 ||| ,
@@ -160,20 +177,34 @@ local variable = import 'dashboard/variable.libsonnet';
160177 else if cfg.type == variable.datasource_type.influxdb then
161178 influxdb.target(
162179 rawQuery=true ,
163- query=|||
164- SELECT SUM("value") AS total_resident_memory
165- FROM "$policy"."$measurement"
166- WHERE "metric_name" = 'tnt_memory' AND "label_pairs_alias" =~ /^$alias$/
180+ // query=|||
181+ // SELECT SUM("value") AS total_resident_memory
182+ // FROM "$policy"."$measurement"
183+ // WHERE "metric_name" = 'tnt_memory' AND "label_pairs_alias" =~ /^$alias$/
184+ // AND $timeFilter
185+ // GROUP BY time($__interval)
186+ // |||,
187+ query=std.format(|||
188+ SELECT SUM("value")
189+ FROM %(measurement_with_policy)s
190+ WHERE "metric_name" = '%(metric_memory)s' AND %(filters)s
167191 AND $timeFilter
168192 GROUP BY time($__interval)
169- ||| ,
193+ ||| , {
194+ measurement_with_policy: std.format ('%(policy_prefix)s"%(measurement)s"' , {
195+ policy_prefix: if cfg.policy == 'default' then '' else std.format ('"%(policy)s".' , cfg.policy),
196+ measurement: cfg.measurement,
197+ }),
198+ metric_memory: cfg.metrics_prefix + 'tnt_memory' ,
199+ filters: common.influxdb_query_filters(cfg.filters),
200+ }),
170201 alias=title,
171202 )
172203 ),
173204
174205 total_virtual_memory(
175206 cfg,
176- title='Total virtual memory usage ' ,
207+ title='Total virtual memory per cluster ' ,
177208 description=|||
178209 Virtual memory used by Tarantool instance.
179210 ||| ,
@@ -190,13 +221,27 @@ local variable = import 'dashboard/variable.libsonnet';
190221 else if cfg.type == variable.datasource_type.influxdb then
191222 influxdb.target(
192223 rawQuery=true ,
193- query=|||
194- SELECT SUM("value") AS total_virt_memory
195- FROM "$policy"."$measurement"
196- WHERE "metric_name" = 'tnt_memory_virt' AND "label_pairs_alias" =~ /^$alias$/
224+ // query=|||
225+ // SELECT SUM("value") AS total_virt_memory
226+ // FROM "$policy"."$measurement"
227+ // WHERE "metric_name" = 'tnt_memory_virt' AND "label_pairs_alias" =~ /^$alias$/
228+ // AND $timeFilter
229+ // GROUP BY time($__interval)
230+ // |||,
231+ query=std.format(|||
232+ SELECT SUM("value")
233+ FROM %(measurement_with_policy)s
234+ WHERE "metric_name" = '%(metric_memory_virt)s' AND %(filters)s
197235 AND $timeFilter
198236 GROUP BY time($__interval)
199- ||| ,
237+ ||| , {
238+ measurement_with_policy: std.format ('%(policy_prefix)s"%(measurement)s"' , {
239+ policy_prefix: if cfg.policy == 'default' then '' else std.format ('"%(policy)s".' , cfg.policy),
240+ measurement: cfg.measurement,
241+ }),
242+ metric_memory_virt: cfg.metrics_prefix + 'tnt_memory_virt' ,
243+ filters: common.influxdb_query_filters(cfg.filters),
244+ }),
200245 alias=title,
201246 )
202247 ),
0 commit comments