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 ad2ec22
Showing 1 changed file with 5 additions and 1 deletion.
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,
IgnoreNullValues = true,
#if NETSTANDARD || NETFRAMEWORK
IgnoreNullValues = true,

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (ubuntu-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-experimental

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net462)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net6.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-stable / build-test (windows-latest, net8.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Check failure on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / build-test-solution-experimental / build-test (windows-latest, net7.0)

Check warning on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Elements should have the same indentation

Check warning on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-stable

Elements should have the same indentation

Check warning on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Elements should have the same indentation

Check warning on line 77 in src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs

View workflow job for this annotation

GitHub Actions / lint-dotnet-format / run-dotnet-format-experimental

Elements should have the same indentation
#else
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
#endif
Converters = { new JsonStringEnumConverter(), },
};

Expand Down

0 comments on commit ad2ec22

Please sign in to comment.