http接口获取到的 mbvar转prometheus metrics 格式, 提示格式非法
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
通过brpc_metrics接口获取mbvar 转化来的多lables guage打点,提示type非法
具体的值:
```
# HELP lat_rank_score_total_latency{system="unknown",module="unknown",server="rank_server_nbase",status="0"}
# TYPE lat_rank_score_total_latency{system="unknown",module="unknown",server="rank_server_nbase",status="0"} gauge
lat_rank_score_total_latency{system="unknown",module="unknown",server="rank_server_nbase",status="0"} 22
```
**To Reproduce (复现方法)**
```
typedef bvar::MultiDimension MLatencyRecorder;
MLatencyRecorder lat_rank_score_total("lat_rank_score_total", {"system", "module", "server", "status"});
mbvar_dump=true
mbvar_dump_format= prometheus
```
打点收集,然后prometheus收集组件通过 http://$ip:$port/brpc_metrics获取打点结果,提示错误
```
invalid metirc type "system=\"square\" ****** gauge"
```
**Expected behavior (期望行为)**
能正常收集
**Versions (各种版本)**
OS: linux
Compiler: gcc 7.3.1
brpc: 1月10号版master
protobuf: 3.6.0
**Additional context/screenshots (更多上下文/截图)**
Contributor guide
Research direction
Start by tracing the brpc_metrics endpoint and the mbvar_dump_format=prometheus path that formats MultiDimension output. Compare the generated HELP and TYPE lines with Prometheus's expected metric syntax; done means the endpoint output is accepted and the labeled gauge is collected normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, prometheus
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100