-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add event logging to Malloy #1929
Merged
Merged
Conversation
This file contains 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
christopherswenson
force-pushed
the
crs-event-logging
branch
from
September 25, 2024 17:28
449c678
to
12b8487
Compare
nachoarreola
approved these changes
Sep 26, 2024
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.
Adds:
EventStream
interface with anemit(id: string, data: any): void
function (for which anEventEmitter
can be used)eventStream
toRuntime
,QueryModel
, andMalloyTranslator
, as well asMalloy.parse
,Malloy.compile
,SingleConnectionRuntime
, andpreparedQuery.getPreparedResult
*, which is anEventStream
toEmitDuringCompile
andtoEmitDuringTranslation
, which ensure that a given Malloy query/model produces a given set of events**source-argument-compiled
: the argument to a source parameter was compiled in an actual queryparameterized-source-compiled
: a source that has parameters is used in a query (either in the pipeline or a join)join-used
: a joined source is usedtranslation-error
: an error is encountered during translation*
preparedQuery.preparedResult
creates aQueryModel
and runs the compiler;preparedQuery.getPreparedResult
now allows passing in theeventStream
; this is automatically done when usingqueryMaterializer.getPreparedResult()
orqueryMaterializer.run()
, passing theeventStream
from the runtime that produced the query materializer.**The exact behavior of
toEmitDuringCompile
andtoEmitDuringTranslation
is: 1) load the model or query: if...DuringCompile
, runsloadModel().loadFinalQuery().getPreparedResult()
, if...DuringTranslation
, runsloadModel().getModel()
2) check that the events that were emitted match those expected: filters the emitted events to only those with IDs matching any in the list of expected events, then ensures that ALL of those events match the events given, in order, by ensuring that the ID matches and the data object matches (loosely: keys present in expected must be equal if scalar, or recursively match if arrays or objects)