Configuration 将自定义参数添加到prometheus刮取请求

Configuration 将自定义参数添加到prometheus刮取请求,configuration,prometheus,Configuration,Prometheus,我们在应用程序中启用了度量端点以获取度量。它需要自定义参数,如何配置prometheus.yaml以发送自定义参数作为每个度量刮取的一部分 下面是我的prometheus.yml配置 # Sample METRICS - job_name: 'sys-metrics' metrics_path: '/sys/metrics' # Optional HTTP URL parameters. params: -user-id: ['myemail@email.com'] scrape_int

我们在应用程序中启用了度量端点以获取度量。它需要自定义参数,如何配置prometheus.yaml以发送自定义参数作为每个度量刮取的一部分

下面是我的prometheus.yml配置

# Sample METRICS    
- job_name: 'sys-metrics'
metrics_path: '/sys/metrics'
# Optional HTTP URL parameters.
params:
-user-id: ['myemail@email.com']
scrape_interval: 3s
static_configs:
- targets: ['dev.devhost.domain.com:12345']
当我启动服务器时,我得到封送错误

解析YAML文件prometheus.yml:YAML:unmarshal错误:\n第37行:字段-在type config.plain中找不到用户id“


在params下,用户id是子元素,添加tab来解析。正如我在同一级别上定义的,prometheus应该是预定义的配置之一

params:
    -user-id: ['myemail@email.com']
问题解决