Class MetricDescriptor
Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable.
Inheritance
Implements
Inherited Members
Namespace: Google.Api
Assembly: Google.Api.CommonProtos.dll
Syntax
public sealed class MetricDescriptor : IMessage<MetricDescriptor>, IMessage, IEquatable<MetricDescriptor>, IDeepCloneable<MetricDescriptor>
Constructors
MetricDescriptor()
Declaration
public MetricDescriptor()
MetricDescriptor(MetricDescriptor)
Declaration
public MetricDescriptor(MetricDescriptor other)
Parameters
| Type | Name | Description |
|---|---|---|
| MetricDescriptor | other |
Fields
DescriptionFieldNumber
Field number for the "description" field.
Declaration
public const int DescriptionFieldNumber = 6
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DisplayNameFieldNumber
Field number for the "display_name" field.
Declaration
public const int DisplayNameFieldNumber = 7
Field Value
| Type | Description |
|---|---|
| System.Int32 |
LabelsFieldNumber
Field number for the "labels" field.
Declaration
public const int LabelsFieldNumber = 2
Field Value
| Type | Description |
|---|---|
| System.Int32 |
LaunchStageFieldNumber
Field number for the "launch_stage" field.
Declaration
public const int LaunchStageFieldNumber = 12
Field Value
| Type | Description |
|---|---|
| System.Int32 |
MetadataFieldNumber
Field number for the "metadata" field.
Declaration
public const int MetadataFieldNumber = 10
Field Value
| Type | Description |
|---|---|
| System.Int32 |
MetricKindFieldNumber
Field number for the "metric_kind" field.
Declaration
public const int MetricKindFieldNumber = 3
Field Value
| Type | Description |
|---|---|
| System.Int32 |
NameFieldNumber
Field number for the "name" field.
Declaration
public const int NameFieldNumber = 1
Field Value
| Type | Description |
|---|---|
| System.Int32 |
TypeFieldNumber
Field number for the "type" field.
Declaration
public const int TypeFieldNumber = 8
Field Value
| Type | Description |
|---|---|
| System.Int32 |
UnitFieldNumber
Field number for the "unit" field.
Declaration
public const int UnitFieldNumber = 5
Field Value
| Type | Description |
|---|---|
| System.Int32 |
ValueTypeFieldNumber
Field number for the "value_type" field.
Declaration
public const int ValueTypeFieldNumber = 4
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Properties
Description
A detailed description of the metric, which can be used in documentation.
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Descriptor
Declaration
public static MessageDescriptor Descriptor { get; }
Property Value
| Type | Description |
|---|---|
| MessageDescriptor |
DisplayName
A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Declaration
public string DisplayName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Labels
The set of labels that can be used to describe a specific
instance of this metric type. For example, the
appengine.googleapis.com/http/server/response_latencies metric
type has a label for the HTTP response code, response_code, so
you can look at latencies for successful responses or just
for responses that failed.
Declaration
public RepeatedField<LabelDescriptor> Labels { get; }
Property Value
| Type | Description |
|---|---|
| RepeatedField<LabelDescriptor> |
LaunchStage
Optional. The launch stage of the metric definition.
Declaration
public LaunchStage LaunchStage { get; set; }
Property Value
| Type | Description |
|---|---|
| LaunchStage |
Metadata
Optional. Metadata which can be used to guide usage of the metric.
Declaration
public MetricDescriptor.Types.MetricDescriptorMetadata Metadata { get; set; }
Property Value
| Type | Description |
|---|---|
| MetricDescriptor.Types.MetricDescriptorMetadata |
MetricKind
Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metric_kind and value_type might not be supported.
Declaration
public MetricDescriptor.Types.MetricKind MetricKind { get; set; }
Property Value
| Type | Description |
|---|---|
| MetricDescriptor.Types.MetricKind |
Name
The resource name of the metric descriptor.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Parser
Declaration
public static MessageParser<MetricDescriptor> Parser { get; }
Property Value
| Type | Description |
|---|---|
| MessageParser<MetricDescriptor> |
Type
The metric type, including its DNS name prefix. The type is not
URL-encoded. All user-defined metric types have the DNS name
custom.googleapis.com or external.googleapis.com. Metric types should
use a natural hierarchical grouping. For example:
"custom.googleapis.com/invoice/paid/amount" "external.googleapis.com/prometheus/up" "appengine.googleapis.com/http/server/response_latencies"
Declaration
public string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Unit
The units in which the metric value is reported. It is only applicable
if the value_type is INT64, DOUBLE, or DISTRIBUTION. The unit
defines the representation of the stored metric values.
Different systems may scale the values to be more easily displayed (so a
value of 0.02KBy might be displayed as 20By, and a value of
3523KBy might be displayed as 3.5MBy). However, if the unit is
KBy, then the value of the metric is always in thousands of bytes, no
matter how it may be displayed..
If you want a custom metric to record the exact number of CPU-seconds used
by a job, you can create an INT64 CUMULATIVE metric whose unit is
s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005
CPU-seconds, then the value is written as 12005.
Alternatively, if you want a custome metric to record data in a more
granular way, you can create a DOUBLE CUMULATIVE metric whose unit is
ks{CPU}, and then write the value 12.005 (which is 12005/1000),
or use Kis{CPU} and write 11.723 (which is 12005/1024).
The supported units are a subset of The Unified Code for Units of Measure standard:
Basic units (UNIT)
bitbitBybytessecondminminutehhourdday
Prefixes (PREFIX)
kkilo (10^3)Mmega (10^6)Ggiga (10^9)Ttera (10^12)Ppeta (10^15)Eexa (10^18)Zzetta (10^21)Yyotta (10^24)mmilli (10^-3)umicro (10^-6)nnano (10^-9)ppico (10^-12)ffemto (10^-15)aatto (10^-18)zzepto (10^-21)yyocto (10^-24)Kikibi (2^10)Mimebi (2^20)Gigibi (2^30)Titebi (2^40)Pipebi (2^50)
Grammar
The grammar also includes these connectors:
/division or ratio (as an infix operator). For examples,kBy/{email}orMiBy/10ms(although you should almost never have/sin a metricunit; rates should always be computed at query time from the underlying cumulative or delta value)..multiplication or composition (as an infix operator). For examples,GBy.dork{watt}.h.
The grammar for a unit is as follows:
Expression = Component { "." Component } { "/" Component } ;
Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] | Annotation | "1" ;
Annotation = "{" NAME "}" ;
Notes:
Annotationis just a comment if it follows aUNIT. If the annotation is used alone, then the unit is equivalent to1. For examples,{request}/s == 1/s,By{transmitted}/s == By/s.NAMEis a sequence of non-blank printable ASCII characters not containing{or}.1represents a unitary dimensionless unit of 1, such as in1/s. It is typically used when none of the basic units are appropriate. For example, "new users per day" can be represented as1/dor{new-users}/d(and a metric value5would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as1000/dork1/dork{page_views}/d(and a metric value of5.3would mean "5300 page views per day").%represents dimensionless value of 1/100, and annotates values giving a percentage (so the metric values are typically in the range of 0..100, and a metric value3means "3 percent").10^2.%indicates a metric contains a ratio, typically in the range 0..1, that will be multiplied by 100 and displayed as a percentage (so a metric value0.03means "3 percent").
Declaration
public string Unit { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
ValueType
Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metric_kind and value_type might not be supported.
Declaration
public MetricDescriptor.Types.ValueType ValueType { get; set; }
Property Value
| Type | Description |
|---|---|
| MetricDescriptor.Types.ValueType |
Methods
CalculateSize()
Declaration
public int CalculateSize()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Implements
Clone()
Declaration
public MetricDescriptor Clone()
Returns
| Type | Description |
|---|---|
| MetricDescriptor |
Implements
Equals(MetricDescriptor)
Declaration
public bool Equals(MetricDescriptor other)
Parameters
| Type | Name | Description |
|---|---|---|
| MetricDescriptor | other |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Implements
Equals(Object)
Declaration
public override bool Equals(object other)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | other |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
MergeFrom(MetricDescriptor)
Declaration
public void MergeFrom(MetricDescriptor other)
Parameters
| Type | Name | Description |
|---|---|---|
| MetricDescriptor | other |
Implements
MergeFrom(CodedInputStream)
Declaration
public void MergeFrom(CodedInputStream input)
Parameters
| Type | Name | Description |
|---|---|---|
| CodedInputStream | input |
Implements
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
WriteTo(CodedOutputStream)
Declaration
public void WriteTo(CodedOutputStream output)
Parameters
| Type | Name | Description |
|---|---|---|
| CodedOutputStream | output |
Implements
Explicit Interface Implementations
IMessage.Descriptor
Declaration
MessageDescriptor IMessage.Descriptor { get; }
Returns
| Type | Description |
|---|---|
| MessageDescriptor |