語言

HistogramAttribute<T> 類別

定義

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

generic <typename T>
 where T : value classpublic ref class HistogramAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class HistogramAttribute<T> : Attribute where T : struct
[<System.AttributeUsage(System.AttributeTargets.Method)>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type HistogramAttribute<'T (requires 'T : struct)> = class
    inherit Attribute
Public NotInheritable Class HistogramAttribute(Of T)
Inherits Attribute

類型參數

T

直方圖所能保持的值類型,限制為 Byte、 Int16、 DecimalInt32Int64SingleDouble或 。

繼承
HistogramAttribute<T>
屬性

範例

static partial class Metric
{
    [Histogram<int>("RequestName", "RequestStatusCode")]
    static partial RequestLatency CreateRequestLatency(Meter meter);
}

備註

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

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

建構函式

名稱 Description
HistogramAttribute<T>(String[])

初始化 HistogramAttribute<T> 類別的新執行個體。

HistogramAttribute<T>(Type)

初始化 HistogramAttribute<T> 類別的新執行個體。

屬性

名稱 Description
Name

取得或設定指標名稱。

TagNames

取得指標的標籤名稱。

Type

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

Unit

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

適用於