[Metric source-generator] Allow metric-classes to have more than 30 tag names
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
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](https://github.com/dotnet/extensions/blob/main/docs/list-of-diagnostics.md#metrics) "A metric class contains too many tag names".
```csharp
[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:
```csharp
[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.
Contributor guide
Assessment
This issue has not been assessed yet.