GaugeAttribute<T> Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menyediakan informasi untuk memandu produksi metode pabrik metrik pengukur yang sangat ditik dan jenis terkait.
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
Jenis parameter
- T
Jenis nilai yang akan dipegang alat ukur, yang terbatas pada Byte, , Int16, Int32Int64, Single, Double, atau Decimal.
- Warisan
- Atribut
Contoh
static partial class Metric
{
[Gauge<double>("MemoryUsage", "Region")]
static partial MemoryGauge CreateMemoryGauge(Meter meter);
}
Keterangan
Atribut ini diterapkan ke metode yang memiliki batasan berikut:
- Harus berupa metode parsial.
- Harus kembali
metricNamesebagai jenis. Kelas dengan nama tersebut akan dihasilkan. - Tidak boleh generik.
- Harus memiliki
System.Diagnostics.Metrics.Meterparameter pertama. - Harus memiliki semua kunci yang disediakan sebagai
staticTagsparameter jenis string.
Konstruktor
| Nama | Deskripsi |
|---|---|
| GaugeAttribute<T>(String[]) |
Menginisialisasi instans baru dari kelas GaugeAttribute<T>. |
| GaugeAttribute<T>(Type) |
Menginisialisasi instans baru dari kelas GaugeAttribute<T>. |
Properti
| Nama | Deskripsi |
|---|---|
| Name |
Mendapatkan atau mengatur nama metrik. |
| TagNames |
Mendapatkan nama tag metrik. |
| Type |
Mendapatkan jenis yang menyediakan nilai tag metrik. |
| Unit |
Mendapatkan atau mengatur unit pengukuran untuk metrik. |