Open JohnBasrai opened 1 year ago
The docs make a quick mention here to send metrics to /metrics/
, with the implication that http://localhost/
, but we could do a better job of calling out exactly where to send the metrics. You can also add labels in that url by sending metrics to /metrics/label1/value1/label2/value2/
, etc.
The "lifecycle server" only exists to give kubernetes a place to send probes to, and expose internal metrics. The metrics exposed by the lifecycle server describe the health and activity of the gateway itself, as opposed to metrics that are forwarded by and aggregated for the gateway's clients.
Thanks for the reply, Here is what I tried and what I see in response
$ docker run -d -p9091:9091 prom/pushgateway
$ echo '
http_requests_total{method="post",code="200"} 1027
http_errors_total{method="post",code="500"} 6
'
+ curl --data-binary @- http://localhost:9091/metrics/domain/sometest.com/instance/nginx-1
404 page not found
Thanks again.
You're using the prometheus pushgateway there, not prom-aggregation-gateway. Theirs requires that your path includes a job parameter first:
[~]$ echo '
http_requests_total{method="post",code="200"} 1027
http_errors_total{method="post",code="500"} 6
'| curl --data-binary @- http://localhost:9091/metrics/job/some-job/domain/sometest.com/instance/nginx-1 -v
* Trying 127.0.0.1:9091...
* Connected to localhost (127.0.0.1) port 9091 (#0)
> POST /metrics/job/some-job/domain/sometest.com/instance/nginx-1 HTTP/1.1
> Host: localhost:9091
> User-Agent: curl/7.88.1
> Accept: */*
> Content-Length: 99
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Date: Tue, 17 Oct 2023 17:48:36 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
prom-aggregation-gateway
, on the other hand, allows you to add the /job/$job
label pair anywhere in the url, or omit it altogether.
I started the container with the following command line
This maps the two ports it uses by default to the host. Docker logs say:
The readme says to use one of the stand standard clients. I tried the python one.
This page has the following example of how to push metrics.
I tired adjusting this client code to use each of the two ports that appeared in the log for
prom-aggregation-gateway
(80
&8888
) and both of them get the same 404 error.For reference here is the help message I get from the container:
There is no mention here or in the
readme
on what the two ports are but if I were to take a guess I think the second one above--lifecycleListen string
is the one I should be using since it mentions metrics.Please help.