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
Create a class with an annotation similar to this: @ServerWebSocket("/media/v1/conversation/{conversationId}/websocket") and appropriately annotated @onopen and @OnMessage methods.
Open websockets to this service with different values for conversationId
Check the metrics scrape endpoint.
Expected Behaviour
I think that duration of websocket sessions doesn't make sense as a metric, especially not compared with regular http requests. I originally thought there should be a single pair of metrics as below because parameterized websocket controller paths should be treated like http parameterized controller paths. I now think websocket endpoints simply shouldn't have these metrics.
There are multiple pairs of metrics like this:
http_server_requests_seconds_count{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-1/websocket",} 3.0
http_server_requests_seconds_sum{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-1/websocket",} 0.56403263
http_server_requests_seconds_count{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-2/websocket",} 3.0
http_server_requests_seconds_sum{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-2} 0.56403263
Over time this results in us running out of memory.
** I have worked around the problem by setting the micronaut.metrics.http.path property to a path that excludes my websocket endpoint. **
I think you may need a WebsocketRequestMeterRegistryFilter like you have for client and server.
The text was updated successfully, but these errors were encountered:
joelezellLP
changed the title
@ServerWebsocket annotation results in too many metrics
@ServerWebsocket annotation results in too many metrics and out of memory conditions
Oct 25, 2022
* Use service ID instead of host to identify clients
* Fallback to a fixed unmatched URI when template is not found
Fixes#458 and Fixes#397
---------
Co-authored-by: Graeme Rocher <graeme.rocher@oracle.com>
Steps to Reproduce
Expected Behaviour
I think that duration of websocket sessions doesn't make sense as a metric, especially not compared with regular http requests. I originally thought there should be a single pair of metrics as below because parameterized websocket controller paths should be treated like http parameterized controller paths. I now think websocket endpoints simply shouldn't have these metrics.
http_server_requests_seconds_count{exception="none",method="POST",status="200",uri="/media/v1/conversation/{conversationId}/websocket",} 3.0
http_server_requests_seconds_sum{exception="none",method="POST",status="200",uri="/media/v1/conversation/{conversationId}/websocket",} 0.56403263
Actual Behaviour
There are multiple pairs of metrics like this:
http_server_requests_seconds_count{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-1/websocket",} 3.0
http_server_requests_seconds_sum{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-1/websocket",} 0.56403263
http_server_requests_seconds_count{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-2/websocket",} 3.0
http_server_requests_seconds_sum{exception="none",method="POST",status="200",uri="/media/v1/conversation/ID-2} 0.56403263
Over time this results in us running out of memory.
** I have worked around the problem by setting the
micronaut.metrics.http.path
property to a path that excludes my websocket endpoint. **Environment Information
Additional Information
https://github.com/micronaut-projects/micronaut-micrometer/tree/master/micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web
I think you may need a WebsocketRequestMeterRegistryFilter like you have for client and server.
The text was updated successfully, but these errors were encountered: