[ 
https://issues.apache.org/jira/browse/TINKERPOP-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630068#comment-17630068
 ] 

ASF GitHub Bot commented on TINKERPOP-2480:
-------------------------------------------

spmallette commented on code in PR #1838:
URL: https://github.com/apache/tinkerpop/pull/1838#discussion_r1015960954


##########
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/WsUserAgentHandler.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.server.handler;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
+import io.netty.util.AttributeKey;
+import org.apache.tinkerpop.gremlin.driver.util.UserAgent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Channel handler which extracts a user agent header from a web socket 
handshake if present
+ * then logs the user agent and stores it as a channel attribute for future 
reference.
+ */
+public class WsUserAgentHandler extends ChannelInboundHandlerAdapter {

Review Comment:
   is `info` the right log level here? seems we would trigger this for each 
connection made by a driver. maybe that would flood the logs with too much 
stuff? maybe we `debug` logging is better and some sort of aggregation of agent 
types reported as metrics (which by default only periodically writes to the 
logs)? thoughts?





> User agent for Gremlin drivers
> ------------------------------
>
>                 Key: TINKERPOP-2480
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2480
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: driver, server
>    Affects Versions: 3.4.8
>            Reporter: Divij Vaidya
>            Priority: Minor
>
> Currently, a server does not distinguish amongst the different types of 
> clients connecting to it. This issue is to add a new feature to add user 
> agent field in the HTTP and WebSocket request header which could be used to 
> identify the specific client from which the request was made.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to