Monitoring Asynchronous Macro Execution
Monitor in-flight executions
Execution statuses
ステータス | 意味 |
|---|---|
| Submitted to the thread pool but not yet started. |
| Actively executing. |
| Completed successfully. |
| Failed because of an exception, timeout, or rate-limit violation. |
| A cancellation signal was applied. |
The monitoring view shows the execution ID, macro name, queued time, and execution time.
Monitor a single node
GET /rest/asyncmacros/latest/non-cluster/inflight-macro-executions
This endpoint requires System Administrator permissions and WebSudo confirmation.
Monitor a cluster
Using the Cluster Monitoring API
First, list the nodes:
GET /rest/atlassian-cluster-monitoring/cluster/nodes
Then query a specific node:
GET /rest/atlassian-cluster-monitoring/cluster/suppliers/data/com.atlassian.confluence.plugins.confluence-async-macros/inflight-macro-executions/{NODE-ID}
Using the Confluence UI
Go to Administration ⚙️ > General Configuration > Clustering.
Select a cluster node from the list.
Open the Inflight Executions tab to view execution IDs, macro names, queued time, and elapsed execution time.
Cancel executions
Administrators can cancel macros that are currently executing. Cancellation is useful when a runaway macro is consuming server resources or delaying users.
Cancel through the REST API
All cancellation endpoints use /rest/asyncmacros/latest/inflight/cancel. They require System Administrator permissions and WebSudo confirmation. Cancellation is immediate in the sense that the request returns after the cancellation signal has been sent.
Cancel specific executions by ID
POST /rest/asyncmacros/latest/inflight/cancel/by-execution-ids
{ "executionIds": ["4afd2219-f6b9-4362-af2c-218e4c1fb0af"] }
Get execution IDs from the monitoring endpoints.
Cancel all executions of selected macros
POST /rest/asyncmacros/latest/inflight/cancel/by-macro-names
{ "macroNames": ["blog-posts", "jira"] }
Cancel all in-flight macro executions
POST /rest/asyncmacros/latest/inflight/cancel/all
How cancellation works
The REST request publishes a Confluence event.
The
CancellationListenerreceives the event and calls the canceller.The canceller sends
Thread.interrupt()to the execution thread and sets a cancellation flag in the thread-localExecutionCancellationContext.If the macro implements
isCancellable() = trueand handles the signal, it stops promptly.If the macro does not support cancellation, the interrupt and flag are issued, but the macro continues until it finishes or times out naturally in the background.
Cancellation effectiveness depends on whether the macro developer implemented cancellation support. The API can return successfully even when the macro continues running.
What users see when a macro is canceled
The macro output area displays:
Macro execution cancelled
Users may see the following messages in other scenarios:
シナリオ | メッセージ |
|---|---|
Macro was canceled |
|
Execution timed out |
|
Thread was interrupted while waiting |
|
Configure logging
Go to Administration ⚙️ > General Configuration > Logging and Profiling.
Under Default Loggers, click Add entry.
Add the package or class name, select the logging level, and save.
logger | Recommended level | What it logs |
|---|---|---|
|
| Per-macro submission, including space key, content ID, URL, macro name, and execution UUID. |
|
| Execution queued, started, completed, timed out, and rate-limit violations. |
|
| Back-pressure events, including a full queue, high EWMA latency, synchronous fallback, and recovery. |
|
| Cancellation events and results. |
Example log messages
Macro submitted
Asynchronous execution started for space TEST ContentId ContentId{id=2523138} URL /spaces/TEST/pages/2523138/My+Page macro: jira and execution Id 847266cb-bdfa-4676-8a0a-187651899c1e
System under pressure
EWMA latency 1234ms exceeded threshold 1000ms and queue size (20) > pool size (15); running task in caller thread.
Queue no longer full but latency remains high
Queue is no longer full, but EWMA latency is exceeded.
System returned to normal
Queue is not full & EWMA latency is within threshold. System is back to normal.
Review statistics and analytics
A scheduled job publishes execution statistics as Confluence analytics events.
Schedule: Daily at midnight, 0 0 0 * * ?
Run the statistics job manually
Go to Administration ⚙️ > General Configuration > Scheduled Jobs (or open
/admin/scheduledjobs/viewscheduledjobs.action).Locate Async Macro Statistic Job and click Run.
Each analytics event contains the following metrics for each macro and node:
メトリック | 説明 |
|---|---|
count | Number of executions in the past 24 hours. |
最小 | Fastest execution in milliseconds. |
Max | Slowest execution in milliseconds. |
Avg | Mean execution time. |
P50 | Median execution time. |
P90 | 90th-percentile execution time. |
Statistics are retained in memory for two days by default. Change atlassian.async.macro.execution.statistic.retention.days to adjust retention. Node identifiers in analytics events are anonymized using hashes.
関連コンテンツ
For details about implementing asynchronous macro support in a macro plugin, see the corresponding developer documentation.