Ferrous API Reference

All Types / Ferrous

class InstrumentAttribute

public sealed class InstrumentAttribute : Attribute

Marks a partial method for compile-time System.Diagnostics.Activity span instrumentation inspired by Rust's #[tracing::instrument]. The Ferrous.Unions source generator emits a System.Diagnostics.ActivitySource span wrapping a companion {MethodName}Core(...) implementation and automatically records non-skipped parameter values as activity tags.

Constructors

public InstrumentAttribute(string? name = null)

Initializes a new InstrumentAttribute with an optional span name.

Parameters
name
Optional custom span name. Defaults to TypeName.MethodName.

Properties

public string? Name

Gets the optional custom span name.

public string? SourceName

Gets or sets the optional ActivitySource name. Defaults to the containing type's full name.

public bool SkipParameters

Gets or sets a value indicating whether method parameters should be omitted from activity tags.