Skip to content

Commit

Permalink
Refactor ConsoleActivityExporter to handle null values in JSON serial…
Browse files Browse the repository at this point in the history
…ization
  • Loading branch information
meijeran committed May 2, 2024
1 parent 71a5e84 commit 5a82bc7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public override ExportResult Export(in Batch<Activity> batch)
var options = new JsonSerializerOptions
{
WriteIndented = true,
#if NETSTANDARD || NETFRAMEWORK
IgnoreNullValues = true,
#else
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
#endif
Converters = { new JsonStringEnumConverter(), },
};

Expand Down

0 comments on commit 5a82bc7

Please sign in to comment.