General availability (GA) Open source
Last reviewed: October 19, 2026

prometheus.exporter.redis

The prometheus.exporter.redis component embeds the redis_exporter to collect metrics from a Redis database.

You can specify multiple prometheus.exporter.redis components by giving them different labels.

Usage

Alloy
prometheus.exporter.redis "<LABEL>" {
  redis_addr = "<REDIS_ADDRESS>"
}

Arguments

You can use the following arguments with prometheus.exporter.redis:

NameTypeDescriptionDefaultRequired
redis_addrstringAddress of the Redis instance to connect to, with or without a URI scheme.yes
check_key_groupslist(string)List of Lua regular expressions for grouping keys.no
check_key_groups_batch_sizeintApproximate number of keys to process in each SCAN execution.10000no
check_keyslist(string)List of key-patterns to export value and length/size, searched for with SCAN.no
check_single_keyslist(string)List of single keys to export value and length/size.no
check_single_streamslist(string)List of single streams to export info about streams, groups, and consumers.no
check_streamslist(string)List of stream-patterns to export info about streams, groups, and consumers to search for with SCAN.no
config_commandstringWhat to use for the CONFIG command. Set it to - to skip config metrics extraction."CONFIG"no
connection_timeoutdurationTimeout for the connection to the Redis instance."15s"no
count_keyslist(string)List of key patterns to count, searched for with SCAN.no
export_client_listboolScrape Client List specific metrics.falseno
export_client_portboolInclude the client port when exporting the client list.falseno
export_key_valuesboolExport key values as labels with check_keys or check_single_keys.trueno
incl_system_metricsboolInclude system metrics, for example redis_total_system_memory_bytes.falseno
include_exporter_metricsboolReport metrics about the exporter itself.falseno
is_clusterboolTreat the connection as a Redis cluster.falseno
is_tile38boolScrape Tile38-specific metrics.falseno
max_distinct_key_groupsintThe maximum number of distinct key groups with the most memory utilization to present as distinct metrics per database.100no
namespacestringNamespace for the metrics."redis"no
ping_on_connectboolPing the Redis instance after connecting.falseno
redis_metrics_onlyboolExport only Redis metrics and omit Go process and runtime metrics.falseno
redis_passwordsecretPassword of the Redis instance.no
redis_password_filestringPath of a file containing a password.no
redis_password_map_filestringPath of a JSON file containing a map of Redis URIs to passwords.no
redis_userstringUser name for authentication. Requires Redis 6.0 or later with ACL support.no
script_pathstringPath to Lua Redis script for collecting extra metrics.no
script_pathslist(string)List of paths to Lua Redis scripts for collecting extra metrics.no
set_client_nameboolSet the client name to redis_exporter.trueno
skip_tls_verificationboolSkip TLS verification.falseno
tls_ca_cert_filestringFull path to the CA certificate file that the component uses to verify the Redis server certificate.no
tls_client_cert_filestringFull path to the client certificate file if the server requires TLS client authentication.no
tls_client_key_filestringFull path to the client key file if the server requires TLS client authentication.no

The redis_addr argument accepts a host and port, such as localhost:6379, or a URI with one of the following schemes:

  • redis://: Connects without TLS. This is the default when you omit the scheme.
  • rediss://: Connects with TLS.
  • valkey://: Equivalent to redis://.
  • valkeys://: Equivalent to rediss://.

Caution

The exporter enables TLS only when redis_addr starts with rediss:// or valkeys://. The tls_ca_cert_file, tls_client_cert_file, tls_client_key_file, and skip_tls_verification arguments have no effect on a connection that uses any other scheme.

You can supply the Redis password with redis_password, redis_password_file, or redis_password_map_file. Set only one of redis_password_file and redis_password_map_file. If you set both of them, the component fails with an invalid configuration error.

You can set redis_password together with one of the file arguments. If you set redis_password_file, the component uses the password from that file and ignores redis_password. If you set redis_password_map_file, the component ignores redis_password only for the addresses that the file maps.

Set tls_client_cert_file and tls_client_key_file together. If you set only one of them, the component fails with an invalid configuration error.

If you don’t set tls_ca_cert_file, the component verifies the Redis server certificate against the system CA certificates.

If you don’t set check_key_groups, the component creates no key groups.

The check_key_groups_batch_size argument name reflects key groups for backwards compatibility, but applies to both key and key groups.

The component aggregates any leftover key groups beyond max_distinct_key_groups into the overflow bucket.

Set is_cluster to true when you connect to a Redis cluster and use check_keys or check_single_keys.

The script_path argument accepts a comma-separated string of paths, but use script_paths when you have multiple Lua scripts. Set either script_path or script_paths, not both. If you set both, the component fails with an invalid configuration error.

Note

Setting export_client_port increases the cardinality of all Redis metrics.

The component sets the instance label on its exported targets to the value of redis_addr.

Blocks

The prometheus.exporter.redis component doesn’t support any blocks. You can configure this component with arguments.

Exported fields

The following fields are exported and can be referenced by other components.

NameTypeDescription
targetslist(map(string))The targets that can be used to collect exporter metrics.

For example, the targets can either be passed to a discovery.relabel component to rewrite the targets’ label sets or to a prometheus.scrape component that collects the exposed metrics.

The exported targets use the configured in-memory traffic address specified by the run command.

Component health

prometheus.exporter.redis is only reported as unhealthy if given an invalid configuration. In those cases, exported fields retain their last healthy values.

Debug information

prometheus.exporter.redis doesn’t expose any component-specific debug information.

Debug metrics

prometheus.exporter.redis doesn’t expose any component-specific debug metrics.

Example

This example uses a prometheus.scrape component to collect metrics from prometheus.exporter.redis:

Alloy
prometheus.exporter.redis "example" {
  redis_addr = "localhost:6379"
}

// Configure a prometheus.scrape component to collect Redis metrics.
prometheus.scrape "demo" {
  targets    = prometheus.exporter.redis.example.targets
  forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
  endpoint {
    url = "<PROMETHEUS_REMOTE_WRITE_URL>"

    basic_auth {
      username = "<USERNAME>"
      password = "<PASSWORD>"
    }
  }
}

Replace the following:

  • <PROMETHEUS_REMOTE_WRITE_URL>: The URL of the Prometheus remote_write compatible server to send metrics to.
  • <USERNAME>: The username to use for authentication to the remote_write API.
  • <PASSWORD>: The password to use for authentication to the remote_write API.

Compatible components

prometheus.exporter.redis has exports that can be consumed by the following components:

Note

Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.