Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/integrations/config/config.go
5340 views
1
// Package config provides common configuration structs shared among
2
// implementations of integrations.Integration.
3
package config
4
5
import (
6
"net/url"
7
"time"
8
9
"github.com/prometheus/prometheus/model/relabel"
10
)
11
12
// Common is a set of common options shared by all integrations. It should be
13
// utilised by an integration's config by inlining the common options:
14
//
15
// type IntegrationConfig struct {
16
// Common config.Common `yaml:",inline"`
17
// }
18
type Common struct {
19
Enabled bool `yaml:"enabled,omitempty"`
20
InstanceKey *string `yaml:"instance,omitempty"`
21
ScrapeIntegration *bool `yaml:"scrape_integration,omitempty"`
22
ScrapeInterval time.Duration `yaml:"scrape_interval,omitempty"`
23
ScrapeTimeout time.Duration `yaml:"scrape_timeout,omitempty"`
24
RelabelConfigs []*relabel.Config `yaml:"relabel_configs,omitempty"`
25
MetricRelabelConfigs []*relabel.Config `yaml:"metric_relabel_configs,omitempty"`
26
WALTruncateFrequency time.Duration `yaml:"wal_truncate_frequency,omitempty"`
27
}
28
29
// ScrapeConfig is a subset of options used by integrations to inform how samples
30
// should be scraped. It is utilized by the integrations.Manager to define a full
31
// Prometheus-compatible ScrapeConfig.
32
type ScrapeConfig struct {
33
// JobName should be a unique name indicating the collection of samples to be
34
// scraped. It will be prepended by "integrations/" when used by the integrations
35
// manager.
36
JobName string
37
38
// MetricsPath is the path relative to the integration where metrics are exposed.
39
// It should match a route added to the router provided in Integration.RegisterRoutes.
40
// The path will be prepended by "/integrations/<integration name>" when read by
41
// the integrations manager.
42
MetricsPath string
43
44
// QueryParams is a set of query parameters, that if set, will be appended to
45
// MetricsPath and used for scraping the integration's target.
46
QueryParams url.Values
47
}
48
49