首页  

prometheus metrics 格式说明     所属分类 prometheus 浏览量 178
一行一个指标
指标名 不能包含特殊字符 
响应头  Content-Type: text/plain; charset=utf-8


http://127.0.0.1:8020/metrics
httpStatusCode_200 863178
runTime_count 863178
runTime_sum 1432113

curl -v http://127.0.0.1:8020/metrics

指标名可做一些format ,非法字符用下划线替换
public static String formatKey(String key) 
public static String buildMetricsOutput(Map map) 

PromUtil
https://gitee.com/dyyx/hellocode/blob/master/project/jpress/src/main/java/dyyx/util/PromUtil.java

servlet输出指标
https://gitee.com/dyyx/hellocode/blob/master/project/jpress/src/main/java/dyyx/servlet/MetricsServlet.java

simple http server 输出
https://gitee.com/dyyx/hellocode/blob/master/demo/temporal/sdkdemo/src/main/java/com/dyyx/util/HttpServer.java

prometheus.yml 配置  ,推荐使用vscode 编辑
https://gitee.com/dyyx/hellocode/blob/master/project/jpress/docs/prometheus/prometheus.yml

  - job_name: "jpress"
    static_configs:
      - targets: ["localhost:8020"]

  - job_name: "echoWorker"
    static_configs:
      - targets: ["localhost:8130"]

  - job_name: "echoClientApp"
    static_configs:
      - targets: ["localhost:8135"]



      

prometheus使用技巧

上一篇     下一篇
GO获取环境变量

GO入门指南实例

temporal压测方案及记录

httpclient 超时设置

Borg Omega and Kubernetes

k8s架构及核心组件