Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
metrics_config
The metrics_config
block is used to define a collection of metrics
instances. Each instance defines a collection of Prometheus-compatible
scrape_configs and remote_write rules. Most users will only need to
define one instance.
scraping_service_config
The scraping_service
block configures the
scraping service, an operational
mode where configurations are stored centrally in a KV store and a cluster of
agents distribute discovery and scrape load between nodes.
# Whether to enable scraping service mode. When enabled, local configs
# cannot be used.
[enabled: <boolean> | default = false]
# Note these next 3 configuration options are confusing. Due to backwards compatibility the naming
# is less than ideal.
# How often should the agent manually refresh the configuration. Useful for if KV change
# events are not sent by an agent.
[reshard_interval: <duration> | default = "1m"]
# The timeout for configuration refreshes. This can occur on cluster events or
# on the reshard interval. A timeout of 0 indicates no timeout.
[reshard_timeout: <duration> | default = "30s"]
# The timeout for a cluster reshard events. A timeout of 0 indicates no timeout.
[cluster_reshard_event_timeout: <duration> | default = "30s"]
# Configuration for the KV store to store configurations.
kvstore: <kvstore_config>
# When set, allows configs pushed to the KV store to specify configuration
# fields that can read secrets from files.
#
# This is disabled by default. When enabled, a malicious user can craft an
# instance config that reads arbitrary files on the machine the Agent runs
# on and sends its contents to a specically crafted remote_write endpoint.
#
# If enabled, ensure that no untrusted users have access to the Agent API.
[dangerous_allow_reading_files: <boolean>]
# Configuration for how agents will cluster together.
lifecycler: <lifecycler_config>
kvstore_config
The kvstore_config
block configures the KV store used as storage for
configurations in the scraping service mode.
# Which underlying KV store to use. Can be either consul or etcd
[store: <string> | default = ""]
# Key prefix to store all configurations with. Must end in /.
[prefix: <string> | default = "configurations/"]
# Configuration for a Consul client. Only applies if store
# is "consul"
consul:
# The hostname and port of Consul.
[host: <string> | duration = "localhost:8500"]
# The ACL Token used to interact with Consul.
[acltoken: <string>]
# The HTTP timeout when communicating with Consul
[httpclienttimeout: <duration> | default = 20s]
# Whether or not consistent reads to Consul are enabled.
[consistentreads: <boolean> | default = true]
# Configuration for an ETCD v3 client. Only applies if
# store is "etcd"
etcd:
# The ETCD endpoints to connect to.
endpoints:
- <string>
# The Dial timeout for the ETCD connection.
[dial_tmeout: <duration> | default = 10s]
# The maximum number of retries to do for failed ops to ETCD.
[max_retries: <int> | default = 10]
lifecycler_config
The lifecycler_config
block configures the lifecycler; the component that
Agents use to cluster together.
scraping_service_client_config
The scraping_service_client_config
block configures how clustered Agents will
generate gRPC clients to connect to each other.
grpc_client_config:
# Maximum size in bytes the gRPC client will accept from the connected server.
[max_recv_msg_size: <int> | default = 104857600]
# Maximum size in bytes the gRPC client will sent to the connected server.
[max_send_msg_size: <int> | default = 16777216]
# Whether messages should be gzipped.
[use_gzip_compression: <boolean> | default = false]
# The rate limit for gRPC clients; 0 means no rate limit.
[rate_limit: <float64> | default = 0]
# gRPC burst allowed for rate limits.
[rate_limit_burst: <int> | default = 0]
# Controls if when a rate limit is hit whether the client should
# retry the request.
[backoff_on_ratelimits: <boolean> | default = false]
# Configures the retry backoff when backoff_on_ratelimits is
# true.
backoff_config:
# The minimum delay when backing off.
[min_period: <duration> | default = "100ms"]
# The maximum delay when backing off.
[max_period: <duration> | default = "10s"]
# The number of times to backoff and retry before failing.
[max_retries: <int> | default = 10]
global_config
The global_config
block configures global values for all launched Prometheus
instances.
# How frequently should Prometheus instances scrape.
[scrape_interval: duration | default = "1m"]
# How long to wait before timing out a scrape from a target.
[scrape_timeout: duration | default = "10s"]
# A list of static labels to add for all metrics.
external_labels:
{ <string>: <string> }
# Default set of remote_write endpoints. If an instance doesn't define any
# remote_writes, it will use this list.
remote_write:
- [<remote_write>]
Note: For more information on remote_write, refer to the Prometheus documentation
metrics_instance_config
The metrics_instance_config
block configures an individual metrics
instance, which acts as its own mini Prometheus-compatible agent, though
without support for the TSDB.
Note: More information on the following types can be found on the Prometheus website: