Share via


CounterAttribute.Name Proprietà

Definizione

Ottiene o imposta il nome della metrica.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string? Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

Valore della proprietà

Esempio

In questo esempio il nome della metrica è SampleMetric. Quando Name non viene specificato, il tipo restituito del metodo viene usato come nome della metrica. In questo esempio il nome della metrica sarebbe RequestCounter se Name non fosse stato specificato.

static partial class Metric
{
    [Counter("RequestName", "RequestStatusCode", Name="SampleMetric")]
    static partial RequestCounter CreateRequestCounter(Meter meter);
}

Commenti

In questo esempio il nome della metrica è SampleMetric. Quando Name non viene specificato il tipo restituito del metodo viene usato come nome della metrica. In questo esempio, questo sarebbe RequestCounter se Name non fosse stato specificato.

Si applica a