Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
metric.proto288 linesDownload Raw Back to api
1// Copyright 2026 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    // The resource hierarchy level of the timeseries data of a metric.84    enum TimeSeriesResourceHierarchyLevel {85      // Do not use this default value.86      TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0;87 88      // Scopes a metric to a project.89      PROJECT = 1;90 91      // Scopes a metric to an organization.92      ORGANIZATION = 2;93 94      // Scopes a metric to a folder.95      FOLDER = 3;96    }97 98    // Deprecated. Must use the99    // [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]100    // instead.101    LaunchStage launch_stage = 1 [deprecated = true];102 103    // The sampling period of metric data points. For metrics which are written104    // periodically, consecutive data points are stored at this time interval,105    // excluding data loss due to errors. Metrics with a higher granularity have106    // a smaller sampling period.107    google.protobuf.Duration sample_period = 2;108 109    // The delay of data points caused by ingestion. Data points older than this110    // age are guaranteed to be ingested and available to be read, excluding111    // data loss due to errors.112    google.protobuf.Duration ingest_delay = 3;113 114    // The scope of the timeseries data of the metric.115    repeated TimeSeriesResourceHierarchyLevel116        time_series_resource_hierarchy_level = 4;117  }118 119  // The resource name of the metric descriptor.120  string name = 1;121 122  // The metric type, including its DNS name prefix. The type is not123  // URL-encoded. All user-defined metric types have the DNS name124  // `custom.googleapis.com` or `external.googleapis.com`. Metric types should125  // use a natural hierarchical grouping. For example:126  //127  //     "custom.googleapis.com/invoice/paid/amount"128  //     "external.googleapis.com/prometheus/up"129  //     "appengine.googleapis.com/http/server/response_latencies"130  string type = 8;131 132  // The set of labels that can be used to describe a specific133  // instance of this metric type. For example, the134  // `appengine.googleapis.com/http/server/response_latencies` metric135  // type has a label for the HTTP response code, `response_code`, so136  // you can look at latencies for successful responses or just137  // for responses that failed.138  repeated LabelDescriptor labels = 2;139 140  // Whether the metric records instantaneous values, changes to a value, etc.141  // Some combinations of `metric_kind` and `value_type` might not be supported.142  MetricKind metric_kind = 3;143 144  // Whether the measurement is an integer, a floating-point number, etc.145  // Some combinations of `metric_kind` and `value_type` might not be supported.146  ValueType value_type = 4;147 148  // The units in which the metric value is reported. It is only applicable149  // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`150  // defines the representation of the stored metric values.151  //152  // Different systems might scale the values to be more easily displayed (so a153  // value of `0.02kBy` _might_ be displayed as `20By`, and a value of154  // `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is155  // `kBy`, then the value of the metric is always in thousands of bytes, no156  // matter how it might be displayed.157  //158  // If you want a custom metric to record the exact number of CPU-seconds used159  // by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is160  // `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005161  // CPU-seconds, then the value is written as `12005`.162  //163  // Alternatively, if you want a custom metric to record data in a more164  // granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is165  // `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),166  // or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).167  //168  // The supported units are a subset of [The Unified Code for Units of169  // Measure](https://unitsofmeasure.org/ucum.html) standard:170  //171  // **Basic units (UNIT)**172  //173  // * `bit`   bit174  // * `By`    byte175  // * `s`     second176  // * `min`   minute177  // * `h`     hour178  // * `d`     day179  // * `1`     dimensionless180  //181  // **Prefixes (PREFIX)**182  //183  // * `k`     kilo    (10^3)184  // * `M`     mega    (10^6)185  // * `G`     giga    (10^9)186  // * `T`     tera    (10^12)187  // * `P`     peta    (10^15)188  // * `E`     exa     (10^18)189  // * `Z`     zetta   (10^21)190  // * `Y`     yotta   (10^24)191  //192  // * `m`     milli   (10^-3)193  // * `u`     micro   (10^-6)194  // * `n`     nano    (10^-9)195  // * `p`     pico    (10^-12)196  // * `f`     femto   (10^-15)197  // * `a`     atto    (10^-18)198  // * `z`     zepto   (10^-21)199  // * `y`     yocto   (10^-24)200  //201  // * `Ki`    kibi    (2^10)202  // * `Mi`    mebi    (2^20)203  // * `Gi`    gibi    (2^30)204  // * `Ti`    tebi    (2^40)205  // * `Pi`    pebi    (2^50)206  //207  // **Grammar**208  //209  // The grammar also includes these connectors:210  //211  // * `/`    division or ratio (as an infix operator). For examples,212  //          `kBy/{email}` or `MiBy/10ms` (although you should almost never213  //          have `/s` in a metric `unit`; rates should always be computed at214  //          query time from the underlying cumulative or delta value).215  // * `.`    multiplication or composition (as an infix operator). For216  //          examples, `GBy.d` or `k{watt}.h`.217  //218  // The grammar for a unit is as follows:219  //220  //     Expression = Component { "." Component } { "/" Component } ;221  //222  //     Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]223  //               | Annotation224  //               | "1"225  //               ;226  //227  //     Annotation = "{" NAME "}" ;228  //229  // Notes:230  //231  // * `Annotation` is just a comment if it follows a `UNIT`. If the annotation232  //    is used alone, then the unit is equivalent to `1`. For examples,233  //    `{request}/s == 1/s`, `By{transmitted}/s == By/s`.234  // * `NAME` is a sequence of non-blank printable ASCII characters not235  //    containing `{` or `}`.236  // * `1` represents a unitary [dimensionless237  //    unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such238  //    as in `1/s`. It is typically used when none of the basic units are239  //    appropriate. For example, "new users per day" can be represented as240  //    `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new241  //    users). Alternatively, "thousands of page views per day" would be242  //    represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric243  //    value of `5.3` would mean "5300 page views per day").244  // * `%` represents dimensionless value of 1/100, and annotates values giving245  //    a percentage (so the metric values are typically in the range of 0..100,246  //    and a metric value `3` means "3 percent").247  // * `10^2.%` indicates a metric contains a ratio, typically in the range248  //    0..1, that will be multiplied by 100 and displayed as a percentage249  //    (so a metric value `0.03` means "3 percent").250  string unit = 5;251 252  // A detailed description of the metric, which can be used in documentation.253  string description = 6;254 255  // A concise name for the metric, which can be displayed in user interfaces.256  // Use sentence case without an ending period, for example "Request count".257  // This field is optional but it is recommended to be set for any metrics258  // associated with user-visible concepts, such as Quota.259  string display_name = 7;260 261  // Optional. Metadata which can be used to guide usage of the metric.262  MetricDescriptorMetadata metadata = 10;263 264  // Optional. The launch stage of the metric definition.265  LaunchStage launch_stage = 12;266 267  // Read-only. If present, then a [time268  // series][google.monitoring.v3.TimeSeries], which is identified partially by269  // a metric type and a270  // [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that271  // is associated with this metric type can only be associated with one of the272  // monitored resource types listed here.273  repeated string monitored_resource_types = 13;274}275 276// A specific metric, identified by specifying values for all of the277// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].278message Metric {279  // An existing metric type, see280  // [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,281  // `custom.googleapis.com/invoice/paid/amount`.282  string type = 3;283 284  // The set of label values that uniquely identify this metric. All285  // labels listed in the `MetricDescriptor` must be assigned values.286  map<string, string> labels = 2;287}288 
codekingpro/portable-devtools · Team Ai