mMuleSoft

Monitor MuleSoft API Gateway traffic by applying the Alma Capture Policy (custom policy) and exporting telemetry via OTLP/HTTP.

Deploy Alma on MuleSoft to capture API gateway HTTP traffic without app code changes.

The Alma Capture Policy is a MuleSoft API Gateway custom policy.

It captures HTTP request/response metadata + payloads and exports them asynchronously to an OpenTelemetry Collector over OTLP/HTTP(S).

If you’re new to Alma, start with Alma Overview.

How it works

When applied to an API (or as an automated policy), the policy:

  1. Intercepts inbound traffic at the Mule gateway.

  2. Captures HTTP request metadata and payload data.

  3. Invokes the downstream API (http-policy:execute-next).

  4. Captures HTTP response metadata and payload data.

  5. Exports captured telemetry asynchronously to an OpenTelemetry Collector.

The policy runs inline using the Mule 4 custom policy model (http-policy:proxy).

Telemetry export

  • Protocol: OTLP

  • Transport: HTTP(S)

  • Default port: 4318

  • Encoding: Protobuf (application/x-protobuf)

  • TLS: HTTPS

Typical collector endpoints:

  • https://<otel-collector-host>:4318/v1/traces

  • https://<otel-collector-host>:4318/v1/logs

circle-info

Export is asynchronous and should not block API request processing.

Prerequisites

  • MuleSoft Anypoint Platform permissions to:

    • upload a custom policy to Anypoint Exchange

    • apply policies in API Manager

  • Maven (mvn) installed (for Maven-based publishing).

  • An OpenTelemetry Collector reachable from Mule runtime over HTTPS on port 4318.

  • TLS trust configured so Mule trusts the collector’s certificate.

Install and apply the policy

MuleSoft supports multiple publishing workflows.

Use whichever matches your Exchange process.

For MuleSoft’s baseline flow, see: Upload a Custom Policy to Exchangearrow-up-right.

1

1) Download and unzip the policy bundle

  1. Download alma-mule-policy.zip from your Alma distribution channel.

  2. Unzip it.

You should see the standard Mule 4 custom policy structure (YAML, template.xml, Maven files, docs assets).

2

2) Publish the policy to Anypoint Exchange

  1. cd alma-mule-policy/<policy-name>

  2. Update the groupId in pom.xml to your Anypoint Organization ID.

  3. Ensure your Maven credentials are configured for Exchange.

  4. Publish:

Option B: Publish using Exchange APIs

If you automate publishing, upload the policy artifacts using Exchange APIs and bearer tokens.

3

3) Apply the policy in API Manager

Automated policy

  1. Anypoint Platform → API Manager

  2. Automated PoliciesAdd policy

  3. Select Alma Capture Policy

  4. Apply

API-specific policy

  1. API Manager → select an API

  2. PoliciesAdd policy

  3. Choose Alma Capture Policy

  4. Apply

What data is exported

The policy exports standard OpenTelemetry signals:

  • Traces

    • request/response metadata

    • timing and status

  • Logs

    • request and response payload data

    • correlated with trace/span identifiers

This keeps large payloads out of trace attributes, while preserving correlation.

Verify

  1. Send traffic through the API.

  2. Confirm the collector is receiving data on port 4318.

  3. Confirm traces and logs appear in your backend.

Upgrade and uninstall

Upgrade

  1. Publish a newer policy version to Exchange.

  2. API Manager → select the API → PoliciesCheck for updates.

  3. Apply the updated policy version.

Uninstall

API Manager → Policies → remove Alma Capture Policy.

Last updated