opentelemetry-dotnet: ZipkinExporter cannot properly handle tags that are null
Describe your environment. Describe any aspect of your environment relevant to the problem:
- SDK version: 0.4.0-beta.111
- .NET runtime version (.NET or .NET Core, TargetFramework in the .csproj file): aspnetcore 2.1
- Platform and OS version: macos 10.14.5
It looks the ZipkinActivityConversionExtension method ProcessTags does not correctly handle tags that are not strings. The HttpInListener for the AspNetCore instrumentation is setting the tag http.status_code
to an int here. In the ProcessTags method it looks like we get the string value for the KeyValuePair that is the activity tag through this conversion. However this does not convert the int value of http.status_code
to a string, which results in the code setting the tag on the ZipkinSpan to be null in this line. This causes a NullReferenceException when trying to write the ZipkinSpan to JSON here.
Steps to reproduce. Setup the AspNetCore Instrumentation to use the zipkin exporter and make a request to the server that would be sampled.
What is the expected behavior? Zipkin Exporter should successfully make call to endpoint
What is the actual behavior?
A null reference exception is thrown when trying to convert the ZipkinSpan to json due to a null tag for http.status_code
Additional context. Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 29 (29 by maintainers)
@eddynaka looks like it made it in. Thanks for all the help!
Nice to know! Thank you for pointing everything! 👍
Nice to know. I openened the PR!
oh…i see, so u are using zipking exporter with Otel collector, is that it?
@christopher-taormina-zocdoc , let me test and see what is happening. Give me some time 😃
@christopher-taormina-zocdoc , after i saw, i don’t know if the package 114 contains my change (we are doing nightly builds). Can you test in the new build that we will generate tonight? Looking at the tests that we made, we are covering that case.
@christopher-taormina-zocdoc , i will create a PR solving this issue. I will probably check if the object is string, if yes, we will maintain that logic, otherwise, it will just maintain as object. That will probably solve your issue.