Lifecycle Analytics Reference
Lemline stores lifecycle CloudEvents in SQLite or PostgreSQL for historical queries and live watches through the gateway. Use SQLite for a local analytics file on a single host.
What Lifecycle Analytics Does
When enabled, Lemline consumes lifecycle events and writes them to a dedicated analytics table.
Input: lifecycle CloudEvents from the
lifecycleevents-inchannelDestination: the
lemline_lifecycle_eventstable in the configured analytics databaseDeduplication key:
(source, event_id)Payload: the complete serialized CloudEvent, including extensions and data, in
payload
Required Enablement
Lifecycle analytics requires both:
Lifecycle event production enabled
Lifecycle event consumer enabled
Configure PostgreSQL
Use a database dedicated to analytics. Its Flyway history is separate from the workflow database's, so pointing analytics at the workflow database and schema makes its first migration find a non-empty schema and stop the runner at startup (unless baseline-on-migrate is enabled).
lemline listen enables both the lifecycle event producer and consumer automatically. Configure the flags explicitly when running other processes that emit or ingest lifecycle events.
Configure SQLite
For a new configuration, pass --analytics sqlite to lemline config create to store history in analytics.db. To configure an existing runner, set the analytics path in its YAML file:
Set type: sqlite explicitly. If you omit sqlite.path, Lemline uses analytics.db. It resolves relative paths against the working directory of each process. Use a dedicated local file for analytics with an existing, writable parent directory. Use an absolute path when the runner and gateway start from different directories.
Start ingestion with lemline --config lemline.yaml listen. On the same host, configure the gateway to use the same file and start it with lemline --config lemline.yaml gateway start. The gateway serves saved history with its analytics consumer disabled. When migrate-at-start is enabled, either process can prepare a new SQLite file. They take turns through an analytics.db.migration.lock file created next to the database; leave it in place. A gateway that creates a new file logs a warning, because a wrong path would otherwise show an empty history.
SQLite uses write-ahead logging (WAL), so gateway reads can continue while ingestion writes. SQLite serializes writes. Each connection enables foreign keys, uses synchronous=FULL, and waits up to five seconds for a database lock.
Configuration Keys
Property | Default | Description |
|---|---|---|
|
| Enables lifecycle events consumer used for analytics ingestion |
|
| Max concurrent lifecycle analytics message handling ( |
|
| Analytics backend. Choose |
|
| Local SQLite database file. Used with |
|
| Runs analytics Flyway migration on startup |
|
| Enables Flyway baseline behavior for PostgreSQL analytics |
|
| Analytics PostgreSQL host |
|
| Analytics PostgreSQL port |
|
| Analytics PostgreSQL database name; use a database separate from the workflow database |
|
| Analytics PostgreSQL username |
|
| Analytics PostgreSQL password |
|
| Target schema for lifecycle analytics table |
|
| Enables emitting lifecycle events into the messaging layer |
Analytics Table Shape
The table is lemline_lifecycle_events in SQLite and lemline.lemline_lifecycle_events by default in PostgreSQL.
Important columns:
Event identity:
event_id,source,type,specversionCloudEvent optional metadata:
subject,event_time,datacontenttype,dataschemaWorkflow extensions:
lemline_workflow_id,lemline_workflow_namespace,lemline_workflow_name,lemline_workflow_versionFull payload:
payload(JSON text in SQLite,JSONBin PostgreSQL)Ingestion timestamp:
ingested_at
SQLite stores projected workflow IDs as lowercase UUID text and event_time and ingested_at as signed Unix epoch microseconds in UTC. A missing event time is SQL NULL. The original CloudEvent in payload retains its timestamp precision.
On every backend, lemline_workflow_id is filled only when the lemlineworkflowid extension is a complete UUID such as 01890a5d-ac96-774b-bcce-b302099a8057, in either case. Lemline stores an event with any other value, logs a warning, and leaves the column NULL, so the gateway does not attach that event to an instance.
Troubleshooting
For SQLite startup errors, verify that the configured path names a local file and that the process can write to both the file and its parent directory. If you disabled
migrate-at-start, start against an already migrated file.For PostgreSQL connectivity errors, verify
lemline.analytics.postgresql.*and PostgreSQL availability.If no rows are inserted, verify both producer and consumer are enabled:
lemline.messaging.lifecycleevents.producer.enabled=truelemline.messaging.lifecycleevents.consumer.enabled=true
If rows are missing unexpectedly, check deduplication collisions on
(source, event_id).