Skip to content

Commit

Permalink
add LIBBEAT_MONITORING_CGROUPS_HIERARCHY_OVERRIDE to system/process (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry authored Sep 2, 2021
1 parent 547299e commit 75b1ff7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions metricbeat/module/system/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package process

import (
"fmt"
"os"
"runtime"

"github.com/pkg/errors"
Expand Down Expand Up @@ -90,6 +91,15 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
perCPU: config.IncludePerCPU,
IsAgent: systemModule.IsAgent,
}

// If hostfs is set, we may not want to force the hierarchy override, as the user could be expecting a custom path.
if len(paths.Paths.Hostfs) < 2 {
override, isset := os.LookupEnv("LIBBEAT_MONITORING_CGROUPS_HIERARCHY_OVERRIDE")
if isset {
m.stats.CgroupOpts.CgroupsHierarchyOverride = override
}
}

err := m.stats.Init()
if err != nil {
return nil, err
Expand Down

0 comments on commit 75b1ff7

Please sign in to comment.