-
Notifications
You must be signed in to change notification settings - Fork 731
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
Dynamically resolved metadata (normalized_metadata) in core #2048
base: master
Are you sure you want to change the base?
Commits on Feb 5, 2023
-
Partially an exercise in "how bad would it be?" This allows the removal of the unsafety in tracing-log's LogVisitor (see next commit), as well as generalization of NormalizeEvent to more RecordField containers.
Configuration menu - View commit details
-
Copy full SHA for d4c8525 - Browse repository at this point
Copy the full SHA d4c8525View commit details -
Remove unsafety in tracing-log impl
Changes like this are the purpose of the previous commit. Now that Visit has a lifetime parameter, it can be used to extract &str data in a safe and general manner. While tracing-log is already sound (as indicated by this safe impl being valid), the lifetime unlocks more generic uses.
Configuration menu - View commit details
-
Copy full SHA for 25d2f5e - Browse repository at this point
Copy the full SHA 25d2f5eView commit details -
Uplift trait RecordFields to tracing-core
For the time being, it's also been unsealed. There doesn't seem to be a specific reason to seal it, other than it just existing to generalize over the provided types, and not being an input generalization. It can be resealed without issue; however, it being in tracing-core is necessary for what's coming up.
Configuration menu - View commit details
-
Copy full SHA for cba568c - Browse repository at this point
Copy the full SHA cba568cView commit details -
Remove 'static requirement from Metadata::name
Yes, I'm as surprised as you are that this causes 0 issues.
Configuration menu - View commit details
-
Copy full SHA for c001fea - Browse repository at this point
Copy the full SHA c001feaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6afe420 - Browse repository at this point
Copy the full SHA 6afe420View commit details -
Implement dynamic metadata injection
Now that places are using non-'static metadata, we can overlay a patched view of the metadata. Using the strategy seen in tracing-log, we recognize specifically named metadata/fields and use the values they provide to create metadata with the resolved runtime values. Importantly, we also strive to only expose dynamic injection fields when explicitly asked for. This means that most code can continue on without knowing that these fields even exist. Applying these patches does have a cost; notably, things which used to deal in references like &Metadata or &FieldSet now often use an owned, patched version instead. These types are primarily bags of references themselves, and no copying of actual data is involved, but the fact that the bags of references (which aren't exactly tiny) are copied does have an impact. More places which don't have to deal with metadata patching (e.g. the macro support code) should be audited for what can use the _prenormal versions of methods. Additionally, there are likely places where the magic fields leak out without being explicitly asked for. Ideally, these are all bugs which can be fixed. There aren't really any tests that effectively check for this, so new tests will need to be written. Finaly, there's the question of actually dispatching such a dynamic event. tracing-log is an example of doing so (but uses touchy, hidden API to construct the ValueSet) (implemented in the next commit), but a generally applicable is likely desirable. This will probably take the shape of dynamic_span! and dynamic_event! macros in tracing proper.
Configuration menu - View commit details
-
Copy full SHA for 72ab527 - Browse repository at this point
Copy the full SHA 72ab527View commit details -
Implement tracing-log on core dynamic metadata
And now we reach the point of this commit series. tracing-log is now capable of implementing its dynamic metadata resolution on solely publicly available APIs*, and thus so can anyone else do the same. *Dispatch still uses #[doc(hidden)] APIs to create the value set. Figuring out how to best expose is still an open question.
Configuration menu - View commit details
-
Copy full SHA for 6d8bce1 - Browse repository at this point
Copy the full SHA 6d8bce1View commit details