GaugeAttribute<T> Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Fornece informação para orientar a produção de um método de fábrica de métricas de calibre fortemente tipicado e do tipo associado.
generic <typename T>
where T : value classpublic ref class GaugeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
[System.Diagnostics.CodeAnalysis.Experimental("EXTEXP0003", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class GaugeAttribute<T> : Attribute where T : struct
[System.AttributeUsage(System.AttributeTargets.Method)]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class GaugeAttribute<T> : Attribute where T : struct
[<System.AttributeUsage(System.AttributeTargets.Method)>]
[<System.Diagnostics.CodeAnalysis.Experimental("EXTEXP0003", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type GaugeAttribute<'T (requires 'T : struct)> = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type GaugeAttribute<'T (requires 'T : struct)> = class
inherit Attribute
Public NotInheritable Class GaugeAttribute(Of T)
Inherits Attribute
Parâmetros de Tipo Genérico
- T
O tipo de valor que o calibre irá cumprir, que está limitado a Byte, Int16, Int32, Int64, Single, Double, ou Decimal.
- Herança
- Atributos
Exemplos
static partial class Metric
{
[Gauge<double>("MemoryUsage", "Region")]
static partial MemoryGauge CreateMemoryGauge(Meter meter);
}
Observações
Este atributo é aplicado a um método que tem as seguintes restrições:
- Deve ser um método parcial.
- Tem de regressar
metricNamecomo o tipo. Será gerada uma classe com esse nome. - Não deve ser genérico.
- Deve ter
System.Diagnostics.Metrics.Metercomo primeiro parâmetro. - Deve ter todas as chaves fornecidas
staticTagscomo parâmetros de tipo de string.
Construtores
| Name | Description |
|---|---|
| GaugeAttribute<T>(String[]) |
Inicializa uma nova instância da GaugeAttribute<T> classe. |
| GaugeAttribute<T>(Type) |
Inicializa uma nova instância da GaugeAttribute<T> classe. |
Propriedades
| Name | Description |
|---|---|
| Name |
Obtém ou define o nome da métrica. |
| TagNames |
Obtém os nomes das etiquetas da métrica. |
| Type |
Recebe o tipo que fornece valores métricos de etiquetas. |
| Unit |
Obtém ou define a unidade de medida para a métrica. |