You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/08/11 16:06:44 UTC

[GitHub] [skywalking-python] Superskyyy commented on a change in pull request #149: Enable HTTP Kafka log reporting

Superskyyy commented on a change in pull request #149:
URL: https://github.com/apache/skywalking-python/pull/149#discussion_r686973912



##########
File path: skywalking/client/http.py
##########
@@ -109,3 +110,20 @@ def report(self, generator):
                 } for span in segment.spans]
             })
             logger.debug('report traces response: %s', res)
+
+
+class HttpLogDataReportService(TraceSegmentReportService):
+    def __init__(self):
+        proto = 'https://' if config.force_tls else 'http://'
+        self.url_report = proto + config.collector_address.rstrip('/') + '/v3/logs'
+        self.session = requests.Session()
+
+    def fork_after_in_child(self):
+        self.session.close()
+        self.session = requests.Session()
+
+    def report(self, generator):
+        for log_data in generator:
+            json_string = json_format.MessageToJson(log_data)
+            res = self.session.post(self.url_report, json=[json.loads(json_string)])

Review comment:
       Umm, should I make a new config entry allowing the user to choose whether batch or not?




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

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