Drops events and emits a warning if the invariant is violated.
assert invariant:bool, [message=any]Description
Section titled “Description”The assert operator asserts that invariant is true for events. In case an
event does not satisfy the invariant, it is dropped and a warning is emitted.
invariant: bool
Section titled “invariant: bool”Condition to assert being true.
message = any (optional)
Section titled “message = any (optional)”Context to associate with the assertion failure.
Examples
Section titled “Examples”Make sure that x != 2
Section titled “Make sure that x != 2”from {x: 1}, {x: 2}, {x: 3}assert x != 2{x: 1}// warning: assertion failure{x: 3}Check that a topic only contains certain events
Section titled “Check that a topic only contains certain events”subscribe "network"assert @name == "ocsf.network_activity"// continue processing