open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
454 stars 273 forks source link

[onecollector] Serialization fixes #1999

Closed CodeBlanch closed 1 month ago

CodeBlanch commented 1 month ago

Changes

Details

OneCollector is strict about the amount of data it will process. Given a batch OneCollectorExporter will serialize items until it reaches the max payload size. The previous behavior was it would leave anything remaining in the batch expecting to process those records as part of the next batch. This leads to dropped telemetry though because BatchExportProcessor disposes\drains the batch after calling the exporter. The fix for this is OneCollectorExporter will now just make multiple transmissions until it has drained the batch itself. It will now also drop any single item which itself cannot fit into the max payload size.

Merge requirement checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 96.92308% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.22%. Comparing base (71655ce) to head (409bed9). Report is 380 commits behind head on main.

Files Patch % Lines
...tor/Internal/Sinks/WriteDirectlyToTransportSink.cs 95.34% 2 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999/graphs/tree.svg?width=650&height=150&src=pr&token=DG2DEROH83&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #1999 +/- ## =========================================== + Coverage 73.91% 93.22% +19.30% =========================================== Files 267 27 -240 Lines 9615 1033 -8582 =========================================== - Hits 7107 963 -6144 + Misses 2508 70 -2438 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [unittests-Exporter.OneCollector](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `93.22% <96.92%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [...lector/Internal/OneCollectorExporterEventSource.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.OneCollector%2FInternal%2FOneCollectorExporterEventSource.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuT25lQ29sbGVjdG9yL0ludGVybmFsL09uZUNvbGxlY3RvckV4cG9ydGVyRXZlbnRTb3VyY2UuY3M=) | `66.66% <100.00%> (+23.80%)` | :arrow_up: | | [...Internal/Serialization/BatchSerializationResult.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.OneCollector%2FInternal%2FSerialization%2FBatchSerializationResult.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuT25lQ29sbGVjdG9yL0ludGVybmFsL1NlcmlhbGl6YXRpb24vQmF0Y2hTZXJpYWxpemF0aW9uUmVzdWx0LmNz) | `100.00% <100.00%> (ø)` | | | [.../Internal/Serialization/BatchSerializationState.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.OneCollector%2FInternal%2FSerialization%2FBatchSerializationState.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuT25lQ29sbGVjdG9yL0ludGVybmFsL1NlcmlhbGl6YXRpb24vQmF0Y2hTZXJpYWxpemF0aW9uU3RhdGUuY3M=) | `100.00% <100.00%> (ø)` | | | [...ternal/Serialization/CommonSchemaJsonSerializer.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.OneCollector%2FInternal%2FSerialization%2FCommonSchemaJsonSerializer.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuT25lQ29sbGVjdG9yL0ludGVybmFsL1NlcmlhbGl6YXRpb24vQ29tbW9uU2NoZW1hSnNvblNlcmlhbGl6ZXIuY3M=) | `90.00% <100.00%> (+1.11%)` | :arrow_up: | | [...tor/Internal/Sinks/WriteDirectlyToTransportSink.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.OneCollector%2FInternal%2FSinks%2FWriteDirectlyToTransportSink.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuT25lQ29sbGVjdG9yL0ludGVybmFsL1NpbmtzL1dyaXRlRGlyZWN0bHlUb1RyYW5zcG9ydFNpbmsuY3M=) | `97.33% <95.34%> (+6.19%)` | :arrow_up: | ... and [261 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/pull/1999/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)