Skip to content

Commit

Permalink
Merge pull request #1 from Fydon/personal-changes
Browse files Browse the repository at this point in the history
Attempt to ensure metric names are always unique
  • Loading branch information
Fydon committed Jan 8, 2015
2 parents b298d02 + e401e02 commit a3a6d80
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions newrelic_perfmon_plugin/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override void PollCycle()
try
{
Scope.Connect();
var metricNames = new Dictionary<string, int>();

foreach (Dictionary<string, Object> counter in Counters)
{
Expand Down Expand Up @@ -89,6 +90,15 @@ public override void PollCycle()

string metricName = string.Format("{0}{2}/{1}", categoryName, counterName, instanceName);

if (metricNames.ContainsKey(metricName))
{
metricName = metricName + "#" + metricNames[metricName]++;
}
else
{
metricNames.Add(metricName, 1);
}

logger.Debug("{0}/{1}: {2} {3}", Name, metricName, value, unitValue);

ReportMetric(metricName, unitValue, value);
Expand Down

0 comments on commit a3a6d80

Please sign in to comment.