• 【解决了一个小问题】vmagent中,如何对envoy这样的特殊expoter路径做处理?


    作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!


    envoy这个组件的expoter路径为 /stats/prometheus,那么这样的特殊路径如何配置,才能让vm-agent抓取到?

    • 方法1:在 prometheus_cfg.yaml中使用static_config,对所有envoy配置 metric_path
      • 非常麻烦,而且需要让vm-agent不停加载配置
    • 方法2:使用filesd的方法来配置,然后在JSON中通过__metrics_path__字段指定特殊路径。
      • 不行,这个方法走不通
    • 方法3:使用httpsd来配置,然后在JSON中通过__metrics_path__字段指定特殊路径。
      • 这个方法OK

    vm的源码中也能看出端倪:VictoriaMetrics-1.72.0-cluster/lib/promscrape/scrapework.go

    // ScrapeWork represents a unit of work for scraping Prometheus metrics.
    //
    // It must be immutable during its lifetime, since it is read from concurrently running goroutines.
    type ScrapeWork struct {
    	// Full URL (including query args) for the scrape.
    	ScrapeURL string
    
    	// Interval for scraping the ScrapeURL.
    	ScrapeInterval time.Duration
    
    	// Timeout for scraping the ScrapeURL.
    	ScrapeTimeout time.Duration
    
    	// How to deal with conflicting labels.
    	// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
    	HonorLabels bool
    
    	// How to deal with scraped timestamps.
    	// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
    	HonorTimestamps bool
    
    	// Whether to deny redirects during requests to scrape config.
    	DenyRedirects bool
    
    	// OriginalLabels contains original labels before relabeling.
    	//
    	// These labels are needed for relabeling troubleshooting at /targets page.
    	OriginalLabels []prompbmarshal.Label
    
    	// Labels to add to the scraped metrics.
    	//
    	// The list contains at least the following labels according to https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
    	//
    	//     * job
    	//     * __address__
    	//     * __scheme__
    	//     * __metrics_path__
    	//     * __scrape_interval__
    	//     * __scrape_timeout__
    	//     * __param_<name>
    	//     * __meta_*
    	//     * user-defined labels set via `relabel_configs` section in `scrape_config`
    	//
    	// See also https://prometheus.io/docs/concepts/jobs_instances/
    	Labels []prompbmarshal.Label
    
    	// ProxyURL HTTP proxy url
    	ProxyURL *proxy.URL
    
    	// Auth config for ProxyUR:
    	ProxyAuthConfig *promauth.Config
    
    	// Auth config
    	AuthConfig *promauth.Config
    
    	// Optional `metric_relabel_configs`.
    	MetricRelabelConfigs *promrelabel.ParsedConfigs
    
    	// The maximum number of metrics to scrape after relabeling.
    	SampleLimit int
    
    	// Whether to disable response compression when querying ScrapeURL.
    	DisableCompression bool
    
    	// Whether to disable HTTP keep-alive when querying ScrapeURL.
    	DisableKeepAlive bool
    
    	// Whether to parse target responses in a streaming manner.
    	StreamParse bool
    
    	// The interval for aligning the first scrape.
    	ScrapeAlignInterval time.Duration
    
    	// The offset for the first scrape.
    	ScrapeOffset time.Duration
    
    	// Optional limit on the number of unique series the scrape target can expose.
    	SeriesLimit int
    
    	// The original 'job_name'
    	jobNameOriginal string
    }
    
  • 相关阅读:
    Python的socket模块详解
    C语言中输入输出重定向,freopen的用法和实例
    JPG BMP TIF PNG 图像编码压缩率和编解码时间比较
    FFMPEG 内部YUV转RGB过程
    STL 中的数据结构
    FFmpeg 深度学习 livevideoStack 笔记
    Docker 编译tensorflow-1.14.0 静态库
    CMake 笔记
    Torch 学习
    Docker 学习笔记
  • 原文地址:https://www.cnblogs.com/ahfuzhang/p/16314096.html
Copyright © 2020-2023  润新知