HTTP logs for websockets
Great addition with the HTTP logs, this is very welcome, thanks for that!
I have a graphql API with subscription, through websocket.
- Is
0
an official websocket status, maybe the readyState
property? or just a default value?
- What does response time mean? the time since the connection is opened? I don't believe the subscriptions are responding in minutes in some cases.11 Replies
Project ID:
N/A
N/A
- that's supposed to be an http code, but 0 is the default value for int lol, good catch
- total round trip time id assume
What "round trip time" would mean in a case of a subscription/websocket, the time of the first connection (where
readyState
went into OPEN
) to the time the new message has been emitted, during the same connection? (I'm using this websocket library if that matters https://github.com/enisdenjo/graphql-ws)
I'm just finding this a bit weird, regarding the queries/mutations response times from graphql, it looks to be on par with what I see in NewRelic, around ~250ms in average, which is what I see in the HTTP logs. Regarding the subscriptions it looks to be way slower that's what I get on NewRelic, average is around ~2ms, and in the HTTP logs, I'm seeing a lot of these responses time being over 100sthe time the client initializes a connection until the time the connection is closed, aka total duration
okay I see, at least that makes sense why the duration is so long.
It's honestly a bit confusing. I would expect when I see a log entry that it counts for non-connection emitted messages. I don't know if it's possible or not. I know NewRelic is integrated within my codebase, but their data makes more sense to me when I'm looking at the logs. Seeing a websocket that has a duration of 200s doesn't really help me to debug/investigate if there is an issue, just my 2cent
you can expand the log to see more information
Yep I know, but that doesn't help much.
When I see
that doesn't really help me in the context of a websocket or gives me additional information. It's mostly a feedback in this case, just giving you my thought
what would you like to see there?
hey, happy to improve this. The 0 status code and txBytes is because when the connection is upgraded to a websocket connection there is no longer a HTTP response hence the 0 status code. The txBytes (bytes sent to the client) also is part of the HTTP response so that's why it too is zero.
It's common to perform a WS upgrade via an HTTP request so a 101 status code is expected. I can see if this is the behaviour we should implement.
Maybe regarding httpStatus and txBytes, they could be hidden for websocket and/or have different color/label to differentiate http vs ws vs other protocols.
Regarding the request duration, I would personally want to see a single emitted message duration. My service emitted this message to the client, it took 1ms. That would be more meaningful for me. And not based on the client initialization duration, but not sure if that's possible on your side