Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTargetAddress(address model.LabelValue) error
- func GenerateChecksum(yamlFilePath string) (string, error)
- type AlertingConfig
- type AlertmanagerAPIVersion
- type AlertmanagerConfig
- type AlertmanagerConfigs
- type Config
- type ExemplarsConfig
- type ExternalFilesConfig
- type GlobalConfig
- type MetadataConfig
- type OTLPConfig
- type QueueConfig
- type RemoteReadConfig
- type RemoteWriteConfig
- type RemoteWriteProtoMsg
- type RemoteWriteProtoMsgs
- type RuntimeConfig
- type ScrapeConfig
- type ScrapeConfigs
- type ScrapeProtocol
- type StorageConfig
- type TSDBConfig
- type TracingClientType
- type TracingConfig
Constants ¶
const ( LegacyValidationConfig = "legacy" UTF8ValidationConfig = "utf8" )
const ( // DefaultChunkedReadLimit is the default value for the maximum size of the protobuf frame client allows. // 50MB is the default. This is equivalent to ~100k full XOR chunks and average labelset. DefaultChunkedReadLimit = 5e+7 )
Variables ¶
var ( // DefaultConfig is the default top-level configuration. DefaultConfig = Config{ GlobalConfig: DefaultGlobalConfig, } // DefaultGlobalConfig is the default global configuration. DefaultGlobalConfig = GlobalConfig{ ScrapeInterval: model.Duration(1 * time.Minute), ScrapeTimeout: model.Duration(10 * time.Second), EvaluationInterval: model.Duration(1 * time.Minute), RuleQueryOffset: model.Duration(0 * time.Minute), ScrapeProtocols: DefaultScrapeProtocols, } DefaultRuntimeConfig = RuntimeConfig{ GoGC: 75, } // DefaultScrapeConfig is the default scrape configuration. DefaultScrapeConfig = ScrapeConfig{ AlwaysScrapeClassicHistograms: false, MetricsPath: "/metrics", Scheme: "http", HonorLabels: false, HonorTimestamps: true, HTTPClientConfig: config.DefaultHTTPClientConfig, EnableCompression: true, } // DefaultAlertmanagerConfig is the default alertmanager configuration. DefaultAlertmanagerConfig = AlertmanagerConfig{ Scheme: "http", Timeout: model.Duration(10 * time.Second), APIVersion: AlertmanagerAPIVersionV2, HTTPClientConfig: config.DefaultHTTPClientConfig, } DefaultRemoteWriteHTTPClientConfig = config.HTTPClientConfig{ FollowRedirects: true, EnableHTTP2: false, } // DefaultRemoteWriteConfig is the default remote write configuration. DefaultRemoteWriteConfig = RemoteWriteConfig{ RemoteTimeout: model.Duration(30 * time.Second), ProtobufMessage: RemoteWriteProtoMsgV1, QueueConfig: DefaultQueueConfig, MetadataConfig: DefaultMetadataConfig, HTTPClientConfig: DefaultRemoteWriteHTTPClientConfig, } // DefaultQueueConfig is the default remote queue configuration. DefaultQueueConfig = QueueConfig{ MaxShards: 50, MinShards: 1, MaxSamplesPerSend: 2000, Capacity: 10000, BatchSendDeadline: model.Duration(5 * time.Second), MinBackoff: model.Duration(30 * time.Millisecond), MaxBackoff: model.Duration(5 * time.Second), } // DefaultMetadataConfig is the default metadata configuration for a remote write endpoint. DefaultMetadataConfig = MetadataConfig{ Send: true, SendInterval: model.Duration(1 * time.Minute), MaxSamplesPerSend: 2000, } // DefaultRemoteReadConfig is the default remote read configuration. DefaultRemoteReadConfig = RemoteReadConfig{ RemoteTimeout: model.Duration(1 * time.Minute), ChunkedReadLimit: DefaultChunkedReadLimit, HTTPClientConfig: config.DefaultHTTPClientConfig, FilterExternalLabels: true, } // DefaultStorageConfig is the default TSDB/Exemplar storage configuration. DefaultStorageConfig = StorageConfig{ ExemplarsConfig: &DefaultExemplarsConfig, } DefaultExemplarsConfig = ExemplarsConfig{ MaxExemplars: 100000, } // DefaultOTLPConfig is the default OTLP configuration. DefaultOTLPConfig = OTLPConfig{ TranslationStrategy: UnderscoreEscapingWithSuffixes, } )
The defaults applied before parsing the respective config sections.
var ( PrometheusProto ScrapeProtocol = "PrometheusProto" PrometheusText0_0_4 ScrapeProtocol = "PrometheusText0.0.4" PrometheusText1_0_0 ScrapeProtocol = "PrometheusText1.0.0" OpenMetricsText0_0_1 ScrapeProtocol = "OpenMetricsText0.0.1" OpenMetricsText1_0_0 ScrapeProtocol = "OpenMetricsText1.0.0" UTF8NamesHeader string = model.EscapingKey + "=" + model.AllowUTF8 ScrapeProtocolsHeaders = map[ScrapeProtocol]string{ PrometheusProto: "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited", PrometheusText0_0_4: "text/plain;version=0.0.4", PrometheusText1_0_0: "text/plain;version=1.0.0;escaping=allow-utf-8", OpenMetricsText0_0_1: "application/openmetrics-text;version=0.0.1", OpenMetricsText1_0_0: "application/openmetrics-text;version=1.0.0", } // DefaultScrapeProtocols is the set of scrape protocols that will be proposed // to scrape target, ordered by priority. DefaultScrapeProtocols = []ScrapeProtocol{ OpenMetricsText1_0_0, OpenMetricsText0_0_1, PrometheusText1_0_0, PrometheusText0_0_4, } // DefaultProtoFirstScrapeProtocols is like DefaultScrapeProtocols, but it // favors protobuf Prometheus exposition format. // Used by default for certain feature-flags like // "native-histograms" and "created-timestamp-zero-ingestion". DefaultProtoFirstScrapeProtocols = []ScrapeProtocol{ PrometheusProto, OpenMetricsText1_0_0, OpenMetricsText0_0_1, PrometheusText1_0_0, PrometheusText0_0_4, } )
var ( // NoUTF8EscapingWithSuffixes will accept metric/label names as they are. // Unit and type suffixes may be added to metric names, according to certain rules. NoUTF8EscapingWithSuffixes translationStrategyOption = "NoUTF8EscapingWithSuffixes" // UnderscoreEscapingWithSuffixes is the default option for translating OTLP to Prometheus. // This option will translate metric name characters that are not alphanumerics/underscores/colons to underscores, // and label name characters that are not alphanumerics/underscores to underscores. // Unit and type suffixes may be appended to metric names, according to certain rules. UnderscoreEscapingWithSuffixes translationStrategyOption = "UnderscoreEscapingWithSuffixes" )
var SupportedAlertmanagerAPIVersions = []AlertmanagerAPIVersion{ AlertmanagerAPIVersionV2, }
Functions ¶
func CheckTargetAddress ¶
func CheckTargetAddress(address model.LabelValue) error
CheckTargetAddress checks if target address is valid.
func GenerateChecksum ¶ added in v0.300.0
GenerateChecksum generates a checksum of the YAML file and the files it references.
Types ¶
type AlertingConfig ¶
type AlertingConfig struct { AlertRelabelConfigs []*relabel.Config `yaml:"alert_relabel_configs,omitempty"` AlertmanagerConfigs AlertmanagerConfigs `yaml:"alertmanagers,omitempty"` }
AlertingConfig configures alerting and alertmanager related configs.
func (*AlertingConfig) SetDirectory ¶
func (c *AlertingConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*AlertingConfig) UnmarshalYAML ¶
func (c *AlertingConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type AlertmanagerAPIVersion ¶
type AlertmanagerAPIVersion string
AlertmanagerAPIVersion represents a version of the github.com/prometheus/alertmanager/api, e.g. 'v1' or 'v2'. 'v1' is no longer supported.
const ( // AlertmanagerAPIVersionV1 represents // github.com/prometheus/alertmanager/api/v1. AlertmanagerAPIVersionV1 AlertmanagerAPIVersion = "v1" // AlertmanagerAPIVersionV2 represents // github.com/prometheus/alertmanager/api/v2. AlertmanagerAPIVersionV2 AlertmanagerAPIVersion = "v2" )
func (*AlertmanagerAPIVersion) UnmarshalYAML ¶
func (v *AlertmanagerAPIVersion) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type AlertmanagerConfig ¶
type AlertmanagerConfig struct { ServiceDiscoveryConfigs discovery.Configs `yaml:"-"` HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` SigV4Config *sigv4.SigV4Config `yaml:"sigv4,omitempty"` // The URL scheme to use when talking to Alertmanagers. Scheme string `yaml:"scheme,omitempty"` // Path prefix to add in front of the push endpoint path. PathPrefix string `yaml:"path_prefix,omitempty"` // The timeout used when sending alerts. Timeout model.Duration `yaml:"timeout,omitempty"` // The api version of Alertmanager. APIVersion AlertmanagerAPIVersion `yaml:"api_version"` // List of Alertmanager relabel configurations. RelabelConfigs []*relabel.Config `yaml:"relabel_configs,omitempty"` // Relabel alerts before sending to the specific alertmanager. AlertRelabelConfigs []*relabel.Config `yaml:"alert_relabel_configs,omitempty"` }
AlertmanagerConfig configures how Alertmanagers can be discovered and communicated with.
func (*AlertmanagerConfig) MarshalYAML ¶
func (c *AlertmanagerConfig) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (*AlertmanagerConfig) SetDirectory ¶
func (c *AlertmanagerConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*AlertmanagerConfig) UnmarshalYAML ¶
func (c *AlertmanagerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type AlertmanagerConfigs ¶
type AlertmanagerConfigs []*AlertmanagerConfig
AlertmanagerConfigs is a slice of *AlertmanagerConfig.
func (AlertmanagerConfigs) ToMap ¶
func (a AlertmanagerConfigs) ToMap() map[string]*AlertmanagerConfig
ToMap converts a slice of *AlertmanagerConfig to a map.
type Config ¶
type Config struct { GlobalConfig GlobalConfig `yaml:"global"` Runtime RuntimeConfig `yaml:"runtime,omitempty"` AlertingConfig AlertingConfig `yaml:"alerting,omitempty"` RuleFiles []string `yaml:"rule_files,omitempty"` ScrapeConfigFiles []string `yaml:"scrape_config_files,omitempty"` ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"` StorageConfig StorageConfig `yaml:"storage,omitempty"` TracingConfig TracingConfig `yaml:"tracing,omitempty"` RemoteWriteConfigs []*RemoteWriteConfig `yaml:"remote_write,omitempty"` RemoteReadConfigs []*RemoteReadConfig `yaml:"remote_read,omitempty"` OTLPConfig OTLPConfig `yaml:"otlp,omitempty"` // contains filtered or unexported fields }
Config is the top-level configuration for Prometheus's config files.
func LoadFile ¶
LoadFile parses and validates the given YAML file into a read-only Config. Callers should never write to or shallow copy the returned Config.
func (*Config) GetScrapeConfigs ¶ added in v0.43.0
func (c *Config) GetScrapeConfigs() ([]*ScrapeConfig, error)
GetScrapeConfigs returns the read-only, validated scrape configurations including the ones from the scrape_config_files. This method does not write to config, and it's concurrency safe (the pointer receiver is for efficiency). This method also assumes the Config was created by Load or LoadFile function, it returns error if it was not. We can't re-validate or apply globals here due to races, read more https://github.com/prometheus/prometheus/issues/15538.
func (*Config) SetDirectory ¶
SetDirectory joins any relative file paths with dir. This method writes to config, and it's not concurrency safe.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface. NOTE: This method should not be used outside of this package. Use Load or LoadFile instead.
type ExemplarsConfig ¶
type ExemplarsConfig struct { // MaxExemplars sets the size, in # of exemplars stored, of the single circular buffer used to store exemplars in memory. // Use a value of 0 or less than 0 to disable the storage without having to restart Prometheus. MaxExemplars int64 `yaml:"max_exemplars,omitempty"` }
ExemplarsConfig configures runtime reloadable configuration options.
type ExternalFilesConfig ¶ added in v0.300.0
type GlobalConfig ¶
type GlobalConfig struct { // How frequently to scrape targets by default. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // The default timeout when scraping targets. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // The protocols to negotiate during a scrape. It tells clients what // protocol are accepted by Prometheus and with what weight (most wanted is first). // Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1, // OpenMetricsText1.0.0, PrometheusText0.0.4. ScrapeProtocols []ScrapeProtocol `yaml:"scrape_protocols,omitempty"` // How frequently to evaluate rules by default. EvaluationInterval model.Duration `yaml:"evaluation_interval,omitempty"` // Offset the rule evaluation timestamp of this particular group by the specified duration into the past to ensure the underlying metrics have been received. RuleQueryOffset model.Duration `yaml:"rule_query_offset,omitempty"` // File to which PromQL queries are logged. QueryLogFile string `yaml:"query_log_file,omitempty"` // File to which scrape failures are logged. ScrapeFailureLogFile string `yaml:"scrape_failure_log_file,omitempty"` // The labels to add to any timeseries that this Prometheus instance scrapes. ExternalLabels labels.Labels `yaml:"external_labels,omitempty"` // An uncompressed response body larger than this many bytes will cause the // scrape to fail. 0 means no limit. BodySizeLimit units.Base2Bytes `yaml:"body_size_limit,omitempty"` // More than this many samples post metric-relabeling will cause the scrape to // fail. 0 means no limit. SampleLimit uint `yaml:"sample_limit,omitempty"` // More than this many targets after the target relabeling will cause the // scrapes to fail. 0 means no limit. TargetLimit uint `yaml:"target_limit,omitempty"` // More than this many labels post metric-relabeling will cause the scrape to // fail. 0 means no limit. LabelLimit uint `yaml:"label_limit,omitempty"` // More than this label name length post metric-relabeling will cause the // scrape to fail. 0 means no limit. LabelNameLengthLimit uint `yaml:"label_name_length_limit,omitempty"` // More than this label value length post metric-relabeling will cause the // scrape to fail. 0 means no limit. LabelValueLengthLimit uint `yaml:"label_value_length_limit,omitempty"` // Keep no more than this many dropped targets per job. // 0 means no limit. KeepDroppedTargets uint `yaml:"keep_dropped_targets,omitempty"` // Allow UTF8 Metric and Label Names. MetricNameValidationScheme string `yaml:"metric_name_validation_scheme,omitempty"` }
GlobalConfig configures values that are used across other configuration objects.
func (*GlobalConfig) SetDirectory ¶
func (c *GlobalConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*GlobalConfig) UnmarshalYAML ¶
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type MetadataConfig ¶
type MetadataConfig struct { // Send controls whether we send metric metadata to remote storage. Send bool `yaml:"send"` // SendInterval controls how frequently we send metric metadata. SendInterval model.Duration `yaml:"send_interval"` // Maximum number of samples per send. MaxSamplesPerSend int `yaml:"max_samples_per_send,omitempty"` }
MetadataConfig is the configuration for sending metadata to remote storage.
type OTLPConfig ¶ added in v0.55.0
type OTLPConfig struct { PromoteResourceAttributes []string `yaml:"promote_resource_attributes,omitempty"` TranslationStrategy translationStrategyOption `yaml:"translation_strategy,omitempty"` KeepIdentifyingResourceAttributes bool `yaml:"keep_identifying_resource_attributes,omitempty"` }
OTLPConfig is the configuration for writing to the OTLP endpoint.
func (*OTLPConfig) UnmarshalYAML ¶ added in v0.55.0
func (c *OTLPConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type QueueConfig ¶
type QueueConfig struct { // Number of samples to buffer per shard before we block. Defaults to // MaxSamplesPerSend. Capacity int `yaml:"capacity,omitempty"` // Max number of shards, i.e. amount of concurrency. MaxShards int `yaml:"max_shards,omitempty"` // Min number of shards, i.e. amount of concurrency. MinShards int `yaml:"min_shards,omitempty"` // Maximum number of samples per send. MaxSamplesPerSend int `yaml:"max_samples_per_send,omitempty"` // Maximum time sample will wait in buffer. BatchSendDeadline model.Duration `yaml:"batch_send_deadline,omitempty"` // On recoverable errors, backoff exponentially. MinBackoff model.Duration `yaml:"min_backoff,omitempty"` MaxBackoff model.Duration `yaml:"max_backoff,omitempty"` RetryOnRateLimit bool `yaml:"retry_on_http_429,omitempty"` // Samples older than the limit will be dropped. SampleAgeLimit model.Duration `yaml:"sample_age_limit,omitempty"` }
QueueConfig is the configuration for the queue used to write to remote storage.
type RemoteReadConfig ¶
type RemoteReadConfig struct { URL *config.URL `yaml:"url"` RemoteTimeout model.Duration `yaml:"remote_timeout,omitempty"` ChunkedReadLimit uint64 `yaml:"chunked_read_limit,omitempty"` Headers map[string]string `yaml:"headers,omitempty"` ReadRecent bool `yaml:"read_recent,omitempty"` Name string `yaml:"name,omitempty"` // We cannot do proper Go type embedding below as the parser will then parse // values arbitrarily into the overflow maps of further-down types. HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` // RequiredMatchers is an optional list of equality matchers which have to // be present in a selector to query the remote read endpoint. RequiredMatchers model.LabelSet `yaml:"required_matchers,omitempty"` // Whether to use the external labels as selectors for the remote read endpoint. FilterExternalLabels bool `yaml:"filter_external_labels,omitempty"` }
RemoteReadConfig is the configuration for reading from remote storage.
func (*RemoteReadConfig) SetDirectory ¶
func (c *RemoteReadConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*RemoteReadConfig) UnmarshalYAML ¶
func (c *RemoteReadConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RemoteWriteConfig ¶
type RemoteWriteConfig struct { URL *config.URL `yaml:"url"` RemoteTimeout model.Duration `yaml:"remote_timeout,omitempty"` Headers map[string]string `yaml:"headers,omitempty"` WriteRelabelConfigs []*relabel.Config `yaml:"write_relabel_configs,omitempty"` Name string `yaml:"name,omitempty"` SendExemplars bool `yaml:"send_exemplars,omitempty"` SendNativeHistograms bool `yaml:"send_native_histograms,omitempty"` RoundRobinDNS bool `yaml:"round_robin_dns,omitempty"` // ProtobufMessage specifies the protobuf message to use against the remote // receiver as specified in https://prometheus.io/docs/specs/remote_write_spec_2_0/ ProtobufMessage RemoteWriteProtoMsg `yaml:"protobuf_message,omitempty"` // We cannot do proper Go type embedding below as the parser will then parse // values arbitrarily into the overflow maps of further-down types. HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` QueueConfig QueueConfig `yaml:"queue_config,omitempty"` MetadataConfig MetadataConfig `yaml:"metadata_config,omitempty"` SigV4Config *sigv4.SigV4Config `yaml:"sigv4,omitempty"` AzureADConfig *azuread.AzureADConfig `yaml:"azuread,omitempty"` GoogleIAMConfig *googleiam.Config `yaml:"google_iam,omitempty"` }
RemoteWriteConfig is the configuration for writing to remote storage.
func (*RemoteWriteConfig) SetDirectory ¶
func (c *RemoteWriteConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*RemoteWriteConfig) UnmarshalYAML ¶
func (c *RemoteWriteConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RemoteWriteProtoMsg ¶ added in v0.54.0
type RemoteWriteProtoMsg string
RemoteWriteProtoMsg represents the known protobuf message for the remote write 1.0 and 2.0 specs.
var ( // RemoteWriteProtoMsgV1 represents the `prometheus.WriteRequest` protobuf // message introduced in the https://prometheus.io/docs/specs/remote_write_spec/, // which will eventually be deprecated. // // NOTE: This string is used for both HTTP header values and config value, so don't change // this reference. RemoteWriteProtoMsgV1 RemoteWriteProtoMsg = "prometheus.WriteRequest" // RemoteWriteProtoMsgV2 represents the `io.prometheus.write.v2.Request` protobuf // message introduced in https://prometheus.io/docs/specs/remote_write_spec_2_0/ // // NOTE: This string is used for both HTTP header values and config value, so don't change // this reference. RemoteWriteProtoMsgV2 RemoteWriteProtoMsg = "io.prometheus.write.v2.Request" )
func (RemoteWriteProtoMsg) Validate ¶ added in v0.54.0
func (s RemoteWriteProtoMsg) Validate() error
Validate returns error if the given reference for the protobuf message is not supported.
type RemoteWriteProtoMsgs ¶ added in v0.54.0
type RemoteWriteProtoMsgs []RemoteWriteProtoMsg
func (RemoteWriteProtoMsgs) String ¶ added in v0.54.0
func (m RemoteWriteProtoMsgs) String() string
func (RemoteWriteProtoMsgs) Strings ¶ added in v0.54.0
func (m RemoteWriteProtoMsgs) Strings() []string
type RuntimeConfig ¶ added in v0.53.0
type RuntimeConfig struct { // The Go garbage collection target percentage. GoGC int `yaml:"gogc,omitempty"` }
RuntimeConfig configures the values for the process behavior.
type ScrapeConfig ¶
type ScrapeConfig struct { // The job name to which the job label is set by default. JobName string `yaml:"job_name"` // Indicator whether the scraped metrics should remain unmodified. HonorLabels bool `yaml:"honor_labels,omitempty"` // Indicator whether the scraped timestamps should be respected. HonorTimestamps bool `yaml:"honor_timestamps"` // Indicator whether to track the staleness of the scraped timestamps. TrackTimestampsStaleness bool `yaml:"track_timestamps_staleness"` // A set of query parameters with which the target is scraped. Params url.Values `yaml:"params,omitempty"` // How frequently to scrape the targets of this scrape config. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // The timeout for scraping targets of this config. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // The protocols to negotiate during a scrape. It tells clients what // protocol are accepted by Prometheus and with what preference (most wanted is first). // Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1, // OpenMetricsText1.0.0, PrometheusText1.0.0, PrometheusText0.0.4. ScrapeProtocols []ScrapeProtocol `yaml:"scrape_protocols,omitempty"` // The fallback protocol to use if the Content-Type provided by the target // is not provided, blank, or not one of the expected values. // Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1, // OpenMetricsText1.0.0, PrometheusText1.0.0, PrometheusText0.0.4. ScrapeFallbackProtocol ScrapeProtocol `yaml:"fallback_scrape_protocol,omitempty"` // Whether to scrape a classic histogram, even if it is also exposed as a native histogram. AlwaysScrapeClassicHistograms bool `yaml:"always_scrape_classic_histograms,omitempty"` // Whether to convert all scraped classic histograms into a native histogram with custom buckets. ConvertClassicHistogramsToNHCB bool `yaml:"convert_classic_histograms_to_nhcb,omitempty"` // File to which scrape failures are logged. ScrapeFailureLogFile string `yaml:"scrape_failure_log_file,omitempty"` // The HTTP resource path on which to fetch metrics from targets. MetricsPath string `yaml:"metrics_path,omitempty"` // The URL scheme with which to fetch metrics from targets. Scheme string `yaml:"scheme,omitempty"` // Indicator whether to request compressed response from the target. EnableCompression bool `yaml:"enable_compression"` // An uncompressed response body larger than this many bytes will cause the // scrape to fail. 0 means no limit. BodySizeLimit units.Base2Bytes `yaml:"body_size_limit,omitempty"` // More than this many samples post metric-relabeling will cause the scrape to // fail. 0 means no limit. SampleLimit uint `yaml:"sample_limit,omitempty"` // More than this many targets after the target relabeling will cause the // scrapes to fail. 0 means no limit. TargetLimit uint `yaml:"target_limit,omitempty"` // More than this many labels post metric-relabeling will cause the scrape to // fail. 0 means no limit. LabelLimit uint `yaml:"label_limit,omitempty"` // More than this label name length post metric-relabeling will cause the // scrape to fail. 0 means no limit. LabelNameLengthLimit uint `yaml:"label_name_length_limit,omitempty"` // More than this label value length post metric-relabeling will cause the // scrape to fail. 0 means no limit. LabelValueLengthLimit uint `yaml:"label_value_length_limit,omitempty"` // If there are more than this many buckets in a native histogram, // buckets will be merged to stay within the limit. NativeHistogramBucketLimit uint `yaml:"native_histogram_bucket_limit,omitempty"` // If the growth factor of one bucket to the next is smaller than this, // buckets will be merged to increase the factor sufficiently. NativeHistogramMinBucketFactor float64 `yaml:"native_histogram_min_bucket_factor,omitempty"` // Keep no more than this many dropped targets per job. // 0 means no limit. KeepDroppedTargets uint `yaml:"keep_dropped_targets,omitempty"` // Allow UTF8 Metric and Label Names. MetricNameValidationScheme string `yaml:"metric_name_validation_scheme,omitempty"` ServiceDiscoveryConfigs discovery.Configs `yaml:"-"` HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` // List of target relabel configurations. RelabelConfigs []*relabel.Config `yaml:"relabel_configs,omitempty"` // List of metric relabel configurations. MetricRelabelConfigs []*relabel.Config `yaml:"metric_relabel_configs,omitempty"` }
ScrapeConfig configures a scraping unit for Prometheus.
func (*ScrapeConfig) MarshalYAML ¶
func (c *ScrapeConfig) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (*ScrapeConfig) SetDirectory ¶
func (c *ScrapeConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*ScrapeConfig) UnmarshalYAML ¶
func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
func (*ScrapeConfig) Validate ¶ added in v0.43.0
func (c *ScrapeConfig) Validate(globalConfig GlobalConfig) error
Validate validates scrape config, but also fills relevant default values from global config if needed.
type ScrapeConfigs ¶ added in v0.43.0
type ScrapeConfigs struct {
ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"`
}
type ScrapeProtocol ¶ added in v0.49.0
type ScrapeProtocol string
ScrapeProtocol represents supported protocol for scraping metrics.
func (ScrapeProtocol) HeaderMediaType ¶ added in v0.300.0
func (s ScrapeProtocol) HeaderMediaType() string
HeaderMediaType returns the MIME mediaType for a particular ScrapeProtocol.
func (ScrapeProtocol) Validate ¶ added in v0.49.0
func (s ScrapeProtocol) Validate() error
Validate returns error if given scrape protocol is not supported.
type StorageConfig ¶
type StorageConfig struct { TSDBConfig *TSDBConfig `yaml:"tsdb,omitempty"` ExemplarsConfig *ExemplarsConfig `yaml:"exemplars,omitempty"` }
StorageConfig configures runtime reloadable configuration options.
type TSDBConfig ¶ added in v0.39.0
type TSDBConfig struct { // OutOfOrderTimeWindow sets how long back in time an out-of-order sample can be inserted // into the TSDB. This flag is typically set while unmarshaling the configuration file and translating // OutOfOrderTimeWindowFlag's duration. The unit of this flag is expected to be the same as any // other timestamp in the TSDB. OutOfOrderTimeWindow int64 // OutOfOrderTimeWindowFlag holds the parsed duration from the config file. // During unmarshall, this is converted into milliseconds and stored in OutOfOrderTimeWindow. // This should not be used directly and must be converted into OutOfOrderTimeWindow. OutOfOrderTimeWindowFlag model.Duration `yaml:"out_of_order_time_window,omitempty"` }
TSDBConfig configures runtime reloadable configuration options.
func (*TSDBConfig) UnmarshalYAML ¶ added in v0.39.0
func (t *TSDBConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type TracingClientType ¶
type TracingClientType string
const ( TracingClientHTTP TracingClientType = "http" TracingClientGRPC TracingClientType = "grpc" GzipCompression = "gzip" )
func (*TracingClientType) UnmarshalYAML ¶
func (t *TracingClientType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type TracingConfig ¶
type TracingConfig struct { ClientType TracingClientType `yaml:"client_type,omitempty"` Endpoint string `yaml:"endpoint,omitempty"` SamplingFraction float64 `yaml:"sampling_fraction,omitempty"` Insecure bool `yaml:"insecure,omitempty"` TLSConfig config.TLSConfig `yaml:"tls_config,omitempty"` Headers map[string]string `yaml:"headers,omitempty"` Compression string `yaml:"compression,omitempty"` Timeout model.Duration `yaml:"timeout,omitempty"` }
TracingConfig configures the tracing options.
func (*TracingConfig) SetDirectory ¶
func (t *TracingConfig) SetDirectory(dir string)
SetDirectory joins any relative file paths with dir.
func (*TracingConfig) UnmarshalYAML ¶
func (t *TracingConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.