Skip to content

Commit 2eb46a8

Browse files
authored
Fix Metric console exporter to respect Console and Debug flags (#2815)
1 parent dae889d commit 2eb46a8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/OpenTelemetry.Exporter.Console/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
Fix MetricExporter to respect Console and Debug flags.
6+
57
## 1.2.0-rc1
68

79
Released 2021-Nov-29

src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// limitations under the License.
1515
// </copyright>
1616

17-
using System;
1817
using System.Globalization;
1918
using System.Text;
2019
using OpenTelemetry.Metrics;
@@ -42,7 +41,7 @@ public override ExportResult Export(in Batch<Metric> batch)
4241
{
4342
if (resourceAttribute.Key.Equals("service.name"))
4443
{
45-
Console.WriteLine("Service.Name" + resourceAttribute.Value);
44+
this.WriteLine("Service.Name" + resourceAttribute.Value);
4645
}
4746
}
4847
}
@@ -73,7 +72,7 @@ public override ExportResult Export(in Batch<Metric> batch)
7372
}
7473
}
7574

76-
Console.WriteLine(msg.ToString());
75+
this.WriteLine(msg.ToString());
7776

7877
foreach (ref readonly var metricPoint in metric.GetMetricPoints())
7978
{
@@ -174,7 +173,7 @@ public override ExportResult Export(in Batch<Metric> batch)
174173
msg.Append(metric.MetricType);
175174
msg.AppendLine();
176175
msg.Append($"Value: {valueDisplay}");
177-
Console.WriteLine(msg);
176+
this.WriteLine(msg.ToString());
178177
}
179178
}
180179

0 commit comments

Comments
 (0)