Static Configurations
By default, prometheus
configurations are pre-configured in the default configuration.
To customize these values, add the corresponding configurations to config.yaml
. For example:
plugin_attr:
prometheus: # Plugin: prometheus attributes
export_uri: /apisix/prometheus/metrics # Set the URI for the Prometheus metrics endpoint.
metric_prefix: apisix_ # Set the prefix for Prometheus metrics generated by APISIX.
enable_export_server: true # Enable the Prometheus export server.
export_addr: # Set the address for the Prometheus export server.
ip: 127.0.0.1 # Set the IP.
port: 9091 # Set the port.
# metrics: # Create extra labels for metrics.
# http_status: # These metrics will be prefixed with `apisix_`.
# extra_labels: # Set the extra labels for http_status metrics.
# - upstream_addr: $upstream_addr
# - status: $upstream_status
# http_latency:
# extra_labels: # Set the extra labels for http_latency metrics.
# - upstream_addr: $upstream_addr
# bandwidth:
# extra_labels: # Set the extra labels for bandwidth metrics.
# - upstream_addr: $upstream_addr
# expire: 86400 # The expiration time of metrics in seconds.
# 0 means the metrics will not expire.
# Only affect apisix_http_status, apisix_bandwidth, and apisix_http_latency
# default_buckets: # Set the default buckets for the `http_latency` metrics histogram.
# - 10
# - 50
# - 100
# - 200
# - 500
# - 1000
# - 2000
# - 5000
# - 10000
# - 30000
# - 60000
# - 500
You can use built-in variables to create extra_labels
. See add extra labels
Reload APISIX for changes to take effect.
Parameters
See plugin common configurations for configuration options available to all plugins.
prefer_name
boolean
default:
false
If true, export route/service name instead of their ID in Prometheus metrics.