Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Span Links Beta Documentation #20717

Merged
merged 18 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions content/en/tracing/trace_collection/custom_instrumentation/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,25 @@ class SomeClass {
}
}
```
### Adding span links (Beta)

<div class="alert alert-info">Support for span links is in beta and requires the <a href="https://github.com/DataDog/dd-trace-java/releases/tag/v1.24.1">Java tracer v.1.24.1+</a></div>
brett0000FF marked this conversation as resolved.
Show resolved Hide resolved

Span links associate one or more spans together that don't have a typical parent-child relationship. They may associate spans within the same trace or spans across different traces.

Span links help trace operations in distributed systems, where workflows often deviate from linear execution patterns. Additionally, span links are useful to trace the flow of operations in systems that execute requests in batches or process events asynchronously.

To add a link span from another span:

```java
span.addLink(Link.fromSpanContext(otherSpanData));
```

To add a link span from distributed headers:
```java
SpanContext remoteSpanContext = extractContextFromHeaders(distributedTracingHeaders);
span.addLink(Link.fromSpanContext(remoteSpanContext));
```

### Extending tracers

Expand Down
18 changes: 18 additions & 0 deletions content/en/tracing/trace_collection/custom_instrumentation/php.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,24 @@ function doRiskyThing() {
{{% /tab %}}
{{< /tabs >}}

## Adding span links (Beta)

Span links associate one or more spans together that don't have a typical parent-child relationship. They may associate spans within the same trace or spans across different traces.

Span links help trace operations in distributed systems, where workflows often deviate from linear execution patterns. Additionally, span links are useful to trace the flow of operations in systems that execute requests in batches or process events asynchronously.

To add a link span from another span:

```php
$span->links[] = $otherSpanData->getLink();
```

To add a link span from distributed headers:
```php
$span->links[] = SpanLink::fromHeaders($distributedTracingHeaders);
```


## Context propagation for distributed traces

You can configure the propagation of context for distributed traces by injecting and extracting headers. Read [Trace Context Propagation][9] for information.
Expand Down
24 changes: 24 additions & 0 deletions content/en/tracing/trace_explorer/trace_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,30 @@ Click **View in ASM** to investigate further using [Datadog Application Security
{{< img src="tracing/visualization/trace/trace_security.png" alt="Trace Attack Attempts" style="width:90%;">}}

[1]: /security/application_security/how-appsec-works/
{{% /tab %}}
{{% tab "Span Links (Beta)" %}}

<div class="alert alert-info"><strong>Beta</strong>: Span link are automatically supported if you use the <a href="https://docs.datadoghq.com/opentelemetry/otel_collector_datadog_exporter/?tab=onahost">OpenTelemetry Collector Datadog Exporter</a>, <a href="https://github.com/DataDog/dd-trace-php/releases/tag/0.87.2">PHP tracer v0.87.2+</a>, or <a href="https://github.com/DataDog/dd-trace-java/releases/tag/v1.24.1">Java tracer v.1.24.1+</a>.</div>

Span links associate one or more spans together that don't have a typical parent-child relationship. They may associate spans within the same trace or spans across different traces.

Span links help trace operations in distributed systems, where workflows often deviate from linear execution patterns. Additionally, span links are useful to trace the flow of operations in systems that execute requests in batches or process events asynchronously.

Click on a span in the flame graph to display spans connected with span links.

{{< img src="tracing/span_links/span_links_tab.png" alt="Span Links tab" style="width:90%;">}}

If you see a message that says **Linked spans were not ingested**, make sure the linked spans are part of a [retention filter][2].

To add custom instrumentation for span links, read the Datadog libraries documentation for your application's language:
* [PHP][3]
* [Java][4]

[1]: /tracing/trace_collection/custom_instrumentation/
[2]: /tracing/trace_pipeline/trace_retention/
[3]: /tracing/trace_collection/custom_instrumentation/php
[4]: /tracing/trace_collection/custom_instrumentation/java

{{% /tab %}}
{{< /tabs >}}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.