Following instructions in this page:
http://pulsar.apache.org/docs/en/next/deploy-monitoring.html
curl http://localhost:8080/metrics
should return some metrics info.
nothing returned.
bin/pulsar-admin broker-stats monitoring-metrics could return metrics info.curl http://localhost:8080/metrics returns nothingPulsar version: 2.2
curl http://localhost:8080/metrics returns nothing
But
curl http://localhost:8080/metrics/ could return metrics info.
This looks like a bug of jersey?
This may be related to the matching order of routing and MATCH_ALL.
https://github.com/AmateurEvents/pulsar/commit/7f0eca524581ae9bb76c6a7d1b50b68506895542
https://github.com/AmateurEvents/pulsar/commit/fcf9e36c6f09c84800578e9e5fef7b06f1619b0d
After I set up the code like this, curl http://localhost:8080/metrics could return metrics info.
It鈥檚 not ideal, though the HTTP response is 302 redirect to /metrics so any http client following redirects is working
@merlimat is right.
In centos:
[root@hostname ~]# curl -v http://localhost:8080/metrics
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /metrics HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Fri, 04 Jan 2019 15:53:03 GMT
< Location: http://localhost:8080/metrics/
< Content-Length: 0
< Server: Jetty(9.3.z-SNAPSHOT)
<
And with the python urllib2 package, we can get result through http://localhost:8080/metrics
import urllib2
url = "http://localhost:8080/metrics"
res = urllib2.urlopen(url)
print res.read()
@merlimat is right.
$curl -v -L http://localhost:8080/metrics
$wget -q -O - http://localhost:8080/metrics
these shell command could return metrics info.
Closed this issue as the question is answered.
Question is answered, but bug isn't fixed and documentation is misleading.
@agilob can you let us know which documentation page you were checking? We can improve it. Or your contributions are welcome as well.
Since I'm here, I would like to say that documentation is misleading and incorrect in many places. It took me 3 days to setup cluster of zookeeper, bookkeeper and pulsar with metrics for each to get messages passing :(
The problem wasn't purely in pulsar, bookkeeper is also badly documented, official docker examples often do not work, are out of date or incomplete. It's not my, I learnt about pulsar from HN thead where people share this opinion https://news.ycombinator.com/item?id=21937615 nevertheless I decided to give pulsar a go and managed to succeed! = I know I won't be using kafka now :)
@agilob yes. there are too many stuff to improve regarding documentation. any contributions are highly recommended.
Most helpful comment
@merlimat is right.
these shell command could return metrics info.