/// <summary>
		/// Lê os dados serializados.
		/// </summary>
		/// <param name="reader"></param>
		void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
		{
			if(reader.MoveToAttribute("name"))
				Name = reader.ReadContentAsString();
			if(reader.MoveToAttribute("isInstance"))
				IsInstance = reader.ReadContentAsBoolean();
			if(reader.MoveToAttribute("type"))
			{
				var type = reader.ReadContentAsString();
				Type = !string.IsNullOrEmpty(type) ? new Reflection.TypeName(reader.ReadContentAsString()) : null;
			}
			if(reader.MoveToAttribute("inputRulesGroup"))
			{
				var inputRulesGroupUid = reader.ReadContentAsString();
				InputRulesGroupUid = !string.IsNullOrEmpty(inputRulesGroupUid) ? (Guid?)Guid.Parse(inputRulesGroupUid) : null;
			}
			reader.MoveToElement();
			if(!reader.IsEmptyElement)
			{
				reader.ReadStartElement();
				while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
				{
					if(reader.LocalName == "DefaultLabels" && !reader.IsEmptyElement)
					{
						reader.ReadStartElement();
						while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
						{
							if(reader.LocalName == "PropertyDefaultLabel")
							{
								var label = new PropertyDefaultLabel();
								((System.Xml.Serialization.IXmlSerializable)label).ReadXml(reader);
								DefaultLabels.Add(label);
							}
							else
								reader.Skip();
						}
						reader.ReadEndElement();
					}
					else
						reader.Skip();
				}
				reader.ReadEndElement();
			}
			else
				reader.Skip();
		}
예제 #2
0
 /// <summary>
 /// Creates the full set of labels supported for the current metric.
 ///
 /// This merges (in unspecified order) the defaults from prometheus-net with any in options.AdditionalRouteParameters.
 /// </summary>
 private string[] CreateDefaultLabelSet()
 {
     return(DefaultLabels.Concat(_additionalRouteParameters.Select(x => x.LabelName)).ToArray());
 }
 /// <summary>
 /// Creates the full set of labels supported for the current metric.
 ///
 /// This merges (in unspecified order) the defaults from prometheus-net with any in options.AdditionalRouteParameters.
 /// </summary>
 private string[] CreateDefaultLabelSet() =>
 DefaultLabels
 .Concat(_additionalRouteParameters.Select(x => x.LabelName))
 .Concat(_additionalLabels.Select(x => x.Key))
 .ToArray();