Metrics and analytics
Workflows expose metrics that allow you to inspect and measure Workflow execution, error rates, steps, and total duration across each (and all) of your Workflows.
The metrics displayed in the Cloudflare dashboard ↗ charts are queried from Cloudflare’s GraphQL Analytics API. You can access the metrics programmatically via GraphQL or HTTP client.
Workflows currently export the below metrics within the workflowsAdaptiveGroups
GraphQL dataset.
Metric | GraphQL Field Name | Description |
---|---|---|
Read Queries (qps) | readQueries | The number of read queries issued against a database. This is the raw number of read queries, and is not used for billing. |
Metrics can be queried (and are retained) for the past 31 days.
The workflowsAdaptiveGroups
dataset provides the following dimensions for filtering and grouping query results:
workflowName
- Workflow name - e.g.my-workflow
instanceId
- Instance IDstepName
- Step nameeventType
- Event type (see event types)stepCount
- Step number within a given instancedate
- The date when the Workflow was triggereddatetimeFifteenMinutes
- The date and time truncated to fifteen minutesdatetimeFiveMinutes
- The date and time truncated to five minutesdatetimeHour
- The date and time truncated to the hourdatetimeMinute
- The date and time truncated to the minute
The eventType
metric allows you to filter (or groupBy) Workflows and steps based on their last observed status.
The possible values for eventType
are documented below:
WORKFLOW_QUEUED
- the Workflow is queued, but not currently running. This can happen when you are at the concurrency limit and new instances are waiting for currently running instances to complete.WORKFLOW_START
- the Workflow has started and is running.WORKFLOW_SUCCESS
- the Workflow finished without errors.WORKFLOW_FAILURE
- the Workflow failed due to errors (exhausting retries, errors thrown, etc).WORKFLOW_TERMINATED
- the Workflow was explicitly terminated.
STEP_START
- the step has started and is running.STEP_SUCCESS
- the step finished without errors.STEP_FAILURE
- the step failed due to an error.SLEEP_START
- the step is sleeping.SLEEP_COMPLETE
- the step last finished sleeping.ATTEMPT_START
- a step is retrying.ATTEMPT_SUCCESS
- the retry succeeded.ATTEMPT_FAILURE
- the retry attempt failed.
Per-Workflow and instance analytics for Workflows are available in the Cloudflare dashboard. To view current and historical metrics for a database:
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Workers & Pages > Workflows ↗.
- Select a Workflow to view its metrics.
You can optionally select a time window to query. This defaults to the last 24 hours.
You can programmatically query analytics for your Workflows via the GraphQL Analytics API. This API queries the same datasets as the Cloudflare dashboard, and supports GraphQL introspection.
Workflows GraphQL datasets require an accountTag
filter with your Cloudflare account ID, and includes the workflowsAdaptiveGroups
dataset.
To query the count (number of workflow invocations) and sum of wallTime
for a given $workflowName
between $datetimeStart
and $datetimeEnd
, grouping by date
:
Here we are doing the same for wallTime
, instanceRuns
and stepCount
in the same query:
Here lets query workflowsAdaptive
for raw data about $instanceId
between $datetimeStart
and $datetimeEnd
:
Example values for the query variables: