workflow.observe
Modules
Module workflow.observe
API
Declarations
ballerina/workflow.observe Ballerina library
Functions
createGetWorkflowResultSpan
function createGetWorkflowResultSpan(string instanceId) returns GetWorkflowResultSpanCreates the span for waiting on a workflow instance's result.
Parameters
- instanceId string -
Return Type
- GetWorkflowResultSpan - The span
createHumanTaskDecisionSpan
function createHumanTaskDecisionSpan(string taskWorkflowId, "complete"|"fail" action) returns TaskDecisionSpanCreates the span for a person's decision on a human task.
Parameters
- taskWorkflowId string -
- action "complete"|"fail" -
completeto submit a result,failto reject the task
Return Type
- TaskDecisionSpan - The span
createReviewActivityDecisionSpan
function createReviewActivityDecisionSpan(string taskWorkflowId, "proceed"|"proceed-with-input"|"reject" action) returns TaskDecisionSpanCreates the span for a person's decision on a review activity.
Parameters
- taskWorkflowId string -
- action "proceed"|"proceed-with-input"|"reject" -
proceed,proceed-with-inputorreject
Return Type
- TaskDecisionSpan - The span
createSendAgentEventSpan
function createSendAgentEventSpan(string agentName, string instanceId, string eventName) returns SendAgentEventSpanCreates the span for sending an event to a durable agent instance.
Return Type
- SendAgentEventSpan - The span
createSendDataSpan
function createSendDataSpan(string instanceId, string dataName) returns SendDataSpanCreates the span for sending data to a workflow instance.
Return Type
- SendDataSpan - The span
createStartAgentSpan
function createStartAgentSpan(string agentName) returns StartAgentSpanCreates the span for starting a durable agent instance.
Parameters
- agentName string -
Return Type
- StartAgentSpan - The span
createStartWorkflowSpan
function createStartWorkflowSpan(string workflowType) returns StartWorkflowSpanCreates the span for starting a workflow instance.
Parameters
- workflowType string -
Return Type
- StartWorkflowSpan - The span
createTaskAdministrationSpan
function createTaskAdministrationSpan(string taskWorkflowId, AdministrationAction action) returns TaskDecisionSpanCreates the span for an administrator's act on a live task or review.
Return Type
- TaskDecisionSpan - The span
isActivityContentCaptured
function isActivityContentCaptured() returns booleanReports whether activity executions log their arguments and results.
Return Type
- boolean - The value of
captureActivityContent
isHumanTaskContentCaptured
function isHumanTaskContentCaptured() returns booleanReports whether decision content is recorded on task-decision spans and audit entries.
Return Type
- boolean - The value of
captureHumanTaskContent
isMetricSamplesPublished
function isMetricSamplesPublished() returns booleanReports whether the runtime publishes one structured log record per workflow event.
Return Type
- boolean - The value of
publishMetricSamples
workflowTypeNameOf
function workflowTypeNameOf( function() () processFunction) returns stringReturns the workflow type name the engine registers for a workflow function.
Parameters
- processFunction
function() ()- The workflow function
Return Type
- string - The engine's workflow type name
Classes
workflow.observe: GetWorkflowResultSpan
Represents a tracing span for waiting on a workflow instance's result.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
workflow.observe: SendAgentEventSpan
Represents a tracing span for sending an event to a running durable agent.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
workflow.observe: SendDataSpan
Represents a tracing span for sending data to a running workflow instance.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
workflow.observe: StartAgentSpan
Represents a tracing span for starting a durable agent instance.
addInstanceId
function addInstanceId(string instanceId)Records the instance ID assigned to the started agent.
Parameters
- instanceId string - The agent instance identifier
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
workflow.observe: StartWorkflowSpan
Represents a tracing span for starting a workflow instance.
addInstanceId
function addInstanceId(string instanceId)Records the instance ID assigned to the started workflow.
Parameters
- instanceId string - The workflow instance identifier
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
workflow.observe: TaskDecisionSpan
One decision a person makes on a task, as a span that also writes the decision's audit entry and counts it. The audit entry is written whether or not tracing or metrics are enabled.
addDecider
function addDecider(string? userId, string[]? roles, IdentitySource identitySource)Records who decided, as the caller identified them, and where that identity came from.
Parameters
- userId string? -
- roles string[]? -
- identitySource IdentitySource (default "asserted") -
verifiedwhen resolved from a credential the receiving service validated
addContent
function addContent(anydata content)Records what the person submitted. A no-op when captureHumanTaskContent is off.
Parameters
- content anydata - The submitted value
addTaskDetails
function addTaskDetails(map<anydata> receipt)Records what the runtime confirmed on accepting the decision: task name, parent, allowed roles and input.
Parameters
- receipt map<anydata> - The receipt the runtime returned for the accepted decision
close
function close(error? err)Closes the span, writes the decision's audit entry, and counts the decision.
Parameters
- err error? (default ()) - The error the runtime refused the decision with, if it did
Enums
workflow.observe: TaskKind
The kind of task a person decides on.
Members
Configurables
workflow.observe: captureHumanTaskContent
Whether a task decision's content (what the person was shown and submitted) joins its span and audit entry. Who decided, in which roles, what and when are always recorded; this governs only the content.
workflow.observe: captureActivityContent
Whether every activity attempt logs its arguments and result (or error) to the worker's module log. Long values are truncated.
workflow.observe: publishMetricSamples
Whether the runtime publishes one structured log record per workflow event under logger = "workflow-metrics",
the workflow counterpart of ballerinax/metrics.logs. Structural fields only, never content.
Object types
workflow.observe: WorkflowSpan
Represents a workflow tracing span that allows adding tags and closing the span.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) -
Union types
workflow.observe: TaskAction
TaskAction
What a person decided: complete or fail for a human task; proceed,
proceed-with-input or reject for a review activity.
workflow.observe: AdministrationAction
AdministrationAction
An administrator's acts on a live task.
workflow.observe: IdentitySource
IdentitySource
Where a decision's user identity came from: verified when it was resolved from a
credential the receiving service's auth layer validated (a JWT claim, a basic-auth
username), asserted when the application or a forwarded header supplied it.
Import
import ballerina/workflow.observe;Metadata
Released date: 5 days ago
Version: 0.10.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.13.6
GraalVM compatible: No
Pull count
Total: 10919
Current verison: 418
Weekly downloads
Keywords
workflow
Type/Library
Contributors