Skip to content

Commit

Permalink
Merge pull request #215 from tableau/dev
Browse files Browse the repository at this point in the history
Fixing TabMon Config Loader
  • Loading branch information
danjrahm authored Feb 12, 2019
2 parents b4bb298 + e957fdd commit 414bb2e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
1 change: 0 additions & 1 deletion DataTableWriter/Drivers/PostgresDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace DataTableWriter.Drivers
{
Expand Down
4 changes: 1 addition & 3 deletions DataTableWriter/Writers/IPurgeableDatasource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Data;

namespace DataTableWriter.Writers
namespace DataTableWriter.Writers
{
public interface IPurgeableDatasource
{
Expand Down
28 changes: 19 additions & 9 deletions TabMon/CounterConfig/MBeanCounterConfigReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ICollection<ICounter> LoadCounters(XmlNode root, Host host, CounterLifecy
{
foreach (XmlNode sourceNode in sourceNodes)
{
ICollection<IMBeanClient> mbeanClientPool;
ICollection<IMBeanClient> mbeanClientPool = null;
if (!host.SpecifyPorts)
{
var startPort = Convert.ToInt32(sourceNode.Attributes["startport"].Value);
Expand All @@ -51,17 +51,27 @@ public ICollection<ICounter> LoadCounters(XmlNode root, Host host, CounterLifecy
else
{
var processName = sourceNode.Attributes["name"].Value;
var ports = host.Processes[processName];

// Retrieve a collection of all available clients within the specified port range, then new up counters using those.
// This way, multiple counters can share a single client & connection.
mbeanClientPool = MBeanClientFactory.CreateClients(host.Address, ports);
if (host.Processes.ContainsKey(processName))
{
var ports = host.Processes[processName];

// Retrieve a collection of all available clients within the specified port range, then new up counters using those.
// This way, multiple counters can share a single client & connection.
mbeanClientPool = MBeanClientFactory.CreateClients(host.Address, ports);
}
else
{
Log.DebugFormat("Process \"{0}\" is not contained in host section. Continuing..", processName);
}
}

foreach (var mbeanClient in mbeanClientPool)
if (mbeanClientPool != null)
{
var countersForSource = BuildCountersForSourceNode(sourceNode, host, mbeanClient);
counters.AddRange(countersForSource);
foreach (var mbeanClient in mbeanClientPool)
{
var countersForSource = BuildCountersForSourceNode(sourceNode, host, mbeanClient);
counters.AddRange(countersForSource);
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions TabMon/Helpers/Process.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;

namespace TabMon.Helpers
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion TabMon/TabMonConfig/TabMonConfigReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Configuration;
using System.IO;
using System.Reflection;
using TabMon.Helpers;

namespace TabMon.Config
{
Expand Down
1 change: 0 additions & 1 deletion TabMonConfigBuilder/CommandLineOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using CommandLine;
using CommandLine.Text;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down
3 changes: 0 additions & 3 deletions TabMonConfigBuilder/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using CommandLine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace TabMonConfigBuilder
{
Expand Down
2 changes: 0 additions & 2 deletions TabMonConfigBuilder/TabMonConfigBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TabMonConfigBuilder.Helpers;

namespace TabMonConfigBuilder
Expand Down

0 comments on commit 414bb2e

Please sign in to comment.