User-Agent Metric Not Exposed in Gremlin Server - Need Help Troubleshooting

Hey everyone, I've been working with Gremlin and noticed that we can pass the User-Agent in requests to the Gremlin server. According to the documentation (reference: https://tinkerpop.apache.org/docs/current/reference/#metrics), the server should maintain a metric called user-agent.*, which counts the number of connection requests from clients providing a specific user agent. We have already implemented sending the User-Agent in our HTTP requests to the Gremlin server, but the metric mentioned in the documentation doesn't seem to be exposed or working as expected. Has anyone encountered a similar issue? Do we need to enable the metric in some way, or could there be something else causing the problem? Any help or insights on this matter would be greatly appreciated. Thanks!
6 Replies
spmallette
spmallette2y ago
the user-agent is meant for websocket requests and not http. apparently that is not clear in the documentation. it seems there is an open issue to add the feature to http: https://issues.apache.org/jira/browse/TINKERPOP-2830 cc/ @colegreer
ColeGreer
ColeGreer2y ago
Yes, the current user agent capabilities is only for websocket connections. Currently to add any user agent handling from HTTP requests, HTTPChannelizer would need to be extended and a custom netty handler would need to be added to the ChannelPipeline in the configure() method. The server could then be configured to use the extended channelizer with the custom handler.
shivam.choudhary
shivam.choudharyOP17mo ago
Hello @colegreer and @spmallette , I've attempted to send WebSocket requests to the server with the 'User-Agent' header, but unfortunately, I'm still not able to observe the metrics even under these conditions. Could you kindly assist me in identifying what I might be overlooking? Thank you in advance for your help!
ColeGreer
ColeGreer17mo ago
Hey @shivam.choudhary, sorry I may have brushed over some details earlier. The server will look for a 'User-Agent' header from the initial connection request on the completion of the web socket handshake. It will not look for that header in subsequent messages sent via the existing connection. How are you currently setting the header? Also a bit of an unrelated question but what sort of insights are you most interested in observing? I've always wanted to come back to this feature at some point to add in additional extensibility on the server side.
shivam.choudhary
shivam.choudharyOP17mo ago
Hello @colegreer, I'm including the User-Agent header as a part of the handshake request headers. We're dealing with several clients for our Gremlin server, and we intended to utilise User-Agent metrics to monitor the throughput we're getting from these different clients. However, considering your remark that "It will not look for that header in subsequent messages sent via the existing connection," it appears that we can only monitor the count of connections per client. This leads me to believe that we might not have the capability to track it in the manner we thought?
ColeGreer
ColeGreer17mo ago
Hi @shivam.choudhary, Yes unfortunately throughput isn't something which is currently recorded in the metrics. This is something that could be added by extending one of the Channelizers and adding a new handler to the pipeline (let me know if you want any guidance with doing something like this). It would also be good to open up a JIRA for this. It would be useful to have throughput metrics built into the server out of the box, as well as an easier extension point for adding custom handlers.
Want results from more Discord servers?
Add your server