allow a 'message' field in an event schema #72
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
jupyter_events implicitly doesn't allow "message" to be a property of an event schema. Because "message" is a common enough field name for events, this PR special-cases this key and allows it to be used in event schemas.
The issue was that Python's logging library uses the "message" field for other purposes. In the early days of jupyter_events, "message" caused issues for us, because the native
Logger
objects always wanted to emit the "message" field, even if it wasn't in the event schema. As a simple fix, we stripped "message" from the event data and made "message" a disallowed field in jupyter_events. That said, we made things confusing by not explicitly invalidating schemas that included "message" in the schema; rather, we just silently removed this key.Either way, we need a fix for this. This PR makes "message" an allowed field, and ensures it's only emitted when it's found in the schema.
See the discussion here for some motivation: jupyter-server/jupyter_server#1252 (comment)