tom-pytel commented on a change in pull request #149:
URL: https://github.com/apache/skywalking-python/pull/149#discussion_r686229622
##########
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:
Actually, looking at this suggests that the `/v3/logs` endpoint can take
an array of logs so a batch send could be done. Change to:
```py
def report(self, generator):
json = [json_format.MessageToJson(log_data) for log_data in generator]
res = self.session.post(self.url_report, json=json)
```
Your call if you want to do now.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]