frigus02 / opentelemetry-application-insights

OpenTelemetry exporter for Azure Application Insights
MIT License
22 stars 12 forks source link

Use JSON stream (application/x-json-stream) serialization? #48

Closed frigus02 closed 1 year ago

frigus02 commented 2 years ago

It looks like the Application Insights SDK for .NET uses a JSON stream serialization. See:

If I read that correctly, it's newline separated objects instead of an array.

[{"data":{"baseData":{},"baseType":"RequestData"},"iKey":"0fdcec70-0ce5-4085-89d9-9ae8ead9af66","name":"Microsoft.ApplicationInsights.Request"},{"data":{"baseData":{},"baseType":"RequestData"},"iKey":"0fdcec70-0ce5-4085-89d9-9ae8ead9af66","name":"Microsoft.ApplicationInsights.Request"}]
{"data":{"baseData":{},"baseType":"RequestData"},"iKey":"0fdcec70-0ce5-4085-89d9-9ae8ead9af66","name":"Microsoft.ApplicationInsights.Request"}
{"data":{"baseData":{},"baseType":"RequestData"},"iKey":"0fdcec70-0ce5-4085-89d9-9ae8ead9af66","name":"Microsoft.ApplicationInsights.Request"}

I imagine the benefit is, that it can in theory start sending and receiving telemetry data while more items are still being serialized. Would it be useful to do the same in this crate?

frigus02 commented 2 years ago

It looks like the Azure Monitor OpenTelemetry Exporter for .NET uses newline separated JSON objects, too: