-
Notifications
You must be signed in to change notification settings - Fork 824
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
Accessing custom metrics in our Python model #245
Comments
@bbarn3y I've checked in PR #252 If you can get latest code in master and take a look at the example in examples/models/mean_classifier_with_custom_endpoints/ The MeanClassifier.py has example of how to add your own endpoints. |
We reviewed the code and we'd like to ask if it would be possible to move the endpoint logic into microservice.py. We think that handling the endpoints is usually not the responsibility of the model developer. By the way, are there plans to implement similar functionality with other supported languages (e.g. Java)? |
Initially we did think about a simple callback function but it seemed a bit limited. The optional "custom_service" gives users a lot of flexibility to create multiple endpoints and use multiple types of methods calls such as GET/POST etc depending on their own use-case. I've added a notebook in a recent checkin:
This has a full example of how to setup a custom endpoint for metrics, create a seldon deployment and then check the values scraped by prometheus. No plans for a java version just yet, but it is in the roadmap. |
I agree that this flexibility regarding creating multiple endpoints may be useful in some scenarios. However, I think that adding custom metrics to the model is such a basic requirement (esp. for detecting model degradation) that it should really be supported in a more native way by Seldon. You can not always expect the data scientist who develops the model to add this kind of code. Also as much of the implementation as possible should be put into the generic microservice code, and just as little as needed into the model code (just as it is the case currently with the microservice endpoints). The simple callback function would be a much cleaner and uniform way to achieve this, specifically for Prometheus metrics. (By potentially also keeping the current custom service for other, more complex use cases). |
Also another question: |
I think one solution could be to allow users to send back a "metrics" dict in their response which the Seldon orchestrator will pick up and push any key values out to prometheus with the standard naming and the users key with the given value.
|
I really like this approach, so the model developer would just need to send back the "metrics" dict in the metadata as you described. |
Here is a proposal. Feedback welcome |
I like the proposal. Just one comment regarding the enum MetricType: Potentially metrics of type histogram & summary will be represented by several metrics of type gauge or counter, so in this case we might not need separate types for histogram & summary. |
I have updated the proposal with some rationale for not following Prometheus exactly. Be good to get your opinions. |
Thanks for the proposal, it sounds good to me. |
Thanks for the clarifications! Sounds good to me too. |
* Started data flow doc * dataflow doc * remove double here * Update dataflow.md - Adding more details about why intermediate data / lineage is a key feature - Adding further references Co-authored-by: Sherif Akoush <sherif.akoush@gmail.com>
We are using Seldon to wrap our Python model images and we deploy these images with Kubeflow seldon serving. We also have seldon-core-analytics set up on our Kubernetes cluster and we can get and see the default Prometheus metrics using Grafana.
However, we need to extend these default metrics with our own metrics defined in the model and if possible these new metrics should behave the same way as the default ones meaning that they should be queriable and visualizable by Grafana.
We're thinking about extending seldon-core Python Wrapper's Flask REST endpoint with our own route for querying custom metrics. How could we set this up in a way that makes these custom metrics accessible in Grafana? How can we tell seldon-core-analytics' Prometheus to scrape our custom metrics?
Or maybe there is another way to add custom metrics that we didn't find?
The text was updated successfully, but these errors were encountered: