/// <summary> /// Initializes a new instance of the <see cref="MetricConfig"/> class by /// using the given name and tags. /// </summary> /// <param name="name"> /// A string that, in conjuction with the tags, uniquely identifies a /// metric. /// </param> /// <param name="tag"> /// The single and unique tag of the config. /// </param> public MetricConfig(string name, Tag tag) : this(name, new Tags(tag)) { }
/// <summary> /// Gets a copy of the current <see cref="MetricConfig"/> with an /// additional <see cref="Tag"/> /// </summary> /// <returns> /// A <see cref="MetricConfig"/> whose name is equals to /// <see cref="Name"/> and tags is a concatenation of the <see cref="Tags"/> /// and the given <paramref name="tag"/> /// </returns> public MetricConfig WithAdditionalTag(Tag tag) { return new MetricConfig(Name, new Tags.Builder(Tags) .WithTag(tag) .Build()); }
/// <summary> /// Determines whether the specified <paramref name="tag"/> is equal to the /// current <see cref="Tag"/> object. /// </summary> /// <param name="tag"> /// The <see cref="Tag"/> to compare with the current <see cref="Tag"/> /// object. /// </param> /// <returns> /// <c>true</c> if <paramref name="tag"/> and the current <see cref="Tag"/> /// object represents the same object; ohtherwise, <c>false</c>. /// </returns> public bool Equals(Tag tag) { if ((object) tag == null) { return false; } return Name == tag.Name && Value == tag.Value; }