Skip to content
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

Docker mixin: Adds root cgroup filter to filter out root cgroup stats #1316

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docker-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
uid: 'integration-docker',
// ignore k8s nodes by default
filteringSelector: 'job!="kubelet"',


containerSelector: 'id=~"/system.slice/docker.+", name!=""',
//signals related
groupLabels: ['job'],
// host level
Expand Down
2 changes: 1 addition & 1 deletion docker-mixin/signals/container.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local commonlib = import './common-lib/common/main.libsonnet';
function(this)
{
local s = self,
filteringSelector: this.filteringSelector,
filteringSelector: this.filteringSelector + ', ' + this.containerSelector,
groupLabels: this.groupLabels,
instanceLabels: this.instanceLabels + s.legendLabels,
legendLabels: ['name'],
Expand Down
18 changes: 9 additions & 9 deletions docker-mixin/signals/machine.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function(this)
type: 'raw',
sources: {
cadvisor: {
expr: 'count(container_last_seen{%(queriesSelector)s})',
expr: 'count(container_last_seen{%%(queriesSelector)s, %(containerSelector)s})' % { containerSelector: this.containerSelector },
},
},
},
Expand All @@ -28,7 +28,7 @@ function(this)
type: 'raw',
sources: {
cadvisor: {
expr: 'count (sum by (image) (container_last_seen{%(queriesSelector)s}))',
expr: 'count (sum by (image) (container_last_seen{%%(queriesSelector)s, %(containerSelector)s}))' % { containerSelector: this.containerSelector },
},
},
},
Expand All @@ -42,13 +42,13 @@ function(this)
cadvisor: {
expr: |||
sum(
container_spec_memory_reservation_limit_bytes{%(queriesSelector)s}
container_spec_memory_reservation_limit_bytes{%%(queriesSelector)s, %(containerSelector)s}
)
/
avg(
machine_memory_bytes{%(queriesSelector)s}
machine_memory_bytes{%%(queriesSelector)s}
) * 100
|||,
||| % { containerSelector: this.containerSelector },
},
},
},
Expand All @@ -61,11 +61,11 @@ function(this)
cadvisor: {
expr: |||
avg(
sum by (instance) (container_memory_usage_bytes{%(queriesSelector)s})
sum by (instance) (container_memory_usage_bytes{%%(queriesSelector)s, %(containerSelector)s})
/
avg by (instance) (machine_memory_bytes{%(queriesSelector)s})
avg by (instance) (machine_memory_bytes{%%(queriesSelector)s})
) * 100
|||,
||| % { containerSelector: this.containerSelector },
},
},
},
Expand All @@ -76,7 +76,7 @@ function(this)
unit: 'percent',
sources: {
cadvisor: {
expr: 'avg by (%(agg)s, name) (rate(container_cpu_usage_seconds_total{%(queriesSelector)s}[$__rate_interval])) * 100',
expr: 'avg by (%%(agg)s, name) (rate(container_cpu_usage_seconds_total{%%(queriesSelector)s, %(containerSelector)s}[$__rate_interval])) * 100' % { containerSelector: this.containerSelector },
legendCustomTemplate: commonlib.utils.labelsToPanelLegend(this.instanceLabels),
},
},
Expand Down
Loading