Skip to content

Commit

Permalink
Fix Metric console exporter to respect Console and Debug flags (#2815)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Jan 26, 2022
1 parent dae889d commit 2eb46a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/OpenTelemetry.Exporter.Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

Fix MetricExporter to respect Console and Debug flags.

## 1.2.0-rc1

Released 2021-Nov-29
Expand Down
7 changes: 3 additions & 4 deletions src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.
// </copyright>

using System;
using System.Globalization;
using System.Text;
using OpenTelemetry.Metrics;
Expand Down Expand Up @@ -42,7 +41,7 @@ public override ExportResult Export(in Batch<Metric> batch)
{
if (resourceAttribute.Key.Equals("service.name"))
{
Console.WriteLine("Service.Name" + resourceAttribute.Value);
this.WriteLine("Service.Name" + resourceAttribute.Value);
}
}
}
Expand Down Expand Up @@ -73,7 +72,7 @@ public override ExportResult Export(in Batch<Metric> batch)
}
}

Console.WriteLine(msg.ToString());
this.WriteLine(msg.ToString());

foreach (ref readonly var metricPoint in metric.GetMetricPoints())
{
Expand Down Expand Up @@ -174,7 +173,7 @@ public override ExportResult Export(in Batch<Metric> batch)
msg.Append(metric.MetricType);
msg.AppendLine();
msg.Append($"Value: {valueDisplay}");
Console.WriteLine(msg);
this.WriteLine(msg.ToString());
}
}

Expand Down

0 comments on commit 2eb46a8

Please sign in to comment.