語言

GaugeAttribute 類別

定義

提供資訊,以引導強型別量測計計量處理站方法和相關聯型別的生產。

public ref class GaugeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class GaugeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type GaugeAttribute = class
    inherit Attribute
Public NotInheritable Class GaugeAttribute
Inherits Attribute
繼承
GaugeAttribute
屬性

範例

static partial class Metric
{
    [Gauge]
    static partial MemoryUsage CreateMemoryUsage(Meter meter);
}

備註

此屬性應用於具有以下限制的方法:

  • 一定是部分方法。
  • 必須返回 metricName 為類型。 會產生一個名為該名稱的類別。
  • 不能是通用的。
  • 必須是第一個 System.Diagnostics.Metrics.Meter 參數。
  • 必須將所有鍵以字串類型參數的形式提供 staticTags 。

建構函式

名稱 Description
GaugeAttribute(String[])

初始化 GaugeAttribute 類別的新執行個體。

GaugeAttribute(Type)

初始化 GaugeAttribute 類別的新執行個體。

屬性

名稱 Description
Name

取得或設定指標名稱。

TagNames

取得指標的標籤名稱。

Type

取得提供指標標籤值的類型。

Unit

取得或設定公制的計量單位。

適用於