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

OTLP Span arrays allow exporting null values + support for long arrays #1919

Merged
merged 16 commits into from
Mar 26, 2021

Conversation

Austin-Tan
Copy link
Member

@Austin-Tan Austin-Tan commented Mar 17, 2021

Fixes #1843 .

  1. For all string and supported primitive arrays (bool[], double[], long[]) allowed null values to be exported.
  2. long arrays were not previously supported (only int[]), they are now.
  • CHANGELOG.md updated for non-trivial changes

@Austin-Tan Austin-Tan requested a review from a team as a code owner March 17, 2021 20:11
@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Merging #1919 (14ef89b) into main (0208fd6) will increase coverage by 0.68%.
The diff coverage is 76.92%.

❗ Current head 14ef89b differs from pull request most recent head 7d2622e. Consider uploading reports for the commit 7d2622e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1919      +/-   ##
==========================================
+ Coverage   83.69%   84.38%   +0.68%     
==========================================
  Files         192      188       -4     
  Lines        6159     6117      -42     
==========================================
+ Hits         5155     5162       +7     
+ Misses       1004      955      -49     
Impacted Files Coverage Δ
...metryProtocol/Implementation/ActivityExtensions.cs 86.30% <76.92%> (-0.60%) ⬇️
...rc/OpenTelemetry/Trace/TracerProviderBuilderSdk.cs 89.83% <0.00%> (-10.17%) ⬇️
...ZPages/Implementation/ZPagesExporterEventSource.cs 56.25% <0.00%> (-6.25%) ⬇️
...c/OpenTelemetry.Api/Trace/TracerProviderBuilder.cs 100.00% <0.00%> (ø)
...c/OpenTelemetry/Trace/TracerProviderBuilderBase.cs
...ing/Implementation/TracerProviderBuilderHosting.cs
...penTelemetry/Internal/ServiceProviderExtensions.cs
...s.Hosting/Trace/TracerProviderBuilderExtensions.cs
....Exporter.Jaeger/JaegerExporterHelperExtensions.cs 15.38% <0.00%> (+4.27%) ⬆️
....Exporter.Zipkin/ZipkinExporterHelperExtensions.cs 15.38% <0.00%> (+4.27%) ⬆️
... and 3 more

using var rootActivity = activitySource.StartActivity("root", ActivityKind.Client);

var stringArr = new string[] { "test", null };
var longArr = new long?[] { 1, null };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens to this null element ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the tests for nullable primtive type arrays like long?[] and double?[]. I think discussion of them is outside the scope of this PR

Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Austin-Tan Austin-Tan closed this Mar 22, 2021
@Austin-Tan Austin-Tan reopened this Mar 22, 2021
@Austin-Tan Austin-Tan closed this Mar 22, 2021
@Austin-Tan Austin-Tan reopened this Mar 22, 2021
@Austin-Tan Austin-Tan closed this Mar 22, 2021
@Austin-Tan Austin-Tan reopened this Mar 22, 2021
@Austin-Tan Austin-Tan changed the title String Arrays in OTLP spans change Null to string.Empty OTLP Span arrays allow exporting null values Mar 25, 2021
@Austin-Tan Austin-Tan changed the title OTLP Span arrays allow exporting null values OTLP Span arrays allow exporting null values + support for long arrays Mar 25, 2021
@cijothomas cijothomas merged commit d7bb2b9 into open-telemetry:main Mar 26, 2021
@Oberon00
Copy link
Member

I think 41b3eef needs to be reverted. Copying my comment from #1939 (comment):

Hi! The spec says that nulls in arrays are invalid and you should only allow them if the language does not make it possible to prevent them at compile-time. So explicitly using double? [] etc instead of double[] violates the spec. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/common.md#attributes

null values SHOULD NOT be allowed in arrays.

only then does the spec also say:

However, if it is impossible to make sure that no null values are accepted (e.g. in languages that do not have appropriate compile-time type checking) ...

But in C# this only applies to strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting Activity tag with a String Array which contains a null crashes the application.
4 participants