Opentelemetry-dotnet: span that uses AddTag with null value it isn't send via JaegerExporter to Jaeger

Created on 4 Oct 2020  路  12Comments  路  Source: open-telemetry/opentelemetry-dotnet

Bug Report

0.6.0-beta.1

*

Runtime version netcoreapp3.1

*

Symptom

If I use activity.AddTag("SomeValue", null) the created span doesn't send to Jaeger.
If I use activity.SetTag("SomeValue", null) the created span sends to Jaeger.

What is the expected behavior?

In both cases span should be sent to Jaeger

What is the actual behavior?

in first case span isn't sent to jaeger

Reproduce

Create any span and JaegerExporter
Add tag via method AddTag with null value
e.g.
activity.AddTag("someTag", null);

Additional Context

Add any other context about the problem here.

exporter bug p1

All 12 comments

@Austin-Tan this is a good issue to get you started. Please see if you could get it addressed.

@niksanla2 , this is expected to happen when we use .SetTag method

Below the summary and the implementation:

        /// <summary>
        /// Add or update the Activity tag with the input key and value.
        /// If the input value is null
        ///     - if the collection has any tag with the same key, then this tag will get removed from the collection.
        ///     - otherwise, nothing will happen and the collection will not change.
        /// If the input value is not null
        ///     - if the collection has any tag with the same key, then the value mapped to this key will get updated with the new input value.
        ///     - otherwise, the key and value will get added as a new tag to the collection.
        /// </summary>
        /// <param name="key">The tag key name</param>
        /// <param name="value">The tag value mapped to the input key</param>
        /// <returns>'this' for convenient chaining</returns>
        public Activity SetTag(string key, object value)

https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L383-L395

(just ignore this)

@eddynaka The issue is about the span itself being lost in exporter, right?

yeah, taking a second look, we have another part where it shouldn't send:

 public bool ForEach(KeyValuePair<string, object> activityTag)
            {
                if (activityTag.Value is Array)
                {
                    ProcessJaegerTagArray(ref this.Tags, activityTag);
                }
                else if (activityTag.Value != null)
                {
                    ProcessJaegerTag(ref this, activityTag.Key, activityTag.ToJaegerTag());
                }

                return true;
            }

Recently @CodeBlanch changed a bit the Exporters. Trying to test locally but couldn't reproduce.

@niksanla2 , testing locally with our current version I couldn't reproduce the issue. Can you download from MyGet and see if you face the same issue?

For both cases, we shouldn't send to Jaeger a null value.

@eddynaka The issue is about the span itself being lost in exporter, right?

yes

@niksanla2 , testing locally with our current version I couldn't reproduce the issue. Can you download from MyGet and see if you face the same issue?

For both cases, we shouldn't send to Jaeger a null value.

Could you explain, how can I download your packages?

Daily builds from this repo are published to MyGet, and can be installed from this source

IF you use VS2019, you can add a new source to get the packages.

This is the link for the myget: https://www.myget.org/F/opentelemetry/api/v3/index.json

With that, you will be able to update to our latest beta (0.6.0-beta.54)

@niksanla2 , testing locally with our current version I couldn't reproduce the issue. Can you download from MyGet and see if you face the same issue?

For both cases, we shouldn't send to Jaeger a null value.

yep, in version (0.6.0-beta.54) in both cases spans are sent to Jaeger. It works correctly

@niksanla2 , probably soon we will release the new version (0.7.*) in nuget.

if u need to this to work right now, keep using the myget (its a nightly build)

let us know if u face any other issue. closing the issue for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reyang picture reyang  路  3Comments

lmolkova picture lmolkova  路  4Comments

reyang picture reyang  路  5Comments

sergeyshaykhullin picture sergeyshaykhullin  路  4Comments

cijothomas picture cijothomas  路  5Comments