You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing an issue where only the last declared Histogram metric is being collected when using multiple histograms in my BentoML service. The previously declared histograms do not collect any data, even though they are being called in the code.
To reproduce
Steps to Reproduce:
Here is a minimal reproducible example:
frombentoml.metricsimportCounter, Histogramtest_runner=bentoml.Runner(TestRunnable, name="test_runner")
service=bentoml.Service(name="test_service", runners=[test_runner, (...)])
REQUEST_COUNT=Counter(name="request_count", documentation="Total number of requests")
REQUEST_LATENCY=Histogram(name="request_latency_seconds", documentation="Request latency in seconds")
REQUEST_IMAGE_WIDTH=Histogram(name="request_image_width", documentation="Width of input images in pixels")
REQUEST_IMAGE_HEIGHT=Histogram(name="request_image_height", documentation="Height of input images in pixels")
asyncdefapi(data: BytesIO):
REQUEST_COUNT.inc()
withREQUEST_LATENCY.time():
image=PILImage.open(BytesIO(data.read())).convert("RGB")
image=exif_transpose(image=image)
original_size=image.sizeREQUEST_IMAGE_WIDTH.observe(original_size[0])
REQUEST_IMAGE_HEIGHT.observe(original_size[1])
When I run the service and make requests, only the last declared histogram (REQUEST_IMAGE_HEIGHT) collects data.
The other histograms (REQUEST_LATENCY and REQUEST_IMAGE_WIDTH) do not show any collected data in the metrics endpoint.
If I declare only one histogram (regardless of which one), it collects data as expected.
Declaring two or more histograms results in only the last one collecting data.
I have tried changing the order of the histogram declarations, and it's always the last one that collects data.
No errors or warnings are logged during runtime.
Could you please help investigate this issue? Is there a known limitation or a specific way to declare multiple histograms in BentoML so that they all collect data correctly?
Thank you for your assistance.
Expected behavior
All declared Histogram metrics should collect and display data when their observe() method is called, regardless of the number of histograms declared.
Describe the bug
I'm experiencing an issue where only the last declared Histogram metric is being collected when using multiple histograms in my BentoML service. The previously declared histograms do not collect any data, even though they are being called in the code.
To reproduce
Steps to Reproduce:
Here is a minimal reproducible example:
When I run the service and make requests, only the last declared histogram (REQUEST_IMAGE_HEIGHT) collects data.
The other histograms (REQUEST_LATENCY and REQUEST_IMAGE_WIDTH) do not show any collected data in the metrics endpoint.
If I declare only one histogram (regardless of which one), it collects data as expected.
Declaring two or more histograms results in only the last one collecting data.
I have tried changing the order of the histogram declarations, and it's always the last one that collects data.
No errors or warnings are logged during runtime.
Could you please help investigate this issue? Is there a known limitation or a specific way to declare multiple histograms in BentoML so that they all collect data correctly?
Thank you for your assistance.
Expected behavior
All declared Histogram metrics should collect and display data when their observe() method is called, regardless of the number of histograms declared.
Environment
bentoml: 1.2.16
Python: 3.10
OS: Ubuntu 20.04.6 LTS
The text was updated successfully, but these errors were encountered: