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

fix: Cannot define custom duration histogram buckets via @bentoml.service(metrics=...) #4895

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_bentoml_sdk/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class APIMethod(t.Generic[P, R]):
batch_dim: tuple[int, int] = attrs.field(
default=(0, 0), converter=lambda x: (x, x) if not isinstance(x, tuple) else x
)
max_batch_size: int = 100
max_batch_size: int = attrs.field(default=100, validator=attrs.validators.gt(1))
max_latency_ms: int = 60000
is_stream: bool = attrs.field(init=False)
doc: str | None = attrs.field(init=False)
Expand Down
4 changes: 4 additions & 0 deletions src/bentoml/_internal/server/http/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ def __init__(
def _setup(
self,
metrics_client: "PrometheusClient" = Provide[BentoMLContainer.metrics_client],
duration_buckets: tuple[float, ...] = Provide[
BentoMLContainer.duration_buckets
],
):
self.metrics_client = metrics_client

Expand All @@ -164,6 +167,7 @@ def _setup(
"http_response_code",
"runner_name",
],
buckets=duration_buckets,
)
self.metrics_request_total = metrics_client.Counter(
namespace=self.namespace,
Expand Down
Loading