Events and observability
The event and observability system turns run activity into durable, structured records that operators can search, stream, and view. It combines run and step events, user log messages, asset results, metadata, errors, and captured process output so operational interfaces can explain what happened and why.
System boundary
The system sits between execution and operational monitoring. Execution emits records with run and step context. The instance stores and streams those records. Monitoring interfaces query the records and read captured compute logs.
The main paths are:
- Structured event log: Records run state, step state, engine activity, asset results, checks, hooks, alerts, and input/output activity.
- Python log stream: Carries user messages through the same run-aware logging path as structured events.
- Compute log stream: Captures unstructured
stdoutandstderrfor later reading or live viewing. - Operational API: Exposes event fields, asset fields, metadata, errors, and compute-log locations to monitoring clients.
The event log is the source for run timelines, step timing, asset history, sensors, and other operational views. See Execution runtime for the larger execution boundary, Run planning and execution for the activity that emits these records, Instance and persistence for the instance services that own this data, and Resources and I/O managers for I/O metadata.
Structured event model
Event records
An EventLogEntry is the common record shape for both ordinary log messages and structured framework events. It carries the run ID, time, level, message, optional step and job context, optional error information, and an optional DagsterEvent payload. This common shape lets a timeline combine human messages with machine-readable state changes. References: python_modules/…/log.py• L31-67, python_modules/…/event_api.py• L96-149
The structured payload identifies the event type and its event-specific data. Event types cover the run lifecycle, step lifecycle, resource and worker markers, engine actions, asset results, checks, hooks, alerts, input/output handling, freshness and health changes, asset removal, and code-location updates. Run events keep their older persisted pipeline values while exposing run names to current clients. Monitoring code should use the event type to select the matching payload rather than infer meaning from the display message. References: python_modules/…/__init__.py• L102-196, python_modules/…/__init__.py• L257-294, python_modules/…/__init__.py• L333-372
Event categories
The event types form a timeline with several related views:
| Category | Operational meaning |
|---|---|
| Run events | A run enters, starts, succeeds, fails, is canceled, is suspended, or resumes. |
| Step events | A step starts, produces output, succeeds, fails, skips, or waits for retry. |
| Engine and marker events | The runtime reports worker, resource, engine, and other system boundaries. |
| Asset events | A value is materialized, an asset is observed, a materialization is planned or fails, or asset health changes. |
| Quality events | A step expectation or asset check reports a result. |
| I/O events | An input is loaded, an output is handled, or an object-store operation occurs. |
| System events | The system records alerts, captured logs, freshness changes, asset removal, or code-location updates. |
This grouping supports both a detailed run timeline and focused queries such as “show the latest observations for this asset” or “show all run failures.” Asset failure records are part of the structured event vocabulary, but their focused SQL query is not currently populated. References: python_modules/…/__init__.py• L198-294, python_modules/…/base.py• L277-368, python_modules/…/sql_event_log.py• L1119-1126
Event emission and persistence
Event lifecycle
Execution first creates a structured event or a log message with execution context. The instance then wraps structured events in an event-log record, persists the record, updates related run or asset state, and notifies listeners. This order means a listener sees an event after the event has reached the event-log storage path.
The following diagram shows the path from execution activity to an operational consumer.
flowchart LR
A[Run or step activity] --> B[Structured event or log message]
B --> C[EventLogEntry with run context]
C --> D[Event log storage]
D --> E[Run and asset summaries]
D --> F[Queries and live event watchers]
E --> G[Operational monitoring interface]
F --> G
Events can be written one at a time or as a batch. A failed batch write falls back to individual writes. Batch metadata also lets partitioned asset events reach storage as one logical group while preserving each event in the log. Only asset and asset-check planning or result events use the batch storage contract. References: python_modules/…/__init__.py• L274-281, python_modules/…/__init__.py• L375-403, python_modules/…/event_methods.py• L173-280, python_modules/…/event_methods.py• L351-372
Event storage and retrieval
EventLogStorage provides the durable contract for storing, deleting, watching, and querying event records. Run queries return paginated records and can filter by event type. Dedicated queries return materializations, observations, and run status changes for the consumers that need those views. Storage limits also protect callers from requesting an unbounded event page.
The storage contract also supports lighter asset reads. A caller can request distinct asset keys and partitions for a run or request asset event summaries that contain indexed identity, partition, time, and run fields without the full payload. Cursor-aware paging continues across storage page limits, which prevents a capped backend response from looking like a complete result. References: python_modules/…/base.py• L217-368, python_modules/…/base.py• L370-412, python_modules/…/base.py• L881-923
SQL-backed storage keeps the full serialized event and extracts run, type, time, step, asset, and partition fields for filtering. It also maintains asset summaries and selected asset tags so asset views can avoid scanning the full event history for every request. Run and step statistics are derived from selected lifecycle events. The focused failed-materialization query currently returns no records even though raw failed-materialization events can remain in the log. References: python_modules/…/base.py• L188-206, python_modules/…/sql_event_log.py• L204-227, python_modules/…/sql_event_log.py• L243-343, python_modules/…/sql_event_log.py• L549-677, python_modules/…/sql_event_log.py• L1093-1152
The in-memory event log uses the same SQL event model for ephemeral instances and tests, but it is not persistent and is not suitable for a real monitoring instance. It can notify live watchers as events are stored, while isolating callback errors from event storage. References: python_modules/…/in_memory.py• L22-48, python_modules/…/in_memory.py• L87-107
Event-log data migrations rebuild derived asset data from stored event records. They support older records by deserializing and reserializing them, and they record completed migrations so a rebuild can resume as a known storage state. References: python_modules/…/migration.py• L13-38, python_modules/…/migration.py• L40-75, python_modules/…/migration.py• L77-163, python_modules/…/sql_event_log.py• L724-745
Logs and metadata
Structured log context
DagsterLogManager is the run-aware logging interface exposed to user code as context.log. It adds context such as the run, job, step, operation, resource, and log message time to ordinary Python log calls. A structured event can travel with the same log record, so handlers can send one consistent record to the event log and to configured log outputs. The formatted message remains useful to a person. The attached metadata gives monitoring systems stable fields for filtering and grouping. References: python_modules/…/log_manager.py• L17-23, python_modules/…/log_manager.py• L74-108, python_modules/…/log_manager.py• L176-184, python_modules/…/log_manager.py• L282-304
Event metadata
Metadata is typed display data attached to outputs, asset events, checks, and other displayable events. Asset metadata is scoped by asset and may also be scoped by partition. Output metadata and metadata reported by an I/O manager are combined before the related asset event is emitted.
The metadata contract supports values such as text, numbers, JSON, paths, URLs, tables, and code references. The operational API converts these values into typed metadata entries so a client can render them without guessing their type. References: python_modules/…/metadata_logging.py• L9-81, python_modules/…/execute_step.py• L581-685, python_modules/…/events.py• L54-99
Compute logs
Compute logs are the unstructured process streams that structured events do not replace. A compute-log manager captures stdout and stderr under a log key, reports whether capture is complete, and supplies data in chunks with a cursor. It can also provide a location or download URL when logs live outside the main process.
Monitoring clients use the log key and cursor to fetch more output or subscribe to updates. The API decodes bytes with replacement for invalid UTF-8, which keeps a damaged or partly read stream viewable instead of failing the whole log request. References: python_modules/…/compute_log_manager.py• L20-45, python_modules/…/compute_log_manager.py• L73-96, python_modules/…/compute_log_manager.py• L184-253, python_modules/…/compute_logs.py• L7-23
Asset observations
Observation events
An AssetObservation records what the system knows about an asset at a point in time. It identifies the asset and optional partition. It can carry a description, tags, and typed metadata. An observation does not mean that the current run produced the asset; it reports a seen state or measurement.
Materialization events describe a produced asset value. Observation events describe an asset state without claiming that the run wrote that value. Both event kinds use the same asset key and partition concepts, which lets asset history and monitoring compare them. References: python_modules/…/events.py• L373-450, python_modules/…/events.py• L467-508, python_modules/…/__init__.py• L752-807
Observation emission
When an asset-producing or asset-observing step yields an output, the runtime combines output metadata, I/O manager metadata, asset-level metadata, partition metadata, and tags before it creates the asset event. The event then enters the same structured event path as run and step events.
The observe entry point runs source-asset observation in a normal in-process run. This keeps observations available through the same run, event, and monitoring model as other execution activity. Asset summaries can retain the latest observation record and its storage ID when the storage backend supports that projection. References: python_modules/…/execute_step.py• L887-956, python_modules/…/observe.py• L17-67, python_modules/…/__init__.py• L1131-1142, python_modules/…/base.py• L67-135, python_modules/…/sql_event_log.py• L287-343
Operational monitoring interfaces
Queries and live streams
The instance exposes paginated run records and focused asset and run-status queries. Consumers can use cursors to continue a query without loading the full event history. Run-specific watchers stream new event records from a cursor for live timelines.
Asset consumers can choose between full event records and indexed summaries. The latter support asset key, partition, run, storage ID, and time views when the event payload is not needed. The GraphQL event model maps the common record fields to run ID, message, time, level, event type, step key, and node handle. Specialized event types then expose asset keys, partitions, tags, metadata entries, step statistics, run links, and errors. References: python_modules/…/instance.py• L301-347, python_modules/…/instance.py• L556-590, python_modules/…/event_methods.py• L98-117, python_modules/…/base.py• L300-368, python_modules/…/sql_event_log.py• L419-512, python_modules/…/sql_event_log.py• L1008-1091, python_modules/…/events.py• L535-569
Monitoring data products
Operational interfaces consume different projections of the same event stream:
- Run timeline: Run, step, engine, retry, and failure events with context and time.
- Run and step statistics: Durations and counts derived from lifecycle events.
- Asset history: Materializations, observations, planned work, failures, partitions, tags, and metadata.
- Live compute logs: Chunked standard output and standard error with completion state and retrieval details.
- Error detail: Serializable error data attached to failure-capable events.
The GraphQL schema keeps these projections linked. An asset event can resolve its source run and step statistics. A captured-log event points to the log key and any external retrieval information. References: python_modules/…/events.py• L30-64, python_modules/…/events.py• L331-386, python_modules/…/events.py• L474-517, python_modules/…/events.py• L314-328
Error handling
Execution errors
Execution failures are represented as structured failure events with serialized error information. Run and step failures can therefore show both a stable failure state and a readable error in an operational interface. Engine events use an error log level when their event data contains an error.
Blocking asset checks are also promoted to execution failure when they fail with error severity. This connects data-quality failure to the run and step failure views instead of leaving it as an isolated result. References: python_modules/…/log.py• L31-67, python_modules/…/__init__.py• L387-411, python_modules/…/event_methods.py• L299-349, python_modules/…/execute_step.py• L501-545
Storage and delivery errors
The event path protects some non-fatal delivery boundaries without hiding the main execution result. A batch storage error is retried as individual event writes. The SQL-backed storage keeps raw asset failure events in the event log but its failed-materialization query returns no records, so that focused asset failure view is unavailable through this storage path.
Event deserialization also has a compatibility fallback. If an event payload cannot be unpacked, the system exposes an engine event with serialized error information and the original message when possible. This keeps the timeline readable while showing that the stored event could not be restored. Compute-log decoding uses replacement characters for invalid bytes, so the displayed text may not match the original bytes at invalid sequences. References: python_modules/…/event_methods.py• L213-247, python_modules/…/sql_event_log.py• L1054-1070, python_modules/…/__init__.py• L413-447, python_modules/…/compute_logs.py• L7-23
Change checklist
When these files or sections are changed, remember to consider these:
- Keep
DagsterEventType, event-specific payloads, storage filters, and GraphQL event unions aligned. A new event type that is stored but not mapped cannot appear correctly in monitoring clients. - Preserve the run ID, step key, asset key, partition, timestamp, and level fields across event construction and API conversion. These fields link timelines, asset history, and step statistics.
- When changing event groups or run-status mappings, check status queries and resume behavior. A resume event must not create a second started-status transition.
- When changing asset metadata or tags, check the merge path for output metadata, I/O manager metadata, asset metadata, and partition metadata. A precedence change can alter what the UI reports without changing the asset value.
- When changing asset indexing or migrations, keep the full event record, asset summary, wipe timestamp, migration marker, and indexed tag data consistent. A mismatch can make an asset appear in one view but not another.
- When changing asset summary queries, preserve the distinction between full payload reads and indexed key, partition, run, time, and storage ID projections. Also preserve cursor progress across backend page limits.
- When changing compute-log capture, keep the log key, cursor, completion marker, external locations, and GraphQL decoding contract compatible.
- When adding a failure event, decide whether it needs serialized error data, an error log level, asset indexing, run-status handling, and a GraphQL error field.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A new structured event has no matching monitoring mapping. | The event may be stored but show as a generic or incomplete event. | Keep event types, payload accessors, and GraphQL conversions aligned. |
| A batch event write fails. | A live timeline can lag while the storage path retries each event. | The instance falls back to individual writes. |
| The SQL-backed storage is used for failed-materialization queries. | The focused asset failure history is empty even when raw failure events exist. | Do not use that query as the sole source for asset-failure alerts on this storage path. |
| Metadata is supplied both in an explicit materialization and through output metadata logging. | The runtime rejects the conflicting sources to avoid an ambiguous display value. | Put metadata in one source for each output handling call. |
| A stored event cannot be deserialized by the current process. | The timeline shows an engine error event instead of the original event payload. | Treat the serialized error as a compatibility signal and inspect the stored event version. |
| A compute-log chunk contains invalid UTF-8. | Some bytes display as replacement characters. | The API decodes with replacement so the rest of the log remains readable. |
| A caller treats one capped storage page as the complete result or reuses a cursor that does not advance. | Monitoring can omit records or loop while reading an event or asset summary view. | Use the returned cursor and continue until the storage reports no more records or no cursor progress. |
| An asset index migration is incomplete or stale after event-log changes. | Asset lists or latest-event views can disagree with the raw event history. | Run the matching reindex operation and keep migration markers tied to the derived data. |
| In-memory storage is used as the event store for a real instance. | Events and monitoring state disappear when the process ends. | Use it only for ephemeral instances and tests. |
Key files
| File | Why to read it |
|---|---|
| python_modules/…/log.py | Defines the common event-log record that joins logs, structured events, context, and errors. |
| python_modules/…/__init__.py | Defines event types, event groups, event creation, compatibility handling, and access to asset and partition fields. |
| python_modules/…/event_methods.py | Shows how events are stored, batched, watched, and sent to run listeners. |
| python_modules/…/base.py | Defines durable storage, cursor-aware paging, asset projections, and the query contracts used by run and asset monitoring. |
| python_modules/…/sql_event_log.py | Shows how SQL storage persists event records, maintains asset indexes, derives statistics, and serves filtered queries. |
| python_modules/…/in_memory.py | Shows the ephemeral event-log variant and its live watcher behavior. |
| python_modules/…/migration.py | Shows how stored event data rebuilds derived asset indexes and supports older records. |
| python_modules/…/events.py | Defines asset materialization and observation data with metadata and tags. |
| python_modules/…/log_manager.py | Explains how normal Python logs gain run, step, resource, and event context. |
| python_modules/…/compute_log_manager.py | Defines captured stdout and stderr, cursors, subscriptions, and retrieval metadata. |
| python_modules/…/execute_step.py | Shows where output, I/O metadata, materializations, and observations become events. |
| python_modules/…/events.py | Defines the operational event shapes exposed to monitoring clients. |
| python_modules/…/compute_logs.py | Defines the captured-log payload and safe text conversion for the API. |