feat: generate schema-based context, observer, handle with instrumentation-build#249
Draft
johanpel wants to merge 6 commits into
Draft
feat: generate schema-based context, observer, handle with instrumentation-build#249johanpel wants to merge 6 commits into
johanpel wants to merge 6 commits into
Conversation
…rimitives Rename `quent-instrumentation` to `quent-instrumentation-runtime` so the schema-driven generator's `::quent_instrumentation_runtime::*` references resolve, and add the primitives generated entity handles need: - `Handle<E>`: per-instance handle holding the entity id, a `u128` once-emit bitset, and a shared `Arc<Observer<E>>`. `emit` sends a multi-cardinality event; `emit_once` guards a once-cardinality event by its bit index and fails with `ObserverError::OnceAlreadyEmitted` on a repeat. - `EntityRef<T = ()>` backing `DataType::EntityRef` event fields, which the generator has referenced since rapidsai#218 with no type behind it. - Re-export `build_info`, `EntityEvent`, `Event`, and `ExporterOptions` so generated code references one crate path. The existing `Context`/`Observer` API is unchanged, so the macro path (`quent-model`) is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…xt from the schema
Emit the live instrumentation surface alongside the record/event types. Per
entity: an `EntityEvent` impl (stream name = the entity's snake-case name), a
cloneable `{Entity}Observer` factory, and a `{Entity}Handle` with one emit
method per event. Once-cardinality events take `&mut self` and are guarded by
a per-handle `u64` flag word (at most 64 per entity, else
`GenerateError::TooManyOnceEvents`); multi-events take `&self`. A
`{Schema}Context` builds every observer on construction and hands out cheap
`Arc` clones via `{entity}_observer()`. The generator lives under
`src/runtime/`, split into context/observer/handle.
Refine the runtime `Handle` to match the generated calls: `new()` mints a
fresh id, `with_id()` adopts a caller-supplied one, and the once-flag word is
a `u64`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 tasks
…example Fix the stale `crates/instrumentation/benches/README.md` link in docs/faq.md (rumdl MD057) to the renamed `crates/instrumentation-runtime/...` path and reflow it under 80 columns. Trim the instrumentation-build example's comments: drop the noop-sink aside and explain why the handle is `&mut` for once-events. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…amed crate `cargo bench -p quent-instrumentation` no longer resolves after the `quent-instrumentation` → `quent-instrumentation-runtime` rename; update the three invocations to the new package name. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This adds the ability for the instrumentation-build crate to generate
{App}Context,{Entity}Observerand{Entity}Handle.Nothing leverages the
quent-fsmconstraint yet to generate handles using a typestate pattern explored in #128, that will wrap around these handles.Related Issues
Next step of #191