Skip to content

Review types passed to metrics tags #48530

@JamesNK

Description

@JamesNK

Metrics tags sometimes have enum and integer values. Value types always box because tags are stored as KeyValuePair<string, object?>. In some places, we avoid boxing with a cached collection of boxed values.

Note that OTel semantic conventions specify the tag type in some places, such as the HTTP status code is an integer.

Review with metrics experts to ensure we're doing the right thing.

Options

  • Keep passing value types and cache value types on hot path metrics.
  • Convert values to a string before passing to metrics, and rely on built-in caching. For example, Int32.ToString() and Enum.ToString() have some level of caching. The downside is that listeners may need to convert the string value back to its original type to use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions