Skip to content

Mark Activity.Tags as obsolete and/or create an analyzer #49383

Open

Description

The Activity.Tags property only return tags which are KeyValuePair<string, string> and shouldn't be used anymore. Having both without any hints about this is confusing for the customer and might lead to mistakes.

Don't use anymore:

/// <summary>
/// Tags are string-string key-value pairs that represent information that will
/// be logged along with the Activity to the logging system. This information
/// however is NOT passed on to the children of this activity.
/// </summary>
/// <seealso cref="Baggage"/>
public IEnumerable<KeyValuePair<string, string?>> Tags
{
get => _tags?.EnumerateStringValues() ?? s_emptyBaggageTags;
}

Use:

/// <summary>
/// List of the tags which represent information that will be logged along with the Activity to the logging system.
/// This information however is NOT passed on to the children of this activity.
/// </summary>
public IEnumerable<KeyValuePair<string, object?>> TagObjects
{
get => _tags ?? s_emptyTagObjects;
}

For details see discussion with @tarekgh
#48722 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions