Skip to content

Commit

Permalink
Fix Console metric exporter null reference (#5099)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishweshbankwar committed Nov 29, 2023
1 parent a47b222 commit 014d5a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ public override ExportResult Export(in Batch<Metric> batch)

this.WriteLine(msg.ToString());

foreach (var meterTag in metric.MeterTags)
if (metric.MeterTags != null)
{
this.WriteLine("\tMeter Tags:");
if (ConsoleTagTransformer.Instance.TryTransformTag(meterTag, out var result))
foreach (var meterTag in metric.MeterTags)
{
this.WriteLine($"\t\t{result}");
this.WriteLine("\tMeter Tags:");
if (ConsoleTagTransformer.Instance.TryTransformTag(meterTag, out var result))
{
this.WriteLine($"\t\t{result}");
}
}
}

Expand Down

0 comments on commit 014d5a1

Please sign in to comment.