如何获得使用普罗米修斯休息服务器的请求数?
How can I get the number of requests to rest server with prometheus?
我有一个这样的获取请求:
http://localhost:4567/hello
哪个return邮递员:"hello"
我现在想在普罗米修斯中接收这个:
- job_name: 'prometheus'
scrape_interval: 5s
metrics_path: /hello
static_configs:
- targets: ['localhost:4567']
但我在 prometheus 控制台收到:
level=warn ts=2019-08-06T08:25:36.643Z caller=scrape.go:937 component="scrape manager" scrape_pool=prometheus target=http://localhost:4567/hello msg="append failed" err="\"INVALID\" is not a valid start token"
如果我在 prometheus 中测试一个图表:
prometheus_http_requests_total
我没有收到数据。
有人知道我错过了什么吗?
谢谢
我猜你是从错误的路径中抓取指标。你说 GET
请求 http://localhost:4567/hello
return 你 hello
而不是指标信息。
预期的指标信息格式如下:
$ curl http://localhost:8080/metrics
# HELP http_requests_total Count of all http requests
# TYPE http_requests_total counter
http_requests_total{code="0",method="GET"} 1
http_requests_total{code="0",method="Post"} 1
# HELP version Version information about this binary
# TYPE version gauge
version{version="v0.0.1"} 0
确保哪个端点公开了您的指标信息。然后更新 scrape_config
.
我有一个这样的获取请求:
http://localhost:4567/hello
哪个return邮递员:"hello"
我现在想在普罗米修斯中接收这个:
- job_name: 'prometheus'
scrape_interval: 5s
metrics_path: /hello
static_configs:
- targets: ['localhost:4567']
但我在 prometheus 控制台收到:
level=warn ts=2019-08-06T08:25:36.643Z caller=scrape.go:937 component="scrape manager" scrape_pool=prometheus target=http://localhost:4567/hello msg="append failed" err="\"INVALID\" is not a valid start token"
如果我在 prometheus 中测试一个图表:
prometheus_http_requests_total
我没有收到数据。
有人知道我错过了什么吗?
谢谢
我猜你是从错误的路径中抓取指标。你说 GET
请求 http://localhost:4567/hello
return 你 hello
而不是指标信息。
预期的指标信息格式如下:
$ curl http://localhost:8080/metrics
# HELP http_requests_total Count of all http requests
# TYPE http_requests_total counter
http_requests_total{code="0",method="GET"} 1
http_requests_total{code="0",method="Post"} 1
# HELP version Version information about this binary
# TYPE version gauge
version{version="v0.0.1"} 0
确保哪个端点公开了您的指标信息。然后更新 scrape_config
.