> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AL0079 - Manual span recommended

> Complex async patterns benefit from manual spans for better tracing

Source: [Al0079ManualSpanRecommendedAnalyzer.cs](https://github.com/ANcpLua/ANcpLua.Analyzers/blob/main/src/ANcpLua.Analyzers/Analyzers/Al0079ManualSpanRecommendedAnalyzer.cs)

## Description

Complex async patterns such as parallel tasks, fan-out/fan-in, or background processing benefit from manual spans to accurately capture the execution flow.

## Bad Code

```csharp theme={null}
public async Task ProcessBatch(IEnumerable<Order> orders)
{
    await Task.WhenAll(orders.Select(ProcessOrder));
    // No span to group the parallel work
}
```

## Good Code

```csharp theme={null}
public async Task ProcessBatch(IEnumerable<Order> orders)
{
    using var activity = source.StartActivity("ProcessBatch");
    await Task.WhenAll(orders.Select(ProcessOrder));
}
```

## Properties

* **Category**: OpenTelemetry
* **Severity**: Info
* **Enabled by default**: True
* **Code fix available**: False

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0079.severity = suggestion
```
