Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
metric.proto269 linesDownload Raw Back to api
1// Copyright 2023 Google LLC2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7//     http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14 15syntax = "proto3";16 17package google.api;18 19import "google/api/label.proto";20import "google/api/launch_stage.proto";21import "google/protobuf/duration.proto";22 23option go_package = "google.golang.org/genproto/googleapis/api/metric;metric";24option java_multiple_files = true;25option java_outer_classname = "MetricProto";26option java_package = "com.google.api";27option objc_class_prefix = "GAPI";28 29// Defines a metric type and its schema. Once a metric descriptor is created,30// deleting or altering it stops data collection and makes the metric type's31// existing data unusable.32//33message MetricDescriptor {34  // The kind of measurement. It describes how the data is reported.35  // For information on setting the start time and end time based on36  // the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].37  enum MetricKind {38    // Do not use this default value.39    METRIC_KIND_UNSPECIFIED = 0;40 41    // An instantaneous measurement of a value.42    GAUGE = 1;43 44    // The change in a value during a time interval.45    DELTA = 2;46 47    // A value accumulated over a time interval.  Cumulative48    // measurements in a time series should have the same start time49    // and increasing end times, until an event resets the cumulative50    // value to zero and sets a new start time for the following51    // points.52    CUMULATIVE = 3;53  }54 55  // The value type of a metric.56  enum ValueType {57    // Do not use this default value.58    VALUE_TYPE_UNSPECIFIED = 0;59 60    // The value is a boolean.61    // This value type can be used only if the metric kind is `GAUGE`.62    BOOL = 1;63 64    // The value is a signed 64-bit integer.65    INT64 = 2;66 67    // The value is a double precision floating point number.68    DOUBLE = 3;69 70    // The value is a text string.71    // This value type can be used only if the metric kind is `GAUGE`.72    STRING = 4;73 74    // The value is a [`Distribution`][google.api.Distribution].75    DISTRIBUTION = 5;76 77    // The value is money.78    MONEY = 6;79  }80 81  // Additional annotations that can be used to guide the usage of a metric.82  message MetricDescriptorMetadata {83    // Deprecated. Must use the84    // [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]85    // instead.86    LaunchStage launch_stage = 1 [deprecated = true];87 88    // The sampling period of metric data points. For metrics which are written89    // periodically, consecutive data points are stored at this time interval,90    // excluding data loss due to errors. Metrics with a higher granularity have91    // a smaller sampling period.92    google.protobuf.Duration sample_period = 2;93 94    // The delay of data points caused by ingestion. Data points older than this95    // age are guaranteed to be ingested and available to be read, excluding96    // data loss due to errors.97    google.protobuf.Duration ingest_delay = 3;98  }99 100  // The resource name of the metric descriptor.101  string name = 1;102 103  // The metric type, including its DNS name prefix. The type is not104  // URL-encoded. All user-defined metric types have the DNS name105  // `custom.googleapis.com` or `external.googleapis.com`. Metric types should106  // use a natural hierarchical grouping. For example:107  //108  //     "custom.googleapis.com/invoice/paid/amount"109  //     "external.googleapis.com/prometheus/up"110  //     "appengine.googleapis.com/http/server/response_latencies"111  string type = 8;112 113  // The set of labels that can be used to describe a specific114  // instance of this metric type. For example, the115  // `appengine.googleapis.com/http/server/response_latencies` metric116  // type has a label for the HTTP response code, `response_code`, so117  // you can look at latencies for successful responses or just118  // for responses that failed.119  repeated LabelDescriptor labels = 2;120 121  // Whether the metric records instantaneous values, changes to a value, etc.122  // Some combinations of `metric_kind` and `value_type` might not be supported.123  MetricKind metric_kind = 3;124 125  // Whether the measurement is an integer, a floating-point number, etc.126  // Some combinations of `metric_kind` and `value_type` might not be supported.127  ValueType value_type = 4;128 129  // The units in which the metric value is reported. It is only applicable130  // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`131  // defines the representation of the stored metric values.132  //133  // Different systems might scale the values to be more easily displayed (so a134  // value of `0.02kBy` _might_ be displayed as `20By`, and a value of135  // `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is136  // `kBy`, then the value of the metric is always in thousands of bytes, no137  // matter how it might be displayed.138  //139  // If you want a custom metric to record the exact number of CPU-seconds used140  // by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is141  // `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005142  // CPU-seconds, then the value is written as `12005`.143  //144  // Alternatively, if you want a custom metric to record data in a more145  // granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is146  // `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),147  // or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).148  //149  // The supported units are a subset of [The Unified Code for Units of150  // Measure](https://unitsofmeasure.org/ucum.html) standard:151  //152  // **Basic units (UNIT)**153  //154  // * `bit`   bit155  // * `By`    byte156  // * `s`     second157  // * `min`   minute158  // * `h`     hour159  // * `d`     day160  // * `1`     dimensionless161  //162  // **Prefixes (PREFIX)**163  //164  // * `k`     kilo    (10^3)165  // * `M`     mega    (10^6)166  // * `G`     giga    (10^9)167  // * `T`     tera    (10^12)168  // * `P`     peta    (10^15)169  // * `E`     exa     (10^18)170  // * `Z`     zetta   (10^21)171  // * `Y`     yotta   (10^24)172  //173  // * `m`     milli   (10^-3)174  // * `u`     micro   (10^-6)175  // * `n`     nano    (10^-9)176  // * `p`     pico    (10^-12)177  // * `f`     femto   (10^-15)178  // * `a`     atto    (10^-18)179  // * `z`     zepto   (10^-21)180  // * `y`     yocto   (10^-24)181  //182  // * `Ki`    kibi    (2^10)183  // * `Mi`    mebi    (2^20)184  // * `Gi`    gibi    (2^30)185  // * `Ti`    tebi    (2^40)186  // * `Pi`    pebi    (2^50)187  //188  // **Grammar**189  //190  // The grammar also includes these connectors:191  //192  // * `/`    division or ratio (as an infix operator). For examples,193  //          `kBy/{email}` or `MiBy/10ms` (although you should almost never194  //          have `/s` in a metric `unit`; rates should always be computed at195  //          query time from the underlying cumulative or delta value).196  // * `.`    multiplication or composition (as an infix operator). For197  //          examples, `GBy.d` or `k{watt}.h`.198  //199  // The grammar for a unit is as follows:200  //201  //     Expression = Component { "." Component } { "/" Component } ;202  //203  //     Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]204  //               | Annotation205  //               | "1"206  //               ;207  //208  //     Annotation = "{" NAME "}" ;209  //210  // Notes:211  //212  // * `Annotation` is just a comment if it follows a `UNIT`. If the annotation213  //    is used alone, then the unit is equivalent to `1`. For examples,214  //    `{request}/s == 1/s`, `By{transmitted}/s == By/s`.215  // * `NAME` is a sequence of non-blank printable ASCII characters not216  //    containing `{` or `}`.217  // * `1` represents a unitary [dimensionless218  //    unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such219  //    as in `1/s`. It is typically used when none of the basic units are220  //    appropriate. For example, "new users per day" can be represented as221  //    `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new222  //    users). Alternatively, "thousands of page views per day" would be223  //    represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric224  //    value of `5.3` would mean "5300 page views per day").225  // * `%` represents dimensionless value of 1/100, and annotates values giving226  //    a percentage (so the metric values are typically in the range of 0..100,227  //    and a metric value `3` means "3 percent").228  // * `10^2.%` indicates a metric contains a ratio, typically in the range229  //    0..1, that will be multiplied by 100 and displayed as a percentage230  //    (so a metric value `0.03` means "3 percent").231  string unit = 5;232 233  // A detailed description of the metric, which can be used in documentation.234  string description = 6;235 236  // A concise name for the metric, which can be displayed in user interfaces.237  // Use sentence case without an ending period, for example "Request count".238  // This field is optional but it is recommended to be set for any metrics239  // associated with user-visible concepts, such as Quota.240  string display_name = 7;241 242  // Optional. Metadata which can be used to guide usage of the metric.243  MetricDescriptorMetadata metadata = 10;244 245  // Optional. The launch stage of the metric definition.246  LaunchStage launch_stage = 12;247 248  // Read-only. If present, then a [time249  // series][google.monitoring.v3.TimeSeries], which is identified partially by250  // a metric type and a251  // [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that252  // is associated with this metric type can only be associated with one of the253  // monitored resource types listed here.254  repeated string monitored_resource_types = 13;255}256 257// A specific metric, identified by specifying values for all of the258// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].259message Metric {260  // An existing metric type, see261  // [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,262  // `custom.googleapis.com/invoice/paid/amount`.263  string type = 3;264 265  // The set of label values that uniquely identify this metric. All266  // labels listed in the `MetricDescriptor` must be assigned values.267  map<string, string> labels = 2;268}269 
codekingpro/portable-devtools · Team Ai