---
schema_version: "1"
id: dd046d62485ef728bfae2515b49eed89e6a2b56a99fe851c468c3637dc5a344b
title: Configuring Omni Gateway Distributed Tracing in Connected Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.13/conn-tracing-config.md
canonical_url: https://docs.mulesoft.com/gateway/1.13/conn-tracing-config
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0ed27f6c866b052f277382caeb3cbce11183a465b2fe7c57bbdb7173cd5b0d02
description: MuleSoft Documentation Site
release: "1.13"
latest: false
---
---
product: Omni Gateway
version: 1.13
---

# Configuring Omni Gateway Distributed Tracing in Connected Mode

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

OpenTelemetry provides a unified standard for instrumenting, generating, collecting, and exporting
telemetry data across distributed systems. Omni Gateway supports OpenTelemetry, enabling you to
configure the generation of distributed tracing data for all API traffic managed by the gateway.
This integration delivers deep visibility into API request flows, making it easier to analyze system
behavior, troubleshoot issues, and understand interactions between Omni Gateway APIs and external
services.

Tracing enables you to track Omni Gateway API interactions. When multiple systems and services are
involved, distributed tracing tracks API requests as they flow through distributed environments,
providing a comprehensive view of the API’s execution.

With the Anypoint Monitoring Telemetry Exporter, you can send Omni Gateway trace data to third-party
observability and analytics platforms, including Azure Monitor, Splunk HEC, or any
OpenTelemetry-compliant tool. This capability allows you to leverage end-to-end observability,
correlating API traces with data from other systems to build a comprehensive view of your
environment.

Configure distributed tracing in Connected Mode using one of these methods:

- [Runtime Manager runtime configurations](#runtime-manager-config): Applies to all API instances in
  the gateway.

- [Configuration YAML resource](#yaml-resource-config): Applies to all API instances.

- [Policy](#policy-config): Applies to one API instance and provides granular control.

## Before You Begin

To use the OpenTelemetry with Omni Gateway, you must be familiar with:

- Distributed tracing concepts, including traces and spans.

  If you’re new to distributed tracing and OpenTelemetry, we recommend starting with
  [What is OpenTelemetry](https://opentelemetry.io/docs/concepts/what-is-opentelemetry/) and
  [Understanding distributed tracing](https://opentelemetry.io/docs/concepts/observability-primer/#understanding-distributed-tracing).

## Configuring Omni Gateway Distributed Tracing in Runtime Manager

1.  In Anypoint Platform, select **Runtime Manager**.

2.  Select **Omni Gateways**.

3.  Select your Omni Gateway.

4.  Open **Runtime Configurations**.

5.  Open **Distributed Tracing**.

6.  Enable **Distributed tracing**.

7.  Set the **Sampling percentage** to the percentage of transactions to trace.

    To configure sampling only on a per-API basis with the Tracing policy, set **Sampling
    percentage** to `0`.

8.  Apply the changes.

> [!NOTE] The **Sampling percentage** corresponds to the `overall` sampling percentage. The `client`
> and `random` sampling percentages default to `100` when **Sampling percentage** is set to a
> non-zero value.

## Configure with a YAML Resource

Edit and apply a YAML configuration resource to configure distributed tracing for all API instances
in the gateway. Connected Mode supports exporting traces to Anypoint Monitoring, a gRPC
OpenTelemetry endpoint, or an HTTP OpenTelemetry endpoint.

### Export Traces to Anypoint Monitoring

Edit and apply this configuration resource to enable distributed tracing. This configuration
resource applies to all API instances. This example sets global sampling to 0% and policies
configure sampling per API.

```yaml
apiVersion: gateway.mulesoft.com/v1beta1
kind: Configuration
metadata:
  name: tracing
  namespace: test-ns
spec:
  tracing:
    provider:
      type: anypoint
      properties:
        timeout: 10s
    sampling:
      client: 0
      random: 0
      overall: 0
    labels:
      - name: c-env-tag
        type: environment
        keyName: FLEX_NAME
        defaultValue: DEFAULT_VAL
      - name: c-header-tag
        type: requestHeader
        keyName: :method
        defaultValue: DEFAULT_METHOD
      - name: c-literal-tag
        type: literal
        defaultValue: the-tag
```

### Export Traces to a gRPC OpenTelemetry Endpoint

To configure OpenTelemetry tracing with a gRPC endpoint in Omni, apply this YAML configuration:

```yaml
apiVersion: gateway.mulesoft.com/v1beta1
kind: Configuration
metadata:
  name: tracing
  namespace: test-ns
spec:
  tracing:
    provider:
      type: opentelemetry
      properties:
        address: h2://splunk-otel-collector-agent.default.svc.cluster.local:4317
        serviceType: grpc
        serviceName: my-flex-name
        timeout: 10s
        resourceAttributes:
          any-key: any-value
    sampling:
      client: 100
      random: 100
      overall: 100
    labels:
      - name: c-env-tag
        type: environment
        keyName: FLEX_NAME
        defaultValue: DEFAULT_VAL
      - name: c-header-tag
        type: requestHeader
        keyName: :method
        defaultValue: DEFAULT_METHOD
      - name: c-literal-tag
        type: literal
        defaultValue: the-tag
```

### Export Traces to an HTTP OpenTelemetry Endpoint

To configure OpenTelemetry tracing with an HTTP endpoint, apply this YAML configuration:

```yaml
apiVersion: gateway.mulesoft.com/v1beta1
kind: Configuration
metadata:
  name: tracing
  namespace: test-ns
spec:
  tracing:
    provider:
      type: opentelemetry
      properties:
        address: http://opentelemetry:4318
        tracesUri: http://opentelemetry:4318/v1/traces
        serviceType: http
        serviceName: the-name
        timeout: 10s
        httpHeaders:
          auth: samething
        resourceAttributes:
          nay-key: nay-value
    sampling:
      client: 100
      random: 100
      overall: 100
    labels:
      - name: c-env-tag
        type: environment
        keyName: FLEX_NAME
        defaultValue: DEFAULT_VAL
      - name: c-header-tag
        type: requestHeader
        keyName: :method
        defaultValue: DEFAULT_METHOD
      - name: c-literal-tag
        type: literal
        defaultValue: the-tag
```

## Configure Distributed Tracing for Specific APIs

To override the globally configured distributed tracing settings for specific APIs, apply the
Tracing policy. First enable and configure distributed tracing for the gateway, then apply this
policy to the APIs to instrument:

- [Tracing Policy](https://docs.mulesoft.com/gateway/1.13/policies-included-tracing)

## Export Traces from Anypoint Monitoring to Third Parties

To export traces to third-party providers using the Anypoint Monitoring Telemetry Exporter, see
[Exporting Telemetry Data to Third-Party Monitoring Systems](https://docs.mulesoft.com/monitoring/telemetry-exporter).

To export traces using the Anypoint Monitoring Telemetry Exporter, first configure the Telemetry
Exporter in Anypoint Monitoring.
