diff --git a/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessageConsumer.cs b/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessageConsumer.cs index 84b9e2524e..47026dc0c8 100644 --- a/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessageConsumer.cs +++ b/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessageConsumer.cs @@ -59,7 +59,7 @@ public MQTTMessageConsumer(MQTTMessagingGatewayConsumerConfiguration configurati { s_logger.LogInformation("MQTTMessageConsumer: Received message from queue {TopicPrefix}", configuration.TopicPrefix); string message = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); - _messageQueue.Enqueue(JsonSerializer.Deserialize(message)); + _messageQueue.Enqueue(JsonSerializer.Deserialize(message, JsonSerialisationOptions.Options)); }); Task connectTask = Connect(configuration.ConnectionAttempts); diff --git a/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessagePublisher.cs b/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessagePublisher.cs index cd5e6c6651..81eb6bc83b 100644 --- a/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessagePublisher.cs +++ b/src/Paramore.Brighter.MessagingGateway.MQTT/MQTTMessagePublisher.cs @@ -89,7 +89,7 @@ public async Task PublishMessageAsync(Message message, CancellationToken cancell private MqttApplicationMessage CreateMqttMessage(Message message) { - string payload = JsonSerializer.Serialize(message); + string payload = JsonSerializer.Serialize(message, JsonSerialisationOptions.Options); MqttApplicationMessageBuilder outMessage = new MqttApplicationMessageBuilder() .WithTopic(_config.TopicPrefix!=null? $"{_config.TopicPrefix}/{message.Header.Topic}": message.Header.Topic) diff --git a/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandler.cs b/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandler.cs index 5ef392c1ea..dd315d55be 100644 --- a/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandler.cs +++ b/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandler.cs @@ -90,12 +90,12 @@ public override TRequest Fallback(TRequest command) private void LogCommand(TRequest request) { - s_logger.LogInformation("Logging handler pipeline call. Pipeline timing {HandlerTiming} target, for {RequestType} with values of {Request} at: {Time}", _timing.ToString(), typeof(TRequest), JsonSerializer.Serialize(request), DateTime.UtcNow); + s_logger.LogInformation("Logging handler pipeline call. Pipeline timing {HandlerTiming} target, for {RequestType} with values of {Request} at: {Time}", _timing.ToString(), typeof(TRequest), JsonSerializer.Serialize(request, JsonSerialisationOptions.Options), DateTime.UtcNow); } private void LogFailure(TRequest request) { - s_logger.LogInformation("Failure in pipeline call for {RequestType} with values of {Request} at: {Time}", typeof(TRequest), JsonSerializer.Serialize(request), DateTime.UtcNow); + s_logger.LogInformation("Failure in pipeline call for {RequestType} with values of {Request} at: {Time}", typeof(TRequest), JsonSerializer.Serialize(request, JsonSerialisationOptions.Options), DateTime.UtcNow); } } } diff --git a/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandlerAsync.cs b/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandlerAsync.cs index 5aada61c6a..7ae40afb79 100644 --- a/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandlerAsync.cs +++ b/src/Paramore.Brighter/Logging/Handlers/RequestLoggingHandlerAsync.cs @@ -92,13 +92,13 @@ public override async Task FallbackAsync(TRequest command, Cancellatio private void LogCommand(TRequest request) { //TODO: LibLog has no async support, so remains a blocking call for now - s_logger.LogInformation("Logging handler pipeline call. Pipeline timing {HandlerTiming} target, for {RequestType} with values of {Request} at: {Time}", _timing.ToString(), typeof(TRequest), JsonSerializer.Serialize(request), DateTime.UtcNow); + s_logger.LogInformation("Logging handler pipeline call. Pipeline timing {HandlerTiming} target, for {RequestType} with values of {Request} at: {Time}", _timing.ToString(), typeof(TRequest), JsonSerializer.Serialize(request, JsonSerialisationOptions.Options), DateTime.UtcNow); } private void LogFailure(TRequest request) { //TODO: LibLog has no async support, so remains a blocking call for now - s_logger.LogInformation("Failure in pipeline call for {RequestType} with values of {Request} at: {Time}", typeof(TRequest), JsonSerializer.Serialize(request), DateTime.UtcNow); + s_logger.LogInformation("Failure in pipeline call for {RequestType} with values of {Request} at: {Time}", typeof(TRequest), JsonSerializer.Serialize(request, JsonSerialisationOptions.Options), DateTime.UtcNow); } } } diff --git a/src/Paramore.Brighter/Observability/BrighterTracer.cs b/src/Paramore.Brighter/Observability/BrighterTracer.cs index 7834016e01..11e241f340 100644 --- a/src/Paramore.Brighter/Observability/BrighterTracer.cs +++ b/src/Paramore.Brighter/Observability/BrighterTracer.cs @@ -24,7 +24,6 @@ THE SOFTWARE. */ #endregion using OpenTelemetry.Trace; - using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -120,7 +119,7 @@ public void AddExceptionToSpan(Activity? span, IEnumerable exceptions { BrighterSemanticConventions.Operation, operation.ToSpanName() }, { BrighterSemanticConventions.RequestId, request.Id }, { BrighterSemanticConventions.RequestType, request.GetType().Name }, - { BrighterSemanticConventions.RequestBody, JsonSerializer.Serialize(request) } + { BrighterSemanticConventions.RequestBody, JsonSerializer.Serialize(request, JsonSerialisationOptions.Options) } }; var activity = ActivitySource.StartActivity( @@ -166,7 +165,7 @@ public void AddExceptionToSpan(Activity? span, IEnumerable exceptions { BrighterSemanticConventions.MessageType, message.Header.MessageType.ToString() }, { BrighterSemanticConventions.MessageBodySize, message.Body.Bytes.Length }, { BrighterSemanticConventions.MessageBody, message.Body.Value }, - { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header) }, + { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options) }, { BrighterSemanticConventions.ConversationId, message.Header.CorrelationId }, { BrighterSemanticConventions.MessagingSystem, messagingSystem.ToMessagingSystemName() }, { BrighterSemanticConventions.CeMessageId, message.Id }, @@ -176,6 +175,7 @@ public void AddExceptionToSpan(Activity? span, IEnumerable exceptions { BrighterSemanticConventions.CeType, message.Header.Type}, { BrighterSemanticConventions.ReplyTo, message.Header.ReplyTo }, { BrighterSemanticConventions.HandledCount, message.Header.HandledCount } + }; var activity = ActivitySource.StartActivity( @@ -491,7 +491,7 @@ public void AddExceptionToSpan(Activity? span, IEnumerable exceptions tags.Add(BrighterSemanticConventions.MessagingDestinationPartitionId, message.Header.PartitionKey); tags.Add(BrighterSemanticConventions.MessageBodySize, message.Body.Bytes.Length); tags.Add(BrighterSemanticConventions.MessageBody, message.Body.Value); - tags.Add(BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header)); + tags.Add(BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options )); tags.Add(BrighterSemanticConventions.ConversationId, message.Header.CorrelationId); //cloud events attributes @@ -565,7 +565,7 @@ public static void WriteMapperEvent( { BrighterSemanticConventions.MessagingDestinationPartitionId, message.Header.PartitionKey }, { BrighterSemanticConventions.MessageBodySize, message.Body.Bytes.Length }, { BrighterSemanticConventions.MessageBody, message.Body.Value }, - { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header) } + { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options) } }; span.AddEvent(new ActivityEvent(mapperName, DateTimeOffset.UtcNow, tags)); @@ -656,7 +656,7 @@ public static void WriteProducerEvent(Activity? span, MessagingSystem messagingS { BrighterSemanticConventions.MessagingDestination, message.Header.Topic }, { BrighterSemanticConventions.MessagingDestinationPartitionId, message.Header.PartitionKey }, { BrighterSemanticConventions.MessageId, message.Id }, - { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header) }, + { BrighterSemanticConventions.MessageHeaders, JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options) }, { BrighterSemanticConventions.MessageType, message.Header.MessageType.ToString() }, { BrighterSemanticConventions.MessageBodySize, message.Body.Bytes.Length }, { BrighterSemanticConventions.MessageBody, message.Body.Value }, diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported.cs index 3656ddae8a..5ae9f6c1b0 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported.cs @@ -168,7 +168,7 @@ public void When_Clearing_A_Message_A_Span_Is_Exported() producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageType && t.Value as string == message.Header.MessageType.ToString()).Should().BeTrue(); producerActivity.TagObjects.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessagingDestination } && t.Value.ToString() == "MyEvent").Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessagingDestinationPartitionId && t.Value as string == message.Header.PartitionKey).Should().BeTrue(); - producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header)).Should().BeTrue(); + producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); producerActivity.TagObjects.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessageBodySize } && (int)t.Value == message.Body.Bytes.Length).Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageBody && t.Value as string == message.Body.Value).Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.ConversationId && t.Value as string == message.Header.CorrelationId).Should().BeTrue(); @@ -187,7 +187,7 @@ public void When_Clearing_A_Message_A_Span_Is_Exported() produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessagingDestinationPartitionId && (string)t.Value == message.Header.PartitionKey).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageId && (string)t.Value == message.Id).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageType && (string)t.Value == message.Header.MessageType.ToString()).Should().BeTrue(); - produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header)).Should().BeTrue(); + produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); produceEvent.Tags.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessageBodySize } && (int)t.Value == message.Body.Bytes.Length).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageBody && (string)t.Value == message.Body.Value).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.ConversationId && (string)t.Value == message.Header.CorrelationId).Should().BeTrue(); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported_Async.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported_Async.cs index fced18f4a6..1c59e33392 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Clear/When_Clearing_A_Message_A_Span_Is_Exported_Async.cs @@ -169,7 +169,7 @@ public async Task When_Clearing_A_Message_A_Span_Is_Exported() producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageType && t.Value as string == message.Header.MessageType.ToString()).Should().BeTrue(); producerActivity.TagObjects.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessagingDestination } && t.Value.ToString() == _topic.Value.ToString()).Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessagingDestinationPartitionId && t.Value as string == message.Header.PartitionKey).Should().BeTrue(); - producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value as string == JsonSerializer.Serialize(message.Header)).Should().BeTrue(); + producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value as string == JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); producerActivity.TagObjects.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessageBodySize } && (int)t.Value == message.Body.Bytes.Length).Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.MessageBody && t.Value as string == message.Body.Value).Should().BeTrue(); producerActivity.TagObjects.Any(t => t.Key == BrighterSemanticConventions.ConversationId && t.Value as string == message.Header.CorrelationId).Should().BeTrue(); @@ -188,7 +188,7 @@ public async Task When_Clearing_A_Message_A_Span_Is_Exported() produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessagingDestinationPartitionId && t.Value as string == message.Header.PartitionKey).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageId && t.Value as string == message.Id).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageType && t.Value as string == message.Header.MessageType.ToString()).Should().BeTrue(); - produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value as string == JsonSerializer.Serialize(message.Header)).Should().BeTrue(); + produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value as string == JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); produceEvent.Tags.Any(t => t is { Value: not null, Key: BrighterSemanticConventions.MessageBodySize } && (int)t.Value == message.Body.Bytes.Length).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageBody && t.Value as string == message.Body.Value).Should().BeTrue(); produceEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.ConversationId && t.Value as string == message.Header.CorrelationId).Should().BeTrue(); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported.cs index 1ad5671dad..c5b83cf78e 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported.cs @@ -117,7 +117,7 @@ public void When_Depositing_A_Request_A_Span_Is_Exported() depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); depositActivity.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); depositActivity.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "deposit" }).Should().BeTrue(); var events = depositActivity.Events.ToList(); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported_Async.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported_Async.cs index d501b91e83..f3aefbcb34 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_A_Request_A_Span_Is_Exported_Async.cs @@ -119,7 +119,7 @@ public async Task When_Depositing_A_Request_A_Span_Is_Exported() depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); depositActivity.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); depositActivity.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "deposit" }).Should().BeTrue(); var events = depositActivity.Events.ToList(); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported.cs index 4e09ac05b3..e3a848f524 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported.cs @@ -130,7 +130,7 @@ public void When_Depositing_A_Request_A_Span_Is_Exported() depositActivity.ParentId.Should().Be(createActivity.Id); depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == events[i].Id).Should().BeTrue(); - depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(events[i])).Should().BeTrue(); + depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(events[i], JsonSerialisationOptions.Options)).Should().BeTrue(); } //TODO: When we deposit multiple we do a bulk write to the Outbox, so we should expect to see a bulk operation at the Db level diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported_Async.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported_Async.cs index 84fec391b0..3eeb425bd3 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Deposit/When_Depositing_Multiple_Requests_Spans_Are_Exported_Async.cs @@ -131,7 +131,7 @@ public async Task When_Depositing_A_Request_A_Span_Is_Exported() depositActivity.ParentId.Should().Be(createActivity.Id); depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == events[i].Id).Should().BeTrue(); - depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(events[i])).Should().BeTrue(); + depositActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(events[i], JsonSerialisationOptions.Options)).Should().BeTrue(); } //TODO: When we deposit multiple we do a bulk write to the Outbox, so we should expect to see a bulk operation at the Db level diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported.cs index 35756e9cba..e5acc3b852 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported.cs @@ -104,7 +104,7 @@ public void When_Publishing_A_Request_With_Span_In_Context_Child_Spans_Are_Expor first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); var activityEvent = first.Events.Single(e => e.Name == nameof(MyEventHandler) || e.Name == nameof(MyOtherEventHandler)); @@ -117,7 +117,7 @@ public void When_Publishing_A_Request_With_Span_In_Context_Child_Spans_Are_Expor second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); activityEvent = second.Events.Single(e => e.Name == nameof(MyEventHandler) || e.Name == nameof(MyOtherEventHandler)); @@ -168,7 +168,7 @@ public void When_Publishing_A_Request_With_Span_In_ActivityCurrent_Child_Spans_A first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); first.Events.Count().Should().Be(1); @@ -182,7 +182,7 @@ public void When_Publishing_A_Request_With_Span_In_ActivityCurrent_Child_Spans_A second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); second.Events.Count().Should().Be(1); @@ -230,7 +230,7 @@ public void When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurrent_A_ first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); first.Events.Count().Should().Be(1); @@ -244,7 +244,7 @@ public void When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurrent_A_ second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); second.Events.Count().Should().Be(1); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported_Asyn.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported_Asyn.cs index 6e31a5502d..582e6468df 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported_Asyn.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Publish/When_Publishing_A_Request_A_Span_Is_Exported_Asyn.cs @@ -105,7 +105,7 @@ public async Task When_Publishing_A_Request_With_Span_In_Context_Child_Spans_Are first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); first.Events.Count().Should().Be(1); @@ -119,7 +119,7 @@ public async Task When_Publishing_A_Request_With_Span_In_Context_Child_Spans_Are second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); second.Events.Count().Should().Be(1); @@ -171,7 +171,7 @@ public async Task When_Publishing_A_Request_With_Span_In_ActivityCurrent_Child_S first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); first.Events.Count().Should().Be(1); @@ -185,7 +185,7 @@ public async Task When_Publishing_A_Request_With_Span_In_ActivityCurrent_Child_S second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); second.Events.Count().Should().Be(1); @@ -233,7 +233,7 @@ public async Task When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurr first.ParentId.Should().Be(createActivity.Id); first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + first.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); first.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); first.Events.Count().Should().Be(1); @@ -247,7 +247,7 @@ public async Task When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurr second.ParentId.Should().Be(createActivity.Id); second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == @event.Id).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyEvent) }).Should().BeTrue(); - second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event)).Should().BeTrue(); + second.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(@event, JsonSerialisationOptions.Options)).Should().BeTrue(); second.Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "publish" }).Should().BeTrue(); second.Events.Count().Should().Be(1); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported.cs index 6de22da80f..d3072bb918 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported.cs @@ -82,7 +82,7 @@ public void When_Sending_A_Request_With_Span_In_Context_A_Child_Span_Is_Exported _exportedActivities.First().ParentId.Should().Be(parentActivity?.Id); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); @@ -115,7 +115,7 @@ public void When_Sending_A_Request_With_Span_In_ActivityCurrent_A_Child_Span_Is_ _exportedActivities.First().ParentId.Should().Be(parentActivity?.Id); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); @@ -144,7 +144,7 @@ public void When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurrent_A_ _exportedActivities.First().ParentId.Should().BeNull(); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported_Async.cs b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported_Async.cs index 3e49111dba..9fd0272858 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/CommandProcessor/Send/When_Sending_A_Request_A_Span_Is_Exported_Async.cs @@ -85,7 +85,7 @@ public async Task When_Sending_A_Request_With_Span_In_Context_A_Child_Span_Is_Ex _exportedActivities.First().ParentId.Should().Be(parentActivity.Id); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); @@ -118,7 +118,7 @@ public async Task When_Sending_A_Request_With_Span_In_ActivityCurrent_A_Child_Sp _exportedActivities.First().ParentId.Should().Be(parentActivity.Id); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); @@ -147,7 +147,7 @@ public async Task When_Sending_A_Request_With_No_Context_Or_Span_In_ActivityCurr _exportedActivities.First().ParentId.Should().BeNull(); _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && t.Value == command.Id).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.RequestType, Value: nameof(MyCommand) }).Should().BeTrue(); - _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command)).Should().BeTrue(); + _exportedActivities.First().Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && t.Value == JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); _exportedActivities.First().Tags.Any(t => t is { Key: BrighterSemanticConventions.Operation, Value: "send" }).Should().BeTrue(); _exportedActivities.First().Events.Count().Should().Be(1); diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Message_Mapper_Add_Brighter_Semantic_Conventions.cs b/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Message_Mapper_Add_Brighter_Semantic_Conventions.cs index 807c3ffed2..698a484813 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Message_Mapper_Add_Brighter_Semantic_Conventions.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Message_Mapper_Add_Brighter_Semantic_Conventions.cs @@ -69,6 +69,6 @@ public void When_Creating_A_Message_Mapper_Add_Brighter_Semantic_Conventions() childEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessagingDestinationPartitionId && (string)t.Value == paritionKey).Should().BeTrue(); childEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageBody && (string)t.Value == message.Body.Value).Should().BeTrue(); childEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageBodySize && (int)t.Value == message.Body.Value.Length).Should().BeTrue(); - childEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header)).Should().BeTrue(); + childEvent.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && (string)t.Value == JsonSerializer.Serialize(message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); } } diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Span_Add_Brighter_Semantic_Conventions.cs b/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Span_Add_Brighter_Semantic_Conventions.cs index 4a1b39ab82..da0dc953fb 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Span_Add_Brighter_Semantic_Conventions.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/Common/When_Creating_A_Span_Add_Brighter_Semantic_Conventions.cs @@ -66,7 +66,7 @@ public void When_Creating_A_Span_Add_Brighter_Semantic_Conventions() tagDictionary.Should().ContainKey(BrighterSemanticConventions.RequestType); tagDictionary[BrighterSemanticConventions.RequestType].Should().Be(command.GetType().Name); tagDictionary.Should().ContainKey(BrighterSemanticConventions.RequestBody); - tagDictionary[BrighterSemanticConventions.RequestBody].Should().Be(System.Text.Json.JsonSerializer.Serialize(command)); + tagDictionary[BrighterSemanticConventions.RequestBody].Should().Be(System.Text.Json.JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)); tagDictionary.Should().ContainKey(BrighterSemanticConventions.Operation); tagDictionary[BrighterSemanticConventions.Operation].Should().Be(CommandProcessorSpanOperation.Send.ToSpanName()); @@ -79,7 +79,7 @@ public void When_Creating_A_Span_Add_Brighter_Semantic_Conventions() childSpan.ParentId.Should().Be(_parentActivity.Id); childSpan.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestId && (string)t.Value == command.Id.ToString()).Should().BeTrue(); childSpan.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestType && (string)t.Value == command.GetType().Name).Should().BeTrue(); - childSpan.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && (string)t.Value == System.Text.Json.JsonSerializer.Serialize(command)).Should().BeTrue(); + childSpan.Tags.Any(t => t.Key == BrighterSemanticConventions.RequestBody && (string)t.Value == System.Text.Json.JsonSerializer.Serialize(command, JsonSerialisationOptions.Options)).Should().BeTrue(); childSpan.Tags.Any(t => t.Key == BrighterSemanticConventions.Operation && (string)t.Value == CommandProcessorSpanOperation.Send.ToSpanName()).Should().BeTrue(); } diff --git a/tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Is_Dispatched_It_Should_Begin_A_Span.cs b/tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Is_Dispatched_It_Should_Begin_A_Span.cs index aee0506f71..c5e5cacd81 100644 --- a/tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Is_Dispatched_It_Should_Begin_A_Span.cs +++ b/tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Is_Dispatched_It_Should_Begin_A_Span.cs @@ -145,7 +145,7 @@ public void When_a_message_is_dispatched_it_should_begin_a_span() createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageType && t.Value == _message.Header.MessageType.ToString()).Should().BeTrue(); createActivity.TagObjects.Any(t => t.Value != null && t.Key == BrighterSemanticConventions.MessageBodySize && Convert.ToInt32(t.Value) == _message.Body.Bytes.Length).Should().BeTrue(); createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageBody && t.Value == _message.Body.Value).Should().BeTrue(); - createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value == JsonSerializer.Serialize(_message.Header)).Should().BeTrue(); + createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.MessageHeaders && t.Value == JsonSerializer.Serialize(_message.Header, JsonSerialisationOptions.Options)).Should().BeTrue(); createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.ConversationId && t.Value == _message.Header.CorrelationId).Should().BeTrue(); createActivity.Tags.Any(t => t.Key == BrighterSemanticConventions.MessagingSystem && t.Value == MessagingSystem.InternalBus.ToMessagingSystemName()).Should().BeTrue(); createActivity.TagObjects.Any(t => t.Value != null && t.Key == BrighterSemanticConventions.CeSource && ((Uri)(t.Value)) == _message.Header.Source).Should().BeTrue();