You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/03/29 03:35:47 UTC

[GitHub] [druid] zhangyue19921010 commented on a change in pull request #11036: request logs through kafka emitter

zhangyue19921010 commented on a change in pull request #11036:
URL: https://github.com/apache/druid/pull/11036#discussion_r602995267



##########
File path: server/src/main/java/org/apache/druid/server/log/DefaultRequestLogEvent.java
##########
@@ -56,7 +57,21 @@
   @Override
   public Map<String, Object> toMap()
   {
-    return ImmutableMap.of();
+    final Map<String, Object> map = new HashMap<>();
+    map.put("feed", getFeed());
+    map.put("timestamp", getCreatedTime());
+    map.put("service", getService());
+    map.put("host", getHost());
+    if (getQuery() != null) {
+      map.put("query", getQuery());
+    }
+    if (getSql() != null) {
+      map.put("sql", getSql());
+    }
+    map.put("sqlQueryContext", getSqlQueryContext());

Review comment:
       Here we need to distinguish between forNative and forSql.
   `forNative` : sql and sqlQueryContext are null,
   `forSql` : query is null.
   So that maybe we need to do 
   ```
       if (getSqlQueryContext() != null) {
         map.put("sqlQueryContext", getSqlQueryContext());
       }
   ```
   

##########
File path: extensions-contrib/kafka-emitter/src/main/java/org/apache/druid/emitter/kafka/KafkaEmitter.java
##########
@@ -111,6 +116,9 @@ public void start()
   {
     scheduler.schedule(this::sendMetricToKafka, 10, TimeUnit.SECONDS);
     scheduler.schedule(this::sendAlertToKafka, 10, TimeUnit.SECONDS);
+    if (config.getRequestTopic() != null) {
+      scheduler.schedule(this::sendRequestToKafka, 10, TimeUnit.SECONDS);
+    }
     scheduler.scheduleWithFixedDelay(() -> {
       log.info("Message lost counter: metricLost=[%d], alertLost=[%d], invalidLost=[%d]",
                metricLost.get(), alertLost.get(), invalidLost.get());

Review comment:
       nit : maybe need to add requestLost info here.
   something like 
   `log.info("Message lost counter: metricLost=[%d], alertLost=[%d], requestLost=[%d], invalidLost=[%d]", metricLost.get(), alertLost.get(), requestLost.get(), invalidLost.get());`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org