metric-api: Add prometheus metrics
It adds Prometheus metrics api, along with built-in go process metrics, it includes a few more packet metrics
"experimental": {
"metrics": {
"listen": ":8080"
}
}
curl localhost:8080/metrics
# HELP inbound_packet_bytes Total bytes of inbound packets
# TYPE inbound_packet_bytes counter
inbound_packet_bytes{inbound="mixed-in",user=""} 1310
# HELP outbound_packet_bytes Total bytes of outbound packets
# TYPE outbound_packet_bytes counter
outbound_packet_bytes{outbound="DIRECT",user=""} 4081
outbound_packet_bytes{outbound="Proxies",user=""} 8704
It should close #87 and serves a starting point for #1564
@nekohasekai PTAL, let me know if you've any questions.
New features need to be designed. Instead of providing an example PR, you should open an issue to discuss what statistics should be provided.
Ok. Following #87, I noticed pull request welcome is labelled, so I assume a pull-request could better showcase how it look like.
No problem, should I open a new issue to discuss the design? is there a PR example I could look into, or contribution guideline I can follow on?
Thanks for taking a look!
Sorry, I don't have experience with this either, maybe you can refer to the prometheus metrics provided by Clash and make a proposal.