Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.08k stars 648 forks source link

Structured Logging for Delayed Retry Warnings #7108

Open atruskot opened 1 month ago

atruskot commented 1 month ago

Describe the suggested improvement

Is your improvement related to a problem? Please describe.

Aggregation and reporting of the following warning log message is difficult as the message template isn't formatted as expected.

https://github.com/Particular/NServiceBus/blob/d7b35c19cdc1856ffd7753f77d8713f031650b7c/src/NServiceBus.Core/Recoverability/DelayedRetry.cs#L38

Describe the suggested solution

Define fields for use in structured logs to be rendered like:

{
    "MessageTemplate": "Delayed Retry will reschedule message '{@MessageId}' after a delay of {@Delay} because of an exception: {@Exception}",
    "RenderedMessage": "Delayed Retry will reschedule message '54376023-b96f-4555-9777-b1b000ea062a' after a delay of 00:00:11.9860000 because of an exception: exception text..",
    "MessageId": "54376023-b96f-4555-9777-b1b000ea062a",
    "Delay": "00:00:11.9860000",
    "Exception": "exception text..."
}

rather than:

{
    "MessageTemplate": "Delayed Retry will reschedule message '54376023-b96f-4555-9777-b1b000ea062a' after a delay of 00:00:11.9860000 because of an exception:",
    "RenderedMessage": "Delayed Retry will reschedule message '54376023-b96f-4555-9777-b1b000ea062a' after a delay of 00:00:11.9860000 because of an exception:",
    "Exception": "exception text..."
}

Describe alternatives you've considered

None.

Additional Context

No response

tmasternak commented 1 month ago

Hi @atruskot, thank you for your feedback. We will consider this during our upcoming enhancement releases.