# Routing and Monitoring Telemetry Data

## Overview

Telemetry is vital but hard to manage. Expanding cloud environments, fleeting infrastructure, and tool sprawl flood teams with logs, metrics, and traces—expensive to store, difficult to use. OpenTelemetry, now the industry standard for data collection, is at the core of Onum.

You can use the [**OpenTelemetry** Listener](/the-workspace/listeners/listener-integrations/collect-data-using-opentelemetry.md) in Onum to centralize all your telemetry data and then send it to various monitoring tools using the [**OpenTelemetry** Data sink](/the-workspace/data-sinks/data-sink-integrations/send-data-using-opentelemetry.md).

{% embed url="<https://youtu.be/SNp-4AA9p10>" %}

## Use case

In this use case, we are working with an e-commerce shop. Each of the product services in the shop generates specific telemetry data sets that we want to send to different monitoring services:

* **Metrics** - we are sending these to [Prometheus](https://prometheus.io/).
* **Traces** - we are sending these to [Jaeger](https://www.jaegertracing.io/).
* **Logs** - we are sending these to [Elastic](https://www.elastic.co/).

We want to centralize and analyze all this data, and Onum enables us to do so using the **OpenTelemetry** Listener and Data sink. We will define a Pipeline that forwards all our data to the required service.

### Configure OpenTelemetry

First of all, users who want to integrate OpenTelemetry with Onum need to configure the OpenTelemetry collector or agent to start sending data to Onum.&#x20;

To do it, you must configure the following YAML file in your OpenTelemetry collector. In the `exporters` section, you must define whether you want to use gRPC or HTTP, and add the distributor endpoint. Then, in the `service` section, you must indicate again if you're using gRPC or HTTP in the `exporters` parameter.&#x20;

```yaml
exporters:
  otlphttp/onum:
    endpoint: http://192.168.1.75:8080
    tls:
      insecure: true
  otlp/onum:
    endpoint: 192.168.1.75:8080
    tls:
      insecure: true
  
service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlphttp/onum, otlp/onum]
    metrics:
      receivers: [otlp]
      exporters: [otlphttp/onum, otlp/onum]
    logs:
      receivers: [otlp]
      exporters: [otlphttp/onum, otlp/onum]
```

Once the collector is configured, you need to set the OpenTelemetry Listener in Onum using this data.

### Create your OpenTelemetry Listener

First, you must configure the **OpenTelemetry** Listener you'll use in your Pipeline. To do it:

{% stepper %}
{% step %}
Go to **Listeners > New listener**. Select **OpenTelemetry** and click **Configuration**.
{% endstep %}

{% step %}
Give it a name and allow both **HTTP** and **gRPC** configurations. Then, enter the required sending ports in the **gRPC port** and **HTTP port** parameters.
{% endstep %}

{% step %}
Optionally, enter any additional information. If you don't need any, set everything to **false** and click **Create labels > Create listener** (define any required labels if needed, learn more [in this article](/the-workspace/listeners/labels.md)).
{% endstep %}
{% endstepper %}

<figure><picture><source srcset="/files/UEHWI1HKO3iZO5Pvh6N1" media="(prefers-color-scheme: dark)"><img src="/files/qwytARL6kyFUNZOOshXv" alt=""></picture><figcaption></figcaption></figure>

### Create the required Data sinks

Now, you must create a Data sink for each type of data we want to analyze:

{% tabs %}
{% tab title="Metrics" %}
For your metrics, you need an **OpenTelemetry** Data sink that sends them to your Prometheus instance.

To do it, go to **Data sinks > New data sink**. Select **OpenTelemetry** and click **Configuration**. Give it a name (for example `PrometheusSink`) and configure the following:

* Set **Protocol** to **HTTP**.
* Enter the required endpoint/port in the **Endpoint** and **Port** parameters.
* Set **Send Metrics** to **true**.
* Enter the required path in the **HTTP Metrics Path** parameter.
* Optionally, enter any additional information. If you don't need any, set everything to **false**.

<figure><picture><source srcset="/files/Xj5AzYzTfJV6aWMuX75o" media="(prefers-color-scheme: dark)"><img src="/files/gJHmKu3QbrEMfeBsAO7r" alt=""></picture><figcaption></figcaption></figure>

Click **Finish** when you're done.
{% endtab %}

{% tab title="Traces" %}
For your traces, you need an **OpenTelemetry** Data sink that sends them to your Jaeger service.

To do it, go to **Data sinks > New data sink**. Select **OpenTelemetry** and click **Configuration**. Give it a name (for example `JaegerSink`) and configure the following:

* Set **Protocol** to **gRPC**.
* Enter the required endpoint/port in the **Endpoint** and **Port** parameters.
* Set **Send Traces** to **true**.
* Optionally, enter any additional information. If you need any, set everything to **false**.

<figure><picture><source srcset="/files/jCeVlWMKrvjYeUegNfVH" media="(prefers-color-scheme: dark)"><img src="/files/8gdjWAsDBRvP8dZg8BHi" alt=""></picture><figcaption></figcaption></figure>

Click **Finish** when you're done.
{% endtab %}

{% tab title="Logs" %}
For your logs, you need an **HTTP** Data sink that sends the data to your Elastic service.

To do it, go to **Data sinks > New data sink**. Select **HTTP** and click **Configuration**. Simply give it a name (for example `ElasticSink`) and click **Save**. Further configuration will be required once you add this Data sink to your Pipeline later.
{% endtab %}
{% endtabs %}

### Define the Pipeline in Onum

Now we can start creating our Pipeline in Onum:

{% stepper %}
{% step %}
First, go to **Pipelines** and click **New Pipeline**. Drag the configured **OpenTelemetry** Listener you created before into the Pipeline canvas.

<figure><picture><source srcset="/files/X9czIvEReOtRjbDiFjbu" media="(prefers-color-scheme: dark)"><img src="/files/FBfZuRDE5dPGWnQOXwrb" alt=""></picture><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Add a [**Conditional** Action](/the-workspace/pipelines/actions/filtering/conditional.md) to extract each of the 3 data sets we want to get from our source data. To do it, add three different ports:

* A **metrics** port to filter data that includes the `resourceMetrics` literal.
* A **traces** port to filter data that includes the `resourceSpans` literal.
* A **logs** port to filter data that includes the `resourceLogs` literal.

<figure><picture><source srcset="/files/5R0HsYJKQLg5W0lfENx8" media="(prefers-color-scheme: dark)"><img src="/files/WXiN8nvoZLkTfwSwaCcF" alt=""></picture><figcaption></figcaption></figure>

Click **Save** and link your **OpenTelemetry** Listener to the **Conditional** Action.

<figure><picture><source srcset="/files/dSLN7WtcsqRHJwJXhnwZ" media="(prefers-color-scheme: dark)"><img src="/files/vLFnEjqmAUdtOhKYe51O" alt=""></picture><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now, you must drag into the canvas the Data sinks created previously to send each data set to its specific analytic service and link them to the **Conditional** Action as follows:

* Link the **Metrics** port of the **Conditional** Action to the `PrometheusSink`.
* Link the **Traces** port of the **Conditional** Action to the `JaegerSink`.
  {% endstep %}

{% step %}
For the logs, we need a couple of additional steps. First, link the **Logs** port of the **Conditional** Action to a [**Message Builder** Action](/the-workspace/pipelines/actions/formatting/message-builder.md) and configure it to extract only the **raw** field. Click **Save**.

<figure><picture><source srcset="/files/qFI3U4JqPQnqPUvaMxbo" media="(prefers-color-scheme: dark)"><img src="/files/52nKwc3t2B02hp9mJJcl" alt=""></picture><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now, link the **Message Builder** Action to the `ElasticSink`. Double click the `ElasticSink` and enter the following:

* Choose **POST** as the **HTTP method**.
* Enter the required **URL** to send the data.
* In **Message**, choose the field generated by the **Message Builder**.
* Choose **application/json** as **Content type**.

<figure><picture><source srcset="/files/56426vvx3JZruOxtNdZz" media="(prefers-color-scheme: dark)"><img src="/files/TmvA4qKc9FeFL03Ze6FC" alt=""></picture><figcaption></figcaption></figure>

Enter any other data if required and click **Save**.
{% endstep %}

{% step %}
Finally, click **Publish**, and your data sets will be sent to each specific service so you can start analyzing them.

<figure><picture><source srcset="/files/ChM2m2FKpkAga8TIOFbb" media="(prefers-color-scheme: dark)"><img src="/files/eo34LZV7MdKAUF0kjnUA" alt=""></picture><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onum.com/usecases/observability/routing-and-monitoring-telemetry-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
