bentoml / BentoML

The easiest way to serve AI apps and models - Build reliable Inference APIs, LLM apps, Multi-model chains, RAG service, and much more!
https://bentoml.com
Apache License 2.0
6.98k stars 777 forks source link

feature: To be able to define custom metrics endpoint #4831

Open bobanj opened 2 months ago

bobanj commented 2 months ago

Feature request

Would like to be able to provide something like a prefix_path in the configuration so the metrics, healthz endpoints are available with my/prefix/path

Motivation

Scenario where multiple models are available under one hostname, ex:

Other

No response

ssheng commented 2 months ago

Are the different models served by one or multiple BentoML servers? If multiple servers, shouldn't they be running on different ports? If the same server, the models should be sharing the same health check path, too. Is my understanding correct?

bobanj commented 2 months ago

We are using a diff infra setup (no EKS), hence the reason for asking for this.

ssheng commented 2 months ago

@frostming Do you think the health check and metrics prefix is best exposed as a configuration field?

frostming commented 2 months ago

Sorry I didn't get the point. The OP seems to ask for multiple metrics endpoints instead of custom metrics endpoint, but the former doesn't make sense to me.

bobanj commented 2 months ago

Not to have multiple metrics endpoints but for the current /metrics path configurable, basically to have something like https://github.com/bentoml/BentoML/blob/0666d62dcaabc9a9a84121c0429e94ae41940733/src/bentoml/_internal/server/http/instruments.py#L87

if scope["path"] == metrics_path_from_config || "/metrics"