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

allow a 'message' field in an event schema #72

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

Zsailer
Copy link
Member

@Zsailer Zsailer commented Apr 10, 2023

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)

Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

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

This is a big usability win @Zsailer - thank you! I do have one question regarding OVP properties.

jupyter_events/logger.py Outdated Show resolved Hide resolved
jupyter_events/schema.py Show resolved Hide resolved
Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

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

Thank you @Zsailer - this will be helpful!

@kevin-bates kevin-bates merged commit ebbebf8 into jupyter:main Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants