Metrics-usage is configured via command-line flags and a configuration file
-config string
Path to the yaml configuration file for the api. Configuration can be overridden when using the environment variable
-log.level string
log level. Possible value: panic, fatal, error, warning, info, debug, trace (default "info")
-log.method-trace
include the calling method as a field in the log. Can be useful to see immediately where the log comes from
-pprof
Enable pprof
-web.hide-port
If true, it won t be print on stdout the port listened to receive the HTTP request
-web.listen-address string
The address to listen on for HTTP requests, web interface and telemetry. (default ":8080")
-web.telemetry-path string
Path under which to expose metrics. (default "/metrics")Example:
metrics-usage --config=./config.yaml --log.method-traceThe file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional.
Generic placeholders are defined as follows:
<boolean>: a boolean that can take the valuestrueorfalse<duration>: a duration matching the regular expression((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0), e.g.1d,1h30m,5m,10s<filename>: a valid path in the current working directory<path>: a valid URL path<int>: an integer value<secret>: a regular string that is a secret, such as a password<string>: a regular string
[ database: <Database Config> ]
[ metric_collector: <Metric_Collector config> ]
[ rules_collectors:
- <Rule_Collector config> ]
[ perses_collector: <Perses_Collector config> ]
[ grafana_collector: <Grafana_Collector config> ]
[ query_parser: <Query_Parser config> ]# it defines if the database is stored in a file or in memory
[ in_memory: <boolean> | default = true ]
# In case the database is stored in a file, then the path to a JSON file must be defined
[ path: <path> ]
# It defines the frequency the system will flush the data into the JSON file
[ flush_period: <duration> | default = 5m ][ enable: <boolean> | default=false ]
[ period: <duration> | default="12h" ]
http_client: <HTTPClient config>[ enable: <boolean> | default=false ]
[ period: <duration> | default="12h" ]
[ concurrency: <int> | default=1 ]
# It is a client to send the labels to a remote metrics_usage server.
[ metric_usage_client: <HTTPClient config> ]
# The prometheus client used to retrieve the labels.
prometheus_client: <HTTPClient config>[ enable: <boolean> | default=false ]
[ period: <duration> | default="12h" ]
# It is a client to send the metrics usage to a remote metrics_usage server.
[ metric_usage_client: <HTTPClient config> ]
# It is the number of retries the collector will do to get the rules from Prometheus before actually failing.
# Between each retry, the collector will wait first 10 seconds, then 20 seconds, then 30 seconds ...etc.
[ retry_to_get_rules: <number> | default=3 ]
# The prometheus client used to retrieve the rules
prometheus_client: <HTTPClient config>[ enable: <boolean> | default=false ]
[ period: <duration> | default="12h" ]
# It is a client to send the metrics usage to a remote metrics_usage server.
[ metric_usage_client: <HTTPClient config> ]
# the Perses client used to retrieve the dashboards
perses_client: <HTTPClient config>[ enable: <boolean> | default=false ]
[ period: <duration> | default="12h" ]
# It is a client to send the metrics usage to a remote metrics_usage server.
[ metric_usage_client: <HTTPClient config> ]
# the Grafana client used to retrieve the dashboards
grafana_client: < HTTPClient config>
# List of datasource types to ignore when extracting metric expressions from dashboard targets.
# Targets with matching datasource types will be skipped during metric extraction.
# Datasource type matching is case-insensitive (e.g., "postgres" matches "POSTGRES").
# Example: ["postgres", "mysql", "influxdb"]
[ ignore_datasource_types: <list of strings> ]
# List of datasource UIDs to ignore when extracting metric expressions from dashboard targets.
# Targets with matching datasource UIDs will be skipped during metric extraction.
# Example: ["bf5b9901-8a28-4501-a0c2-726b4ee3f15d", "another-uid"]
[ ignore_datasource_uids: <list of strings> ]Example configuration:
grafana_collector:
enable: true
period: "12h"
grafana_client:
url: "https://grafana.example.com"
ignore_datasource_types:
- postgres
- mysql
ignore_datasource_uids:
- bf5b9901-8a28-4501-a0c2-726b4ee3f15d# CA certificate to validate API server certificate with. At most one of ca and ca_file is allowed.
[ ca: <secret> ]
[ caFile: <filename> ]
# Certificate and key for client cert authentication to the server.
# At most one of cert and cert_file is allowed.
# At most one of key and key_file is allowed.
[ cert: <secret> ]
[ certFile: <filename> ]
[ key: <secret> ]
[ keyFile: <filename> ]
# ServerName extension to indicate the name of the server.
# https://tools.ietf.org/html/rfc4366#section-3.1
[ serverName: <string> ]
# Disable validation of the server certificate.
[ insecureSkipVerify: <boolean> | default = false ]url: <string>
[ oauth: <Oauth Config> ]
[ basic_auth: <BasicAuth Config> ]
[ authorization: <Authorization Config> ]
[ tls_config: <TLS Config> ]username: <string>
[ password: <string> ]
[ passwordFile: <filename> ][ type: <string> | default = "Bearer" ]
# The HTTP credentials like a Bearer token
[ credentials: <string> ]
[ credentialsFile: <filename> ]# ClientID is the application's ID.
client_id: <string>
# ClientSecret is the application's secret.
client_secret: <string>
# TokenURL is the resource server's token endpoint URL. This is a constant specific to each server.
token_url: <string># Engine specifies the query parser engine to use for analyzing PromQL/MetricsQL expressions.
# Valid values are: "promql" (default) or "metricsql"
# This can be overridden via environment variable METRICS_USAGE_QUERY_PARSER_ENGINE
[engine: <string> | default = "promql"]The query parser engine determines how metric names are extracted from query expressions:
promql: Uses the Prometheus PromQL parser (default, backward compatible)metricsql: Uses the VictoriaMetrics MetricsQL parser, which supports PromQL plus additional MetricsQL extensions
Example:
query_parser:
engine: metricsql