# Distributed Tracing

**Distributed Tracing** enables tracking of requests as they pass through the microservices in a syste&#x6D;**.** Ddosify captures **Traces** and **Spans** out-of-the-box on your Kubernetes Cluster without modifying your code or restarting your services. Ddosify uses a lightweight [eBPF Agent (Alaz)](https://github.com/ddosify/alaz) to generate Distributed Tracing data and enable auto context propagation.

To do so, on the [Ddosify Platform](https://app.ddosify.com/), click "Clusters" under the "Observability" tab first.

<figure><img src="https://lh7-us.googleusercontent.com/jwKB_O5sondiEwSa7sYoj68H0mVQNdPzfsgTLIm--2VitdJijaxUi7qEURCVCrb1o-lCxQvp3VAnPMaXZGdgS-VT22YGWe-yrO4qQYSSHDLQNff006wkzMHSQ5qH01gof15eHeB17uaOkJVlbU-4-ec" alt=""><figcaption><p>Clusters Page</p></figcaption></figure>

After you click on a cluster you want to observe on the clusters page, click on the distributed tracing tab. This will take you to the distributed tracing page. You will see this:

<figure><img src="/files/fWVKJvj5fwppIhDcIpur" alt=""><figcaption><p>Distributed Tracing</p></figcaption></figure>

Here, you can filter and view traces in chart and list form.

### Filtering

You can apply the following filtering:

* Operations (trace names)
* Trace count
* Tags
* Min/max duration (in ms)
* Min/max span count
* Time interval

{% hint style="info" %}
**Note:** Filtering affects both the trace chart and the trace list. They show the same traces but in different formats.
{% endhint %}

To apply filtering, click the "Filters" button on the upper right.

<figure><img src="/files/AGiJ5hwfngsc46ijEJta" alt="" width="375"><figcaption><p>Trace filtering</p></figcaption></figure>

#### Operations

Operations filtering allows you to select traces with specific names. It allows multi-select so that you can look for multiple names.

{% hint style="info" %}
**Note:** The name of a trace is the name of its first span.
{% endhint %}

#### Max Results

This limits the number of traces shown.

#### Tags

Tags allow you to filter traces by the tags in their spans. Tag filtering accepts the [logfmt](https://brandur.org/logfmt) format.

{% hint style="info" %}
**Note:** Span attributes are not allowed to be nested; thus, tag filtering does not support nested filtering either.
{% endhint %}

Let's see how we can query traces by their tags. Let this be an example tags for a span:

```json
{
    "path": "/", 
    "to_ip": "192.168.20.73", 
    "method": "GET", 
    "to_uid": "d0210c8f-fe44-472c-bbb2-39d64973e5a4", 
    "from_ip": "192.168.30.206", 
    "to_name": "kube-state-metrics-shard", 
    "to_port": "8081", 
    "to_type": "daemonset", 
    "from_uid": "2148b55d-cab8-41c6-ab5e-b12d9630ba0c", 
    "protocol": "HTTP", 
    "from_name": "aws-node", 
    "from_port": "41736", 
    "from_type": "daemonset", 
    "status_code": "200"
}
```

An example tag filter could look like this:

```
method=GET protocol=HTTP from_port=41736
```

While filtering, it is enough for a single span of a trace to satisfy this filter. As a result, the traces with at least one span matching this filter are retrieved.

#### Min/Max Duration

You can filter the traces by the total time they took in ms.

#### Min/Max Span Count

You can also filter the traces by their span count.&#x20;

#### Time Interval

To apply a time interval, click the "Last 5 min" button next to the "Filters" button. You will see this:

<figure><img src="/files/DehgDL65NWWSgCzghIuy" alt=""><figcaption><p>Time interval filtering</p></figcaption></figure>

Here, you can specify your desired time interval. You can specify your start-end times yourself or pick predefined time intervals from the "Quick Selections" section.

{% hint style="info" %}
**Note:** The time interval between the start and the end could be apart at most 24 hours.
{% endhint %}

### Trace Chart

The trace chart allows you to view the distribution of your filtered traces by their dates and durations. While the x-axis is the date, the y-axis is the duration.

<figure><img src="/files/mYOhVltqJRdDCpPdGwav" alt=""><figcaption><p>Trace Chart</p></figcaption></figure>

To view more details (start time, name, duration, span count) about a trace, you can hover on it:

<figure><img src="/files/Ner3lX8A5TiUl5w5wXai" alt=""><figcaption><p>Hovering On A Trace</p></figcaption></figure>

### Trace List

Under the trace chart, you can view the filtered traces in a listed format. You can delete them here as well. You can also use the page numbers below to see the remaining traces.

<figure><img src="/files/eXhB33uEweepBL6Ft3mv" alt=""><figcaption><p>Trace List</p></figcaption></figure>

### Trace Details

After you click on a trace (either on the chart or the list), you can view its details (including its call hierarchy and time).

<figure><img src="/files/GgfXa4dfBoYfNYo8ivwA" alt=""><figcaption><p>Trace Details</p></figcaption></figure>

Each row represents a trace, whereas the columns represent the time.&#x20;

No matter how long your trace took, the whole hierarchy is always fitted inside your view, so you would not need scrolling/zooming to understand the trace.&#x20;

You can expand/collapse spans by clicking on their "Name" column.

<figure><img src="/files/V5GBKzHKlDY0qeOlF2bn" alt=""><figcaption><p>Collapsed Span</p></figcaption></figure>

You can also hover over a span to see its details, such as:

* Source/target ports
* Path (endpoint)
* Status code
* Request method
* Start/end time

<figure><img src="/files/2Q92OZHyKmXHjduVPMb8" alt=""><figcaption><p>Hovering On A Span</p></figcaption></figure>

For more details, you can click on a span:

<figure><img src="/files/jx8qv06KJd9YqIjL9zAL" alt="" width="563"><figcaption><p>Span Details</p></figcaption></figure>

Here, you can view the span's details, including:

* From/to resources
* From/to IPs
* From/to port numbers
* Start/end times
* Duration
* Path
* Method
* Protocol
* Status code

{% hint style="success" %}
If you require assistance with **Distributed Tracing**, you can join our[ Discord](https://discord.com/invite/9KdnrSUZQg) or send an email to <support@ddosify.com>.
{% endhint %}


---

# 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.ddosify.com/ddosify/kubernetes-monitoring/distributed-tracing.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.
