【解决了一个小问题】vm-agent中,如何对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
}
【解决了一个小问题】vm-agent中,如何对envoy这样的特殊expoter路径做处理?的更多相关文章
- 【解决了一个小问题】golang中引用一个路径较长的库,导致goland中出现"module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2"
在项目中的go.mod文件中有这样一句: require ( github.com/xxx-devops/xx1/sdk/go v2.2.3 ) 项目的编译没有问题,但是goland中出现如下提示: ...
- mysql url 连接配置的一个小坑。 工作中不会遇到。 学习的时候会
<property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> & ...
- 【解决了一个小问题】golang protocol buffers 3中去掉json标签中的omitempty
参考了这篇帖子:golang protobuf从生成的json标记中删除omitempty标记 由于是在windows上开发,因此写了一个python脚本来解决: remove_tag.py impo ...
- 【解决了一个小问题】golang gin框架中的模板,让模板中的参数不要做HTML转义
代码中使用了类似的方式来向模板填充参数: c.HTML(200, "list.html", gin.H{"data":builder.String()}) 模板 ...
- 【解决了一个小问题】golang build中因为缓存文件损坏导致的编译错误
编译的过程中出现了一个吓人的错误: GOROOT=C:\Go #gosetup GOPATH=C:\Users\ahfuzhang\go #gosetup C:\Go\bin\go.exe mod t ...
- 【解决了一个小问题】go.mod文件中引用另一个库,总会自动拉取新版本
我的项目依赖某个旧的公共库: require ( git.xxx.com/myprj/mylib v0.0.43 ) 可以编译的时候,系统总会自动加上这样的路径: require ( git.xxx. ...
- 【解决了一个小问题】golang的go.mod中出现版本错误
代码中的这一句使用prometheus2.28.0版本的代码: import "github.com/prometheus/prometheus/prompb" 我把require ...
- 【解决了一个小问题】golang samara的kafka客户端中使用错误版本号导致初始化失败
发现在如下代码中存储kafka生产者初始化失败: config.Version = sarama.V0_10_2_1 //V2_2_0_0 producer, err := sarama.NewSyn ...
- 【解决了一个小问题】golang xorm中使用where id in (xxx),没办法使用参数替换
代码中使用XORM来从数据库查询数据,有类似如下的代码: session.Where("id in (?)", strings,Join(arr, ",")) ...
- 【解决了一个小问题】gin框架中出现如下错误:"[GIN-debug] [WARNING] Headers were already written. Wanted to override status code 400 with 500"
POST到数据到一条gin框架的接口后,客户端收到400错误,并且返回了业务中返回的"decode json fail". 关键代码是: func report(c *gin.Co ...
随机推荐
- 火山引擎数智平台ByteHouse入围稀土掘金《Top10 年度创新产品》
更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 近日,国内开发者技术社区稀土掘金发布「2022 稀土掘金引力榜」,旨在盘点 2022 年在数字化转型领域内最具影响 ...
- leaflet 绘制 带箭头的线
箭头不是画的线段,是贴的图标,再按方向旋转一下. 代码: //添加箭头线 function addLineDirection(polylinePointArr, source, target) { v ...
- SpringBoot 项目实战 | 瑞吉外卖 Day05
该系列将记录一份完整的实战项目的完成过程,该篇属于第五天 案例来自B站黑马程序员Java项目实战<瑞吉外卖>,请结合课程资料阅读以下内容 该篇我们将完成以下内容: 新增套餐 套餐信息分页查 ...
- Codeforce 1335C - Two Teams Composing 统计技能种类数量+统计同一技能最大数量
7 4 2 4 1 4 3 4 统计技能种类数量 4种不同技能 统计同一技能最大数量 技能1(数量1) 技能2(数量1) 技能3(数量1) 技能4(数量4) 选出 技能4(数量4) 作为 第2组 扣除 ...
- 3 Englishi 词根
1 -able 能..的:具有...性质的 useable moveable adaptable 2 -al 具有...性质的; 属于...的 personal natural regional - ...
- el-table在flex布局下宽度不能自适应的解决方法
https://blog.csdn.net/Komorebi_00/article/details/127566867
- 异步httpClient(Async HttpClient)
一.简介 二.mvn依赖 三.客户端 3.1 官网实例 3.2. 根据官方文档的介绍,简单封装了一个异步HttpClient工具类 3.3 基本原理 四.参考文档 一.简介 HttpClient提供了 ...
- 06-逻辑仿真工具VCS-Debug
逻辑仿真工具VCS verdi只进行debug进行使用,不进行编译,只进行产生波形之后的debug 仿真速度和代码质量有关系,选项也会影响仿真速度,行为级>RTL>门级 信号的可见性和可追 ...
- pycharm等编辑器快捷键大赏
1.序论 平时打代码的时候用鼠标在写代码的时候还行,代码一长就GG,快捷键便是我们的好选择 2.应用场景 1.问题一--选中一段指定区域 我想选中一段区域(我们一般用鼠标拖动),或者某一个标识符(光标 ...
- STM32CubeMX教程22 FSMC - 8080并行接口TFT-LCD驱动
1.准备材料 开发板(正点原子stm32f407探索者开发板V2.4) STM32CubeMX软件(Version 6.10.0) 野火DAP仿真器 keil µVision5 IDE(MDK-Arm ...
