Skip to content

[Metric source-generator] Allow metric-classes to have more than 30 tag names #7573

@iliar-turdushev

Description

@iliar-turdushev

When using metric source-generator with a strong-typed metric the number of dimensions is limited to 30, i.e. if you try to create a metric with more than 30 dimensions you'll get an error METGEN013 "A metric class contains too many tag names".

[Counter(typeof(SomeType))]
public static partial SomeMetric CreateSomeMetric(Meter meter);

public class SomeType
{
    public string D1 { get; set; } = string.Empty;
    ...
    public string D33 { get; set; } = string.Empty;
}

At the same time, if you specify tag names as a parameter of a metric attribute the issue will not occur and the metric will be successfully created/generated:

[Counter("D1", ..., "D33")]
public static partial SomeMetric CreateSomeMetric(Meter meter);

We should unify the behavior and remove the limitation on the number of tag names in a metric type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions