-
Notifications
You must be signed in to change notification settings - Fork 14
dashboard: cpu/memory/virtual memory panels #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
dashboard: cpu/memory/virtual memory panels #245
Conversation
ce8eeda
to
7a9bc4f
Compare
7a9bc4f
to
d1b1905
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, squash commits.
#RUN DEBIAN_FRONTEND=noninteractive apt install -y git patch | ||
#RUN git clone https://github.com/magefile/mage && \ | ||
# cd mage && \ | ||
# go run bootstrap.go | ||
#RUN tt install tt master | ||
#RUN tt install tarantool master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, revert the changes or fix the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's temporarily debug stuff.
dashboard/panels/runtime.libsonnet
Outdated
if cfg.type == variable.datasource_type.prometheus then | ||
prometheus.target(expr=aggregate_expr(cfg, 'tnt_memory_virt'), legendFormat=title) | ||
else if cfg.type == variable.datasource_type.influxdb then | ||
influxdb.target() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, do you plan to support it later for InfluxDB or not? If not, let's not add an empty panel to InfluxDB dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InfluxDB panels have been added.
dashboard/panels/cpu.libsonnet
Outdated
).addTarget( | ||
if cfg.type == variable.datasource_type.prometheus then | ||
prometheus.target( | ||
expr='rate(tnt_cpu_user_time[$__rate_interval]) + rate(tnt_cpu_system_time[$__rate_interval])', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To properly support non-default configurations, targets must consider the pre-configured filters (either static or dynamic) and metrics prefix.
The basic example is as follows. By default, Tarantool dashboard expects the user to have one Prometheus job per application, so all queries must get metrics only for a specific job. Otherwise we will display the data for all Tarantool application over Prometheus.
tnt_metric{job='myjob'}
grafana-dashboard library allows to provide various additional filters on build. The dashboard we publish to grafana.com has the following ones
Lines 49 to 52 in a225559
filters: { | |
job: ['=~', '$job'], | |
alias: ['=~', '$alias'], | |
} |
It allows to choose a job
for your application, as well as display data only for certain application instances instead of all of them, if one wishes to.
grafana-dashboard library has a couple of helpers to compute such stuff for you, but in case of non-trivial queries (with additional sums) we'll need to reimplement them a little bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I have used this Prometheus target as an example.)
So, let's rewrite this one. To add a prefix, we need to simply concat it
std.format(|||
'rate(%(metrics_prefix)tnt_cpu_user_time[$__rate_interval]) + rate(%(metrics_prefix)tnt_cpu_system_time[$__rate_interval])'
|||, {
metrics_prefix: cfg.metrics_prefix,
})
I use named std.format
here since positional one will look more complicated here.
Next, we need to add common filters
std.format(|||
'rate(%(metrics_prefix)tnt_cpu_user_time{%(filters)s}[$__rate_interval]) + rate(%(metrics_prefix)tnt_cpu_system_time{%(filters)s}[$__rate_interval])'
|||, {
metrics_prefix: cfg.metrics_prefix,
filters: common.prometheus_query_filters(cfg.filters),
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your tips!
dashboard/panels/cpu.libsonnet
Outdated
cfg=cfg, | ||
title=title, | ||
description=description, | ||
expr='sum(rate(tnt_cpu_user_time{job=~"$job"}[$__rate_interval])) + sum(rate(tnt_cpu_system_time{job=~"$job"}[$__rate_interval]))', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next, to sum over all instances, we need to exclude alias
filter
std.format(|||
'sum(rate(%(metrics_prefix)tnt_cpu_user_time{%(filters)}[$__rate_interval])) + sum(rate(%(metrics_prefix)tnt_cpu_system_time{%(filters)}[$__rate_interval]))'
|||, {
metrics_prefix: cfg.metrics_prefix,
filters: common.prometheus_query_filters(common.remove_field(cfg.filters, 'alias')),
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot about that. Updated.
Is it possible to sum system and user time for cpu graphs by thread? |
fd41f66
to
4bfde95
Compare
Yes, all required metrics are provided by |
4bfde95
to
bc4b63e
Compare
This patch adds `CPU/memory/virtual memory` utilization panels per instance and total. Closes #TNTP-4365
bc4b63e
to
d1d8047
Compare
This patch adds
CPU/memory/virtual memory
utilization panels per instance and total.Closes #TNTP-4365