Add OTel to the InMemoryInbox#3562
Conversation
…mments & update inbox tests
# Conflicts: # src/Paramore.Brighter.Outbox.MongoDb/MongoDbOutbox.cs
There was a problem hiding this comment.
Gates Failed
Enforce advisory code health rules
(4 files with Excess Number of Function Arguments, Complex Method)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| InMemoryInbox.cs | 1 advisory rule | 8.82 → 8.55 | Suppress |
| BrighterSpanExtensions.cs | 1 advisory rule | 9.47 → 9.45 | Suppress |
| DynamoDbInbox.cs | 1 advisory rule | no change | Suppress |
| MongoDbInbox.cs | 1 advisory rule | no change | Suppress |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
| public Task AddAsync<T>(T command, string contextKey, RequestContext? requestContext, | ||
| int timeoutInMilliseconds = -1, CancellationToken cancellationToken = default) | ||
| where T : class, IRequest |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
AddAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Ignored as commands are stored in-memory</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task{true}"/> if it exists, otherwise <see cref="Task{false}"/>.</returns> | ||
| public Task<bool> ExistsAsync<T>(string id, string contextKey, RequestContext? requestContext, int timeoutInMilliseconds = -1, |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
ExistsAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Ignored as commands are stored in-memory</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task{T}"/>.</returns> | ||
| public Task<T> GetAsync<T>(string id, string contextKey, RequestContext? requestContext, int timeoutInMilliseconds = -1, |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
GetAsync has 5 arguments, threshold = 4
| /// Provide a string representation of the outbox operation | ||
| /// Provide a string representation of the inbox/outbox operation | ||
| /// </summary> | ||
| public static string ToSpanName(this OutboxDbOperation span) => span switch |
There was a problem hiding this comment.
❌ Getting worse: Complex Method
ToSpanName increases in cyclomatic complexity from 9 to 10, threshold = 9
| /// <param name="timeoutInMilliseconds">Timeout is ignored as DynamoDB handles timeout and retries</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task"/>.</returns> | ||
| public async Task AddAsync<T>(T command, string contextKey, RequestContext requestContext, int timeoutInMilliseconds = -1, CancellationToken cancellationToken = default) where T : class, IRequest |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
AddAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Timeout is ignored as DynamoDB handles timeout and retries</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task{T}"/>.</returns> | ||
| public async Task<T> GetAsync<T>(string id, string contextKey, RequestContext requestContext, int timeoutInMilliseconds = -1, CancellationToken cancellationToken = default) where T : class, IRequest |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
GetAsync has 5 arguments, threshold = 4
| public async Task<bool> ExistsAsync<T>(string id, string contextKey, RequestContext requestContext, int timeoutInMilliseconds = -1, CancellationToken cancellationToken = default) where T : class, IRequest | ||
| { | ||
| try | ||
| { | ||
| var command = await GetCommandAsync<T>(id, contextKey, cancellationToken).ConfigureAwait(ContinueOnCapturedContext); | ||
| return command != null; | ||
| } | ||
| catch (RequestNotFoundException<T>) | ||
| { | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
ExistsAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Timeout is ignored as the timeout is handled by the MongoDb SDK</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task"/>.</returns> | ||
| public async Task AddAsync<T>(T command, string contextKey, RequestContext? requestContext, int timeoutInMilliseconds = -1, |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
AddAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Timeout is ignored as the timeout is handled by the MongoDb SDK</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task{T}"/>.</returns> | ||
| public async Task<T> GetAsync<T>(string id, string contextKey, RequestContext? requestContext, int timeoutInMilliseconds = -1, |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
GetAsync has 5 arguments, threshold = 4
| /// <param name="timeoutInMilliseconds">Timeout is ignored as the timeout is handled by the MongoDb SDK</param> | ||
| /// <param name="cancellationToken">Allow the sender to cancel the operation, if the parameter is supplied</param> | ||
| /// <returns><see cref="Task{true}"/> if it exists, otherwise <see cref="Task{false}"/>.</returns> | ||
| public async Task<bool> ExistsAsync<T>(string id, string contextKey, RequestContext? requestContext, int timeoutInMilliseconds = -1, |
There was a problem hiding this comment.
❌ New issue: Excess Number of Function Arguments
ExistsAsync has 5 arguments, threshold = 4
iancooper
left a comment
There was a problem hiding this comment.
There is a lot here, but this looks good.
|
We just need to check the Sqlite test is not failing because of this change |
There was a problem hiding this comment.
Gates Failed
Enforce advisory code health rules
(4 files with Excess Number of Function Arguments, Complex Method)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| InMemoryInbox.cs | 1 advisory rule | 8.82 → 8.55 | Suppress |
| BrighterSpanExtensions.cs | 1 advisory rule | 9.47 → 9.45 | Suppress |
| DynamoDbInbox.cs | 1 advisory rule | no change | Suppress |
| MongoDbInbox.cs | 1 advisory rule | no change | Suppress |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
@iancooper This was actually broken because of the previous Outbox OTel PR - the constructor signature on the relational database outbox had changed so it wasn't setting the name of the outbox table correctly in the test. I've fixed it here. |
|
Thanks. Will merge |
* Start of adding OTel to InMemoryInbox * Update persistent inboxes with updated interface spec, tidy up XML comments & update inbox tests * Fix broken SQLite test
This PR adds Open Telemetry tracing to the
InMemoryInbox, by reusing theOutboxSpanInfoandOutboxDbOperationclass and enum, with appropriate renaming and updates to support theExistsoperation. It also tidies up XML comments across all Inbox implementations.