Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBG-3518: Conditional logging for DocChanged based on collection ID #6508

Merged
merged 5 commits into from
Oct 10, 2023

Conversation

bbrks
Copy link
Member

@bbrks bbrks commented Oct 9, 2023

CBG-3518

Tweak logging from DocChanged for collections

  • Include KV Collection ID in log lines where we don't recognise the collection (too expensive to lookup collection name from here)
  • Add collection name context to all DocChanged logging when we're able to determine it
  • Drop warning to debug and reword when it's an expected condition (DocChange events from another database's _default collection that we want to ignore)
  • Allow AssertLogContains helper to "tee" logs with a MultiWriter to prevent logs going silent during assertions.

Examples:

2023-10-09T17:58:04.542+01:00 [DBG] Changes+: t:TestDocChangedLogging db:db col:sg_test_0 Received #1 after   0ms ("<ud>doc1</ud>" / "1-cd809becc169215072fd567eebd8b8de")
2023-10-09T17:58:04.542+01:00 [DBG] Changes+: t:TestDocChangedLogging db:db col:sg_test_1 Received #2 after   0ms ("<ud>doc1</ud>" / "1-cd809becc169215072fd567eebd8b8de")
2023-10-09T17:58:04.543+01:00 [DBG] Cache+: t:TestDocChangedLogging db:db DocChanged(): Ignoring non-metadata mutation for doc "<ud>doc1</ud>" in the default collection - kv ID: 0

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

@bbrks bbrks requested a review from torcolvin October 9, 2023 17:08
torcolvin
torcolvin previously approved these changes Oct 9, 2023
base/logging.go Show resolved Hide resolved
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.

2 participants