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)
 {
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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)
 {
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
        /// <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);
            }
        }
Ejemplo n.º 6
0
        /// <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;
            }
        }
Ejemplo n.º 7
0
 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)
 {
 }
Ejemplo n.º 8
0
 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) { }
Ejemplo n.º 9
0
        /// <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);
        }
Ejemplo n.º 10
0
 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)
 {
 }
Ejemplo n.º 11
0
 public MBeanBuilder UsingClient(IMBeanClient client)
 {
     Client = client;
     return(this);
 }
Ejemplo n.º 12
0
        /// <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;
        }
Ejemplo n.º 13
0
 public MBeanBuilder UsingClient(IMBeanClient client)
 {
     Client = client;
     return this;
 }
Ejemplo n.º 14
0
 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)
 {
 }