Path: blob/main/pkg/integrations/process_exporter/config.go
5333 views
// Package process_exporter embeds https://github.com/ncabatoff/process-exporter1package process_exporter //nolint:golint23import (4"github.com/go-kit/log"5"github.com/grafana/agent/pkg/integrations"6integrations_v2 "github.com/grafana/agent/pkg/integrations/v2"7"github.com/grafana/agent/pkg/integrations/v2/metricsutils"89exporter_config "github.com/ncabatoff/process-exporter/config"10)1112// DefaultConfig holds the default settings for the process_exporter integration.13var DefaultConfig = Config{14ProcFSPath: "/proc",15Children: true,16Threads: true,17SMaps: true,18Recheck: false,19}2021// Config controls the process_exporter integration.22type Config struct {23ProcessExporter exporter_config.MatcherRules `yaml:"process_names,omitempty"`2425ProcFSPath string `yaml:"procfs_path,omitempty"`26Children bool `yaml:"track_children,omitempty"`27Threads bool `yaml:"track_threads,omitempty"`28SMaps bool `yaml:"gather_smaps,omitempty"`29Recheck bool `yaml:"recheck_on_scrape,omitempty"`30}3132// UnmarshalYAML implements yaml.Unmarshaler.33func (c *Config) UnmarshalYAML(unmarshal func(v interface{}) error) error {34*c = DefaultConfig3536type plain Config37return unmarshal((*plain)(c))38}3940// Name returns the name of the integration that this config represents.41func (c *Config) Name() string {42return "process_exporter"43}4445// InstanceKey returns the hostname of the machine.46func (c *Config) InstanceKey(agentKey string) (string, error) {47return agentKey, nil48}4950// NewIntegration converts this config into an instance of an integration.51func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error) {52return New(l, c)53}5455func init() {56integrations.RegisterIntegration(&Config{})57integrations_v2.RegisterLegacy(&Config{}, integrations_v2.TypeSingleton, metricsutils.NewNamedShim("process"))58}596061