public TableauInstrumentationCounter(IMBeanClient mbeanClient, Host host, string sourceName, string subDomain, string path, string categoryName, string counterName, string instanceName, string unit) : base(mbeanClient: mbeanClient, lifecycleType: CounterLifecycleType.Ephemeral, counterType: TableauInstrumentationCounterType, jmxDomain: TableauInstrumentationJmxDomain.JoinIfNotNull(".", subDomain), host: host, source: sourceName, filter: path, category: categoryName, counter: counterName, instance: instanceName, unit: unit) { }
protected AbstractMBeanCounter(IMBeanClient mbeanClient, string counterType, string jmxDomain, Host host, string source, string filter, string category, string counter, string instance, string unit) { Host = host; CounterType = counterType; Source = source; Category = category; Counter = counter; Instance = instance; Unit = unit; MBeanClient = mbeanClient; JmxDomain = jmxDomain; Path = filter; }
/// <summary> /// Builds an ICounter instance from a counter XML node and a set of properties. /// </summary> private static ICounter BuildCounterFromCounterNode(XmlNode counterNode, IMBeanClient mbeanClient, Host host, string sourceName, int startPort) { var counterName = counterNode.Attributes["name"].Value; var categoryName = counterNode.ParentNode.Attributes["name"].Value; var path = counterNode.ParentNode.Attributes["path"].Value; string unitOfMeasurement = null; if (counterNode.Attributes.GetNamedItem("unit") != null) { unitOfMeasurement = counterNode.Attributes["unit"].Value; } var instanceName = BuildInstanceName(sourceName, startPort, mbeanClient.Connector.ConnectionInfo.Port); var rootCounterTypeNode = counterNode.ParentNode.ParentNode; var counterType = rootCounterTypeNode.Name.ToLower(); string subDomain = null; if (rootCounterTypeNode.Attributes != null && rootCounterTypeNode.Attributes["subdomain"] != null) { subDomain = rootCounterTypeNode.Attributes["subdomain"].Value; } // Create the counter. try { var builder = new MBeanBuilder(); return(builder.CreateCounter(host) .UsingClient(mbeanClient) .WithSourceName(sourceName) .WithSubDomain(subDomain) .WithPath(path) .WithCategoryName(categoryName) .WithCounterName(counterName) .WithInstanceName(instanceName) .WithUnit(unitOfMeasurement) .Build(counterType)); } catch (Exception ex) { Log.DebugFormat(@"Failed to register MBean counter {0}\{1}\{2}\{3}\{4}: {5}", host.Address, sourceName, categoryName, counterName, instanceName, ex.Message); return(null); } }
/// <summary> /// Builds an ICounter instance from a counter XML node and a set of properties. /// </summary> private static ICounter BuildCounterFromCounterNode(XmlNode counterNode, IMBeanClient mbeanClient, Host host, string sourceName, int startPort) { var counterName = counterNode.Attributes["name"].Value; var categoryName = counterNode.ParentNode.Attributes["name"].Value; var path = counterNode.ParentNode.Attributes["path"].Value; string unitOfMeasurement = null; if (counterNode.Attributes.GetNamedItem("unit") != null) { unitOfMeasurement = counterNode.Attributes["unit"].Value; } var instanceName = BuildInstanceName(sourceName, startPort, mbeanClient.Connector.ConnectionInfo.Port); var rootCounterTypeNode = counterNode.ParentNode.ParentNode; var counterType = rootCounterTypeNode.Name.ToLower(); string subDomain = null; if (rootCounterTypeNode.Attributes != null && rootCounterTypeNode.Attributes["subdomain"] != null) { subDomain = rootCounterTypeNode.Attributes["subdomain"].Value; } // Create the counter. try { var builder = new MBeanBuilder(); return builder.CreateCounter(host) .UsingClient(mbeanClient) .WithSourceName(sourceName) .WithSubDomain(subDomain) .WithPath(path) .WithCategoryName(categoryName) .WithCounterName(counterName) .WithInstanceName(instanceName) .WithUnit(unitOfMeasurement) .Build(counterType); } catch (Exception ex) { Log.DebugFormat(@"Failed to register MBean counter {0}\{1}\{2}\{3}\{4}: {5}", host.Name, sourceName, categoryName, counterName, instanceName, ex.Message); return null; } }
public TableauHealthCounter(IMBeanClient mbeanClient, Host host, string sourceName, string path, string categoryName, string counterName, string instanceName, string unit) : base(mbeanClient: mbeanClient, counterType: TableauHealthCounterType, jmxDomain: TableauHealthJmxDomain, host: host, source: sourceName, filter: path, category: categoryName, counter: counterName, instance: instanceName, unit: unit) { }
public JavaHealthCounter(IMBeanClient mbeanClient, Host host, string sourceName, string path, string categoryName, string counterName, string instanceName, string unit) : base(mbeanClient: mbeanClient, counterType: JavaHealthCounterType, jmxDomain: JavaHealthJmxDomain, host: host, source: sourceName, filter: path, category: categoryName, counter: counterName, instance: instanceName, unit: unit) { }
/// <summary> /// Builds a collection of ICounter instances from a source XML node. /// </summary> private List <ICounter> BuildCountersForSourceNode(XmlNode sourceNode, Host host, IMBeanClient mbeanClient, int startPort) { string sourceName = sourceNode.Attributes["name"].Value; var counterNodesForSource = sourceNode.SelectNodes(".//Counter"); var counters = new List <ICounter>(); if (counterNodesForSource != null) { foreach (XmlNode counterNode in counterNodesForSource) { var counter = BuildCounterFromCounterNode(counterNode, mbeanClient, host, sourceName, startPort); if (counter != null) { counters.Add(counter); } } } return(counters); }
public TableauHealthCounter(IMBeanClient mbeanClient, Host host, string sourceName, string path, string categoryName, string counterName, string instanceName, string unit) : base(mbeanClient: mbeanClient, lifecycleType: CounterLifecycleType.Persistent, counterType: TableauHealthCounterType, jmxDomain: TableauHealthJmxDomain, host: host, source: sourceName, filter: path, category: categoryName, counter: counterName, instance: instanceName, unit: unit) { }
public MBeanBuilder UsingClient(IMBeanClient client) { Client = client; return(this); }
/// <summary> /// Builds a collection of ICounter instances from a source XML node. /// </summary> private List<ICounter> BuildCountersForSourceNode(XmlNode sourceNode, Host host, IMBeanClient mbeanClient, int startPort) { string sourceName = sourceNode.Attributes["name"].Value; var counterNodesForSource = sourceNode.SelectNodes(".//Counter"); var counters = new List<ICounter>(); if (counterNodesForSource != null) { foreach (XmlNode counterNode in counterNodesForSource) { var counter = BuildCounterFromCounterNode(counterNode, mbeanClient, host, sourceName, startPort); if (counter != null) { counters.Add(counter); } } } return counters; }
public MBeanBuilder UsingClient(IMBeanClient client) { Client = client; return this; }
public JavaHealthCounter(IMBeanClient mbeanClient, Host host, string sourceName, string path, string categoryName, string counterName, string instanceName, string unit) : base(mbeanClient: mbeanClient, lifecycleType: CounterLifecycleType.Persistent, counterType: JavaHealthCounterType, jmxDomain: JavaHealthJmxDomain, host: host, source: sourceName, filter: path, category: categoryName, counter: counterName, instance: instanceName, unit: unit) { }