Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shared] Tag transformer improvements #5455

Merged

Conversation

CodeBlanch
Copy link
Member

Changes

  • Removed the static coupling used to attach event source logging to the tag transformer class

  • Added nullable annotations

  • Removed TagAndValueTransformer. This was only used by OtlpExporter and added a whole bunch of unnecessary indirection

  • Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)

@CodeBlanch CodeBlanch added the pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package label Mar 15, 2024
@CodeBlanch CodeBlanch requested a review from a team March 15, 2024 23:39
Copy link

codecov bot commented Mar 16, 2024

Codecov Report

Attention: Patch coverage is 67.08861% with 26 lines in your changes are missing coverage. Please review.

Project coverage is 85.49%. Comparing base (6250307) to head (331eb1a).
Report is 141 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5455      +/-   ##
==========================================
+ Coverage   83.38%   85.49%   +2.10%     
==========================================
  Files         297      289       -8     
  Lines       12531    12509      -22     
==========================================
+ Hits        10449    10694     +245     
+ Misses       2082     1815     -267     
Flag Coverage Δ
unittests ?
unittests-Instrumentation-Experimental 24.19% <ø> (?)
unittests-Instrumentation-Stable 24.22% <ø> (?)
unittests-Solution-Experimental 85.50% <67.08%> (?)
unittests-Solution-Stable 85.39% <67.08%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...metryProtocol/Implementation/ActivityExtensions.cs 95.93% <100.00%> (ø)
...rotocol/Implementation/OtlpLogRecordTransformer.cs 95.45% <100.00%> (+1.99%) ⬆️
...metryProtocol/Implementation/ResourceExtensions.cs 100.00% <100.00%> (ø)
....Exporter.OpenTelemetryProtocol/OtlpLogExporter.cs 88.88% <ø> (ø)
...porter.OpenTelemetryProtocol/OtlpMetricExporter.cs 79.16% <ø> (-4.17%) ⬇️
...xporter.OpenTelemetryProtocol/OtlpTraceExporter.cs 88.46% <ø> (-2.72%) ⬇️
...rc/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs 88.54% <ø> (+3.10%) ⬆️
...tryProtocol/Implementation/MetricItemExtensions.cs 91.58% <66.66%> (+9.57%) ⬆️
...er.Console/Implementation/ConsoleTagTransformer.cs 30.00% <60.00%> (ø)
.../OpenTelemetry.Exporter.Console/ConsoleExporter.cs 66.66% <25.00%> (-8.34%) ⬇️
... and 5 more

... and 58 files with indirect coverage changes

@CodeBlanch
Copy link
Member Author

Update...

Ran into some strange behaviors with nint[] and nuint[] on .NET Framework.

On .NET/Core, this test always passes:

        Assert.False(((Array)new nint[0]) is long[]);
        Assert.False(((Array)new nint[0]) is int[]);
        Assert.False(((Array)new nuint[0]) is long[]);
        Assert.False(((Array)new nuint[0]) is int[]);

On .NET Framework, the test varies based on processor architecture:

        // On x64
        Assert.True(((Array)new nint[0]) is long[]);
        Assert.False(((Array)new nint[0]) is int[]);
        Assert.True(((Array)new nuint[0]) is long[]);
        Assert.False(((Array)new nuint[0]) is int[]);

        // On x86
        Assert.False(((Array)new nint[0]) is long[]);
        Assert.True(((Array)new nint[0]) is int[]);
        Assert.False(((Array)new nuint[0]) is long[]);
        Assert.True(((Array)new nuint[0]) is int[]);

This test is consistent across .NET Framework and .NET/Core:

        Assert.False(((object)(nint)1) is long);
        Assert.False(((object)(nint)1) is int);
        Assert.False(((object)(nuint)1) is long);
        Assert.False(((object)(nuint)1) is int);

Everything worked before sort of accidentally but this change started causing exceptions on .NET Framework.

@utpilla and I chatted offline and we decided to revert that new behavior just to make sure nothing breaks for 1.8.0 release: 331eb1a

@CodeBlanch CodeBlanch merged commit 49f16e4 into open-telemetry:main Mar 22, 2024
49 checks passed
@CodeBlanch CodeBlanch deleted the shared-tagtransformer-refactor branch March 22, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants