Monitoring Asynchronous Macro Execution

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community


Monitor in-flight executions


Execution statuses


Status
 

Meaning
 

QUEUED

Submitted to the thread pool but not yet started.

STARTED

Actively executing.

FINISHED

Completed successfully.

FAILED

Failed because of an exception, timeout, or rate-limit violation.

CANCELED

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

  1. Go to Administration ⚙️ > General Configuration > Clustering.

  2. Select a cluster node from the list.

  3. 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

  1. The REST request publishes a Confluence event.

  2. The CancellationListener receives the event and calls the canceller.

  3. The canceller sends Thread.interrupt() to the execution thread and sets a cancellation flag in the thread-local ExecutionCancellationContext.

  4. If the macro implements isCancellable() = true and handles the signal, it stops promptly.

  5. 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:
 
 
 

Scenario
 

Message
 

Macro was canceled

Macro execution cancelled

Execution timed out

Did not finish in {N} ms

Thread was interrupted while waiting

Interrupted while waiting for async result


Configure logging

  1. Go to Administration ⚙️ > General Configuration > Logging and Profiling.

  2. Under Default Loggers, click Add entry.

  3. Add the package or class name, select the logging level, and save.


 

Logger
 

Recommended level
 

What it logs
 

com.atlassian.confluence.plugins.asyncmacros.handler.ConfluenceMacroAsyncHandler

INFO

Per-macro submission, including space key, content ID, URL, macro name, and execution UUID.

com.atlassian.macro.async.execution

DEBUG

Execution queued, started, completed, timed out, and rate-limit violations.

com.atlassian.macro.async.execution.executors

WARN (automatic)

Back-pressure events, including a full queue, high EWMA latency, synchronous fallback, and recovery.

com.atlassian.macro.async.execution.tracking

INFO

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


  1. Go to Administration ⚙️ > General Configuration > Scheduled Jobs (or open /admin/scheduledjobs/viewscheduledjobs.action).

  2. Locate Async Macro Statistic Job and click Run.

Each analytics event contains the following metrics for each macro and node:
  
 

Metric
 

Description
 

Count

Number of executions in the past 24 hours.

Min

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.

Related content


For details about implementing asynchronous macro support in a macro plugin, see the corresponding developer documentation.

Last modified on Oct 9, 2026

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.