Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom metrics in /metrics endpoint and Prometheus #1092

Closed
chauhang opened this issue May 22, 2021 · 2 comments
Closed

Add support for custom metrics in /metrics endpoint and Prometheus #1092

chauhang opened this issue May 22, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@chauhang
Copy link
Contributor

chauhang commented May 22, 2021

The support for getting the custom metrics via the /metrics endpoint for viewing via in dashboards using Prometheus + Grafana.

@chauhang chauhang added the enhancement New feature or request label May 22, 2021
@msaroufim
Copy link
Member

msaroufim commented Aug 25, 2021

Summarizing @maaquib comments here as to how to support this. The issue right now is custom metrics are only supported in the frontend and they need to be passed to the backend.

These are the metrics supported in the frontend: https://github.com/pytorch/serve/blob/master/frontend/server/src/main/java/org/pytorch/serve/metrics/format/prometheous/PrometheusMetricManager.java which is called by

metrics.incInferLatency(inferTime, modelName, modelVersion);
with the metrics computed here
MetricAggregator.handleInferenceMetric(

This is where the request is sent to the backend (and where the custom metrics need to be sent):

backendChannel.writeAndFlush(req).sync();

Encoding/Decoding happens on the frontend here: https://github.com/pytorch/serve/tree/master/frontend/server/src/main/java/org/pytorch/serve/util/codec

Encoding/Decoding happens on the backend here: https://github.com/pytorch/serve/blob/master/ts/protocol/otf_message_handler.py

To test the frontend: https://github.com/pytorch/serve/tree/master/frontend

To test the backend: Python debugger with breakpoints

@msaroufim
Copy link
Member

Duplicate of #1492

@msaroufim msaroufim marked this as a duplicate of #1492 May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants