Skip to content

Improve logging by adding a scope and better handling of inner exceptions#281

Merged
alexeyzimarev merged 7 commits intoEventuous:devfrom
fbjerggaard:logging-improvements
Nov 16, 2023
Merged

Improve logging by adding a scope and better handling of inner exceptions#281
alexeyzimarev merged 7 commits intoEventuous:devfrom
fbjerggaard:logging-improvements

Conversation

@fbjerggaard
Copy link
Copy Markdown
Contributor

This PR adds a scope to all log messages which makes them easier to filter out by SubscriptionId when filtering in a logging system that supports it.

It also fixes some nullreferenced inner exceptions I encountered at times by making all inner exceptions nullable

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 1, 2023

Test Results

  32 files   -   16    32 suites   - 16   10m 56s ⏱️ +17s
132 tests  -     2  132 ✔️  -     2  0 💤 ±0  0 ±0 
260 runs   - 130  260 ✔️  - 130  0 💤 ±0  0 ±0 

Results for commit d3bfed9. ± Comparison against base commit a66fb59.

This pull request removes 6 and adds 4 tests. Note that renamed tests count towards both.
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 4, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 8, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:47, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 4, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 8, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:49, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 4, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 8, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 11:55:52, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 4, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 8, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:06:52, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 4, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  })
Eventuous.Tests.Subscriptions.SequenceTests ‑ ShouldReturnFirstBefore(sequence: [CommitPosition { Position = 0, Sequence = 1, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 6, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }, CommitPosition { Position = 0, Sequence = 8, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  }], expected: CommitPosition { Position = 0, Sequence = 2, Timestamp = 10/12/2023 13:07:17, Valid = True, LogContext =  })

♻️ This comment has been updated with latest results.

@alexeyzimarev alexeyzimarev merged commit 134b66c into Eventuous:dev Nov 16, 2023
public AggregateNotFoundException(Type aggregateType, StreamName streamName, Exception inner)
: base($"Aggregate {aggregateType.Name} with not found in stream {streamName}. {inner.Message} {inner.InnerException?.Message}", inner) { }
public AggregateNotFoundException(Type aggregateType, StreamName streamName, Exception? inner)
: base($"Aggregate {aggregateType.Name} with not found in stream {streamName}", inner) { }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence does not make sense, maybe remove 'with', or make it something like 'No events for Aggregate {name} found in {streamName}' ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - I didn't catch this while going through this. I might go through the error messages and make sure they are sensible and makes sense sometime during the weekend

@fbjerggaard fbjerggaard deleted the logging-improvements branch November 17, 2023 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants