> ## 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.

# AL0072 - Metric method must be partial

> Source generator requires metric methods to be partial

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

## Description

Methods annotated with metric attributes (`[Counter]`, `[Histogram]`, etc.) must be `partial` so the source generator can provide the implementation.

## Bad Code

```csharp theme={null}
[Meter("MyService")]
public static partial class MyMetrics
{
    [Counter] public static void OrderCount() { }
}
```

## Good Code

```csharp theme={null}
[Meter("MyService")]
public static partial class MyMetrics
{
    [Counter] public static partial void OrderCount();
}
```

## Properties

* **Category**: Metrics
* **Severity**: Error
* **Enabled by default**: True
* **Code fix available**: True

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0072.severity = error
```
