Commit ace0e6cb authored by 赵啸非's avatar 赵啸非

添加prometheus指标测算

parent dfa4df3b
......@@ -34,6 +34,7 @@ public class ManagerBaseApplication extends BaseWebApplication {
@PostConstruct
public void init() {
DefaultExports.initialize();
}
......
package com.mortals.xhx.metrics;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class Counter {
//注册数据
static final io.prometheus.client.Counter REQUESTS = io.prometheus.client.Counter.build().name("requests_total")
.help("Total requests.").labelNames("label").register();
//初始化数据方法一
{
REQUESTS.labels("trace").inc(0D);
}
//初始化数据方法二
@PostConstruct
public void processRequest() {
REQUESTS.labels("error").inc();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment