Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/integrations/process_exporter/process-exporter.go
5332 views
1
//go:build !linux
2
3
// Package process_exporter embeds https://github.com/ncabatoff/process-exporter
4
package process_exporter //nolint:golint
5
6
import (
7
"context"
8
"net/http"
9
10
"github.com/go-kit/log"
11
"github.com/go-kit/log/level"
12
"github.com/grafana/agent/pkg/integrations/config"
13
)
14
15
// Integration is the process_exporter integration. On non-Linux platforms,
16
// this integration does nothing and will print a warning if enabled.
17
type Integration struct {
18
c *Config
19
}
20
21
// New creates a process_exporter integration for non-Linux platforms, which is always a
22
// no-op.
23
func New(logger log.Logger, c *Config) (*Integration, error) {
24
level.Warn(logger).Log("msg", "the process_exporter only works on Linux; enabling it otherwise will do nothing")
25
return &Integration{c: c}, nil
26
}
27
28
// MetricsHandler satisfies Integration.RegisterRoutes.
29
func (i *Integration) MetricsHandler() (http.Handler, error) {
30
return http.NotFoundHandler(), nil
31
}
32
33
// ScrapeConfigs satisfies Integration.ScrapeConfigs.
34
func (i *Integration) ScrapeConfigs() []config.ScrapeConfig {
35
// No-op: nothing to scrape.
36
return []config.ScrapeConfig{}
37
}
38
39
// Run satisfies Integration.Run.
40
func (i *Integration) Run(ctx context.Context) error {
41
// We don't need to do anything here, so we can just wait for the context to
42
// finish.
43
<-ctx.Done()
44
return ctx.Err()
45
}
46
47