Path: blob/main/pkg/integrations/process_exporter/process-exporter.go
5332 views
//go:build !linux12// Package process_exporter embeds https://github.com/ncabatoff/process-exporter3package process_exporter //nolint:golint45import (6"context"7"net/http"89"github.com/go-kit/log"10"github.com/go-kit/log/level"11"github.com/grafana/agent/pkg/integrations/config"12)1314// Integration is the process_exporter integration. On non-Linux platforms,15// this integration does nothing and will print a warning if enabled.16type Integration struct {17c *Config18}1920// New creates a process_exporter integration for non-Linux platforms, which is always a21// no-op.22func New(logger log.Logger, c *Config) (*Integration, error) {23level.Warn(logger).Log("msg", "the process_exporter only works on Linux; enabling it otherwise will do nothing")24return &Integration{c: c}, nil25}2627// MetricsHandler satisfies Integration.RegisterRoutes.28func (i *Integration) MetricsHandler() (http.Handler, error) {29return http.NotFoundHandler(), nil30}3132// ScrapeConfigs satisfies Integration.ScrapeConfigs.33func (i *Integration) ScrapeConfigs() []config.ScrapeConfig {34// No-op: nothing to scrape.35return []config.ScrapeConfig{}36}3738// Run satisfies Integration.Run.39func (i *Integration) Run(ctx context.Context) error {40// We don't need to do anything here, so we can just wait for the context to41// finish.42<-ctx.Done()43return ctx.Err()44}454647