## TL;DR

If you run host-based, install and run the Middleware Agent. If you are on serverless or containers, configure the APM SDK to send data directly to Middleware servers instead of the loopback address. The SDK is configured for a host-based setup but there is no Middleware agent listening locally.

## Fix

1. If you run host-based, install and run the Middleware Agent.
   Expected: You get the expected result; the problem is gone.
2. If you are on serverless or containers, configure the APM SDK to send data directly to Middleware servers instead of the loopback address.
   Expected: You get the expected result; the problem is gone.
3. In Docker, host-level metrics should go through the mw-host-agent sidecar image rather than embedding the agent install in the app container.
   Expected: You get the expected result; the problem is gone.

## When to use

- You are setting up or using this Middleware.io APM feature.
- The symptom matches: StatusCode.UNAVAILABLE exporting to the loopback address.

## When NOT to use

- Unrelated Middleware.io APM issues (different feature, different failure).
- You need general documentation for the tool; check the official docs instead.

## Compatibility

Reported against Middleware.io APM. Source: https://docs.middleware.io/apm-configuration/troubleshooting.

## Variant phrasings

### StatusCode.UNAVAILABLE exporting to the loopback address

## Why it happens

The OTel exporter logs 'Transient error StatusCode.UNAVAILABLE encountered while exporting logs to the loopback address, retrying' and no telemetry appears.

## Edge cases

- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.

## Source

https://docs.middleware.io/apm-configuration/troubleshooting