Skip to content

Commit

Permalink
Reuse dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
paulomorgado committed Jun 27, 2024
1 parent 978b461 commit f989e01
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 65 deletions.
9 changes: 9 additions & 0 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
converted using `Convert.ToString` will now format using
`CultureInfo.InvariantCulture`.
([#5700](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5700))
* Reuse `spansByLibrary` dictionary in `ActivityExtensions` to reduce memory
allocation.
([#4943](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4943))
* Reuse `metricsByLibrary` dictionary in `MetricItemExtensions` to reduce memory
allocation.
([#4943](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4943))
* Reuse `logsByCategory` dictionary in `OtlpLogExporter` to reduce memory
allocation.
([#4943](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4943))

## 1.9.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using OpenTelemetry.Internal;
using OpenTelemetry.Proto.Collector.Trace.V1;
using OpenTelemetry.Proto.Common.V1;
using OpenTelemetry.Proto.Metrics.V1;

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Using directive is unnecessary.

Check warning on line 11 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Using directive is unnecessary.
using OpenTelemetry.Proto.Resource.V1;
using OpenTelemetry.Proto.Trace.V1;
using OpenTelemetry.Trace;
Expand All @@ -18,41 +19,51 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
internal static class ActivityExtensions
{
private static readonly ConcurrentBag<ScopeSpans> SpanListPool = new();
private static Dictionary<string, ScopeSpans>? spansByLibraryCached;

internal static void AddBatch(
this ExportTraceServiceRequest request,
SdkLimitOptions sdkLimitOptions,
Resource processResource,
in Batch<Activity> activityBatch)
{
Dictionary<string, ScopeSpans> spansByLibrary = new Dictionary<string, ScopeSpans>();
ResourceSpans resourceSpans = new ResourceSpans
{
Resource = processResource,
};
request.ResourceSpans.Add(resourceSpans);
var spansByLibrary = Interlocked.Exchange(ref spansByLibraryCached, null) ?? new Dictionary<string, ScopeSpans>();

foreach (var activity in activityBatch)
try
{
Span? span = activity.ToOtlpSpan(sdkLimitOptions);
if (span == null)
ResourceSpans resourceSpans = new ResourceSpans
{
OpenTelemetryProtocolExporterEventSource.Log.CouldNotTranslateActivity(
nameof(ActivityExtensions),
nameof(AddBatch));
continue;
}
Resource = processResource,
};
request.ResourceSpans.Add(resourceSpans);

var activitySourceName = activity.Source.Name;
if (!spansByLibrary.TryGetValue(activitySourceName, out var spans))
foreach (var activity in activityBatch)
{
spans = GetSpanListFromPool(activitySourceName, activity.Source.Version);
Span? span = activity.ToOtlpSpan(sdkLimitOptions);
if (span == null)
{
OpenTelemetryProtocolExporterEventSource.Log.CouldNotTranslateActivity(
nameof(ActivityExtensions),
nameof(AddBatch));
continue;
}

spansByLibrary.Add(activitySourceName, spans);
resourceSpans.ScopeSpans.Add(spans);
}
var activitySourceName = activity.Source.Name;
if (!spansByLibrary.TryGetValue(activitySourceName, out var spans))
{
spans = GetSpanListFromPool(activitySourceName, activity.Source.Version);

spansByLibrary.Add(activitySourceName, spans);
resourceSpans.ScopeSpans.Add(spans);
}

spans.Spans.Add(span);
spans.Spans.Add(span);
}
}
finally
{
spansByLibrary.Clear();
Interlocked.Exchange(ref spansByLibraryCached, spansByLibrary);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,52 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
internal static class MetricItemExtensions
{
private static readonly ConcurrentBag<ScopeMetrics> MetricListPool = new();
private static Dictionary<string, ScopeMetrics>? metricsByLibraryCached;

internal static void AddMetrics(
this OtlpCollector.ExportMetricsServiceRequest request,
OtlpResource.Resource processResource,
in Batch<Metric> metrics)
{
var metricsByLibrary = new Dictionary<string, ScopeMetrics>();
var resourceMetrics = new ResourceMetrics
{
Resource = processResource,
};
request.ResourceMetrics.Add(resourceMetrics);
var metricsByLibrary = Interlocked.Exchange(ref metricsByLibraryCached, null) ?? new Dictionary<string, ScopeMetrics>();

foreach (var metric in metrics)
try
{
var otlpMetric = metric.ToOtlpMetric();

// TODO: Replace null check with exception handling.
if (otlpMetric == null)
var resourceMetrics = new ResourceMetrics
{
OpenTelemetryProtocolExporterEventSource.Log.CouldNotTranslateMetric(
nameof(MetricItemExtensions),
nameof(AddMetrics));
continue;
}
Resource = processResource,
};
request.ResourceMetrics.Add(resourceMetrics);

var meterName = metric.MeterName;
if (!metricsByLibrary.TryGetValue(meterName, out var scopeMetrics))
foreach (var metric in metrics)
{
scopeMetrics = GetMetricListFromPool(meterName, metric.MeterVersion, metric.MeterTags);
var otlpMetric = metric.ToOtlpMetric();

metricsByLibrary.Add(meterName, scopeMetrics);
resourceMetrics.ScopeMetrics.Add(scopeMetrics);
}
// TODO: Replace null check with exception handling.
if (otlpMetric == null)
{
OpenTelemetryProtocolExporterEventSource.Log.CouldNotTranslateMetric(
nameof(MetricItemExtensions),
nameof(AddMetrics));
continue;
}

scopeMetrics.Metrics.Add(otlpMetric);
var meterName = metric.MeterName;
if (!metricsByLibrary.TryGetValue(meterName, out var scopeMetrics))
{
scopeMetrics = GetMetricListFromPool(meterName, metric.MeterVersion, metric.MeterTags);

metricsByLibrary.Add(meterName, scopeMetrics);
resourceMetrics.ScopeMetrics.Add(scopeMetrics);
}

scopeMetrics.Metrics.Add(otlpMetric);
}
}
finally
{
metricsByLibrary.Clear();
Interlocked.Exchange(ref metricsByLibraryCached, metricsByLibrary);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
internal sealed class OtlpLogRecordTransformer
{
internal static readonly ConcurrentBag<OtlpLogs.ScopeLogs> LogListPool = new();
private Dictionary<string, OtlpLogs.ScopeLogs>? logsByCategory;

private readonly SdkLimitOptions sdkLimitOptions;

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net7.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net462)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-experimental / build-test (windows-latest, net8.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Check failure on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net6.0)

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Readonly fields should appear before non-readonly fields

Check warning on line 22 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Readonly fields should appear before non-readonly fields
private readonly ExperimentalOptions experimentalOptions;
Expand All @@ -31,35 +32,42 @@ internal OtlpCollector.ExportLogsServiceRequest BuildExportRequest(
OtlpResource.Resource processResource,
in Batch<LogRecord> logRecordBatch)
{
// TODO: https://github.com/open-telemetry/opentelemetry-dotnet/issues/4943
Dictionary<string, OtlpLogs.ScopeLogs> logsByCategory = new Dictionary<string, OtlpLogs.ScopeLogs>();
var logsByCategory = Interlocked.Exchange(ref this.logsByCategory, null) ?? new Dictionary<string, OtlpLogs.ScopeLogs>();

var request = new OtlpCollector.ExportLogsServiceRequest();

var resourceLogs = new OtlpLogs.ResourceLogs
try
{
Resource = processResource,
};
request.ResourceLogs.Add(resourceLogs);
var request = new OtlpCollector.ExportLogsServiceRequest();

foreach (var logRecord in logRecordBatch)
{
var otlpLogRecord = this.ToOtlpLog(logRecord);
if (otlpLogRecord != null)
var resourceLogs = new OtlpLogs.ResourceLogs
{
var scopeName = logRecord.Logger.Name;
if (!logsByCategory.TryGetValue(scopeName, out var scopeLogs))
Resource = processResource,
};
request.ResourceLogs.Add(resourceLogs);

foreach (var logRecord in logRecordBatch)
{
var otlpLogRecord = this.ToOtlpLog(logRecord);
if (otlpLogRecord != null)
{
scopeLogs = this.GetLogListFromPool(scopeName);
logsByCategory.Add(scopeName, scopeLogs);
resourceLogs.ScopeLogs.Add(scopeLogs);
}
var scopeName = logRecord.Logger.Name;
if (!logsByCategory.TryGetValue(scopeName, out var scopeLogs))
{
scopeLogs = this.GetLogListFromPool(scopeName);
logsByCategory.Add(scopeName, scopeLogs);
resourceLogs.ScopeLogs.Add(scopeLogs);
}

scopeLogs.LogRecords.Add(otlpLogRecord);
scopeLogs.LogRecords.Add(otlpLogRecord);
}
}
}

return request;
return request;
}
finally
{
logsByCategory.Clear();
Interlocked.Exchange(ref this.logsByCategory, logsByCategory);
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit f989e01

Please sign in to comment.