Cleaner syntax for linking event schemas to event methods #57
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.
This is a syntax sugar. It adds a new decorator,
event_schema
, that can be called above a method to describe what telemetry data is collected by that method. This cleanly separates the telemetry definition logic from the application logic.Before:
After this PR:
Normally, I don't think this kind of syntax sugar is necessary. In this case, though, it makes the code more readable. You can quickly scan through multiple methods to see which methods emit telemetry data and what data each method emits. No need to sift through the source code of the methods themselves.
This is fully backwards compatible. It's merely for readability.