Skip to content

Fix TaggedMetricFactory constructor params order#45

Merged
deanward81 merged 1 commit intoStackExchange:masterfrom
g3rv4:master
Jan 5, 2022
Merged

Fix TaggedMetricFactory constructor params order#45
deanward81 merged 1 commit intoStackExchange:masterfrom
g3rv4:master

Conversation

@g3rv4
Copy link
Contributor

@g3rv4 g3rv4 commented Dec 27, 2021

All the implementers end up calling : base(name, unit, description, options), but the constructor's param order requires name, description, unit, options.

As the API exposes the same interface, I think it's better to keep it consistent:
image

Here you can see the 5 usages of this constructor:

public abstract class TaggedMetricFactory<TMetric, TTag1> : TaggedMetricFactory<TMetric> where TMetric : MetricBase
{
private readonly TaggedMetricDictionary<TTag1> _metrics = new TaggedMetricDictionary<TTag1>();
/// <summary>
/// Initializes the base class
/// </summary>
protected TaggedMetricFactory(string name, string unit, string description, MetricSourceOptions options, in MetricTag<TTag1> tag1) : base(name, unit, description, options)

public abstract class TaggedMetricFactory<TMetric, TTag1, TTag2> : TaggedMetricFactory<TMetric> where TMetric : MetricBase
{
private readonly TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2)> _metrics = new TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2)>();
/// <summary>
/// Initializes the base class
/// </summary>
protected TaggedMetricFactory(string name, string unit, string description, MetricSourceOptions options, in MetricTag<TTag1> tag1, in MetricTag<TTag2> tag2) : base(name, unit, description, options)

public abstract class TaggedMetricFactory<TMetric, TTag1, TTag2, TTag3> : TaggedMetricFactory<TMetric> where TMetric : MetricBase
{
private readonly TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3)> _metrics = new TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3)>();
/// <summary>
/// Initializes the base class
/// </summary>
protected TaggedMetricFactory(string name, string unit, string description, MetricSourceOptions options, in MetricTag<TTag1> tag1, in MetricTag<TTag2> tag2, in MetricTag<TTag3> tag3) : base(name, unit, description, options)

public abstract class TaggedMetricFactory<TMetric, TTag1, TTag2, TTag3, TTag4> : TaggedMetricFactory<TMetric> where TMetric : MetricBase
{
private readonly TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3, TTag4 Tag4)> _metrics = new TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3, TTag4 Tag4)>();
/// <summary>
/// Initializes the base class
/// </summary>
protected TaggedMetricFactory(string name, string unit, string description, MetricSourceOptions options, in MetricTag<TTag1> tag1, in MetricTag<TTag2> tag2, in MetricTag<TTag3> tag3, in MetricTag<TTag4> tag4) : base(name, unit, description, options)

public abstract class TaggedMetricFactory<TMetric, TTag1, TTag2, TTag3, TTag4, TTag5> : TaggedMetricFactory<TMetric> where TMetric : MetricBase
{
private readonly TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3, TTag4 Tag4, TTag5 Tag5)> _metrics = new TaggedMetricDictionary<(TTag1 Tag1, TTag2 Tag2, TTag3 Tag3, TTag4 Tag4, TTag5 Tag5)>();
/// <summary>
/// Initializes the base class
/// </summary>
protected TaggedMetricFactory(string name, string unit, string description, MetricSourceOptions options, in MetricTag<TTag1> tag1, in MetricTag<TTag2> tag2, in MetricTag<TTag3> tag3, in MetricTag<TTag4> tag4, in MetricTag<TTag5> tag5) : base(name, unit, description, options)

Copy link
Collaborator

@deanward81 deanward81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@deanward81 deanward81 merged commit 199994e into StackExchange:master Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants