blob: 572ba2b6802ba4f721dafbab58157787dca506a3 [file] [log] [blame]
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
Dan O'Mearadd494642020-05-01 07:42:23 -070075<h1><a href="logging_v2.html">Cloud Logging API</a> . <a href="logging_v2.projects.html">projects</a> . <a href="logging_v2.projects.metrics.html">metrics</a></h1>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070076<h2>Instance Methods</h2>
77<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070078 <code><a href="#create">create(parent, body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070079<p class="firstline">Creates a logs-based metric.</p>
80<p class="toc_element">
Thomas Coffee2f245372017-03-27 10:39:26 -070081 <code><a href="#delete">delete(metricName, x__xgafv=None)</a></code></p>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070082<p class="firstline">Deletes a logs-based metric.</p>
83<p class="toc_element">
Thomas Coffee2f245372017-03-27 10:39:26 -070084 <code><a href="#get">get(metricName, x__xgafv=None)</a></code></p>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070085<p class="firstline">Gets a logs-based metric.</p>
86<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070087 <code><a href="#list">list(parent, pageToken=None, pageSize=None, x__xgafv=None)</a></code></p>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070088<p class="firstline">Lists logs-based metrics.</p>
89<p class="toc_element">
90 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
91<p class="firstline">Retrieves the next page of results.</p>
92<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070093 <code><a href="#update">update(metricName, body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070094<p class="firstline">Creates or updates a logs-based metric.</p>
95<h3>Method Details</h3>
96<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -070097 <code class="details" id="create">create(parent, body=None, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -070098 <pre>Creates a logs-based metric.
99
100Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700101 parent: string, Required. The resource name of the project in which to create the metric:
Bu Sun Kim65020912020-05-20 12:08:20 -0700102&quot;projects/[PROJECT_ID]&quot;
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700103The new metric must be provided in the request. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700104 body: object, The request body.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700105 The object takes the form of:
106
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700107{ # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700108 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700109 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700110 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700111 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700112 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700113 },
114 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
115 &quot;bounds&quot;: [ # The values must be monotonically increasing.
116 3.14,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700117 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700118 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700119 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
120 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
121 &quot;scale&quot;: 3.14, # Must be greater than 0.
122 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
123 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700124 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700125 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700126 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
127 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
128 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
129 # Maximum of default 500 metric descriptors per service is allowed.
130 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
131 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
132 &quot;A String&quot;,
133 ],
134 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
135 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
136 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
137 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
138 },
139 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
140 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
141 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
142 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
143 # &quot;external.googleapis.com/prometheus/up&quot;
144 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700145 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700146 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700147 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700148 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
149 # bit bit
150 # By byte
151 # s second
152 # min minute
153 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700154 # d day
155 # 1 dimensionlessPrefixes (PREFIX)
Bu Sun Kim65020912020-05-20 12:08:20 -0700156 # k kilo (10^3)
157 # M mega (10^6)
158 # G giga (10^9)
159 # T tera (10^12)
160 # P peta (10^15)
161 # E exa (10^18)
162 # Z zetta (10^21)
163 # Y yotta (10^24)
164 # m milli (10^-3)
165 # u micro (10^-6)
166 # n nano (10^-9)
167 # p pico (10^-12)
168 # f femto (10^-15)
169 # a atto (10^-18)
170 # z zepto (10^-21)
171 # y yocto (10^-24)
172 # Ki kibi (2^10)
173 # Mi mebi (2^20)
174 # Gi gibi (2^30)
175 # Ti tebi (2^40)
176 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
177 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
178 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
179 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
180 #
181 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
182 # | Annotation
183 # | &quot;1&quot;
184 # ;
185 #
186 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
187 # Notes:
188 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
189 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
190 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
191 # % 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 value 3 means &quot;3 percent&quot;).
192 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700193 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
194 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
195 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
196 # Only upper and lower-case letters, digits and underscores (_) are allowed.
197 # Label name must start with a letter or digit.
198 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700199 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700200 &quot;key&quot;: &quot;A String&quot;, # The label key.
201 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700202 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700203 },
204 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700205 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
206 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700207 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
208 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
209 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700210 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
211 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
212 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700213 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
214 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
215 &quot;a_key&quot;: &quot;A String&quot;,
216 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700217}
218
219 x__xgafv: string, V1 error format.
220 Allowed values
221 1 - v1 error format
222 2 - v2 error format
223
224Returns:
225 An object of the form:
226
227 { # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700228 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700229 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700230 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700231 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700232 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700233 },
234 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
235 &quot;bounds&quot;: [ # The values must be monotonically increasing.
236 3.14,
237 ],
238 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700239 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
240 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
241 &quot;scale&quot;: 3.14, # Must be greater than 0.
242 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
243 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700244 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700245 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700246 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
247 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
248 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
249 # Maximum of default 500 metric descriptors per service is allowed.
250 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
251 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
252 &quot;A String&quot;,
253 ],
254 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
255 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
256 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
257 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
258 },
259 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
260 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
261 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
262 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
263 # &quot;external.googleapis.com/prometheus/up&quot;
264 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700265 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700266 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700267 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700268 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700269 # bit bit
270 # By byte
271 # s second
272 # min minute
273 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700274 # d day
275 # 1 dimensionlessPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700276 # k kilo (10^3)
277 # M mega (10^6)
278 # G giga (10^9)
279 # T tera (10^12)
280 # P peta (10^15)
281 # E exa (10^18)
282 # Z zetta (10^21)
283 # Y yotta (10^24)
284 # m milli (10^-3)
285 # u micro (10^-6)
286 # n nano (10^-9)
287 # p pico (10^-12)
288 # f femto (10^-15)
289 # a atto (10^-18)
290 # z zepto (10^-21)
291 # y yocto (10^-24)
292 # Ki kibi (2^10)
293 # Mi mebi (2^20)
294 # Gi gibi (2^30)
295 # Ti tebi (2^40)
296 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
297 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
298 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
Bu Sun Kim65020912020-05-20 12:08:20 -0700299 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700300 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700301 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700302 # | Annotation
Bu Sun Kim65020912020-05-20 12:08:20 -0700303 # | &quot;1&quot;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700304 # ;
305 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700306 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700307 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700308 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
309 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
Bu Sun Kim65020912020-05-20 12:08:20 -0700310 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
311 # % 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 value 3 means &quot;3 percent&quot;).
312 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700313 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
314 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
315 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
316 # Only upper and lower-case letters, digits and underscores (_) are allowed.
317 # Label name must start with a letter or digit.
318 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700319 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700320 &quot;key&quot;: &quot;A String&quot;, # The label key.
321 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700322 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700323 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700324 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700325 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700326 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700327 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
328 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
329 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700330 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
331 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800332 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700333 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
334 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
335 &quot;a_key&quot;: &quot;A String&quot;,
336 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700337 }</pre>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700338</div>
339
340<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700341 <code class="details" id="delete">delete(metricName, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700342 <pre>Deletes a logs-based metric.
343
344Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700345 metricName: string, Required. The resource name of the metric to delete:
Bu Sun Kim65020912020-05-20 12:08:20 -0700346&quot;projects/[PROJECT_ID]/metrics/[METRIC_ID]&quot;
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800347 (required)
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700348 x__xgafv: string, V1 error format.
349 Allowed values
350 1 - v1 error format
351 2 - v2 error format
352
353Returns:
354 An object of the form:
355
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800356 { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
357 # service Foo {
358 # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
359 # }
360 # The JSON representation for Empty is empty JSON object {}.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700361 }</pre>
362</div>
363
364<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700365 <code class="details" id="get">get(metricName, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700366 <pre>Gets a logs-based metric.
367
368Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700369 metricName: string, Required. The resource name of the desired metric:
Bu Sun Kim65020912020-05-20 12:08:20 -0700370&quot;projects/[PROJECT_ID]/metrics/[METRIC_ID]&quot;
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800371 (required)
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700372 x__xgafv: string, V1 error format.
373 Allowed values
374 1 - v1 error format
375 2 - v2 error format
376
377Returns:
378 An object of the form:
379
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700380 { # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700381 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700382 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700383 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700384 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700385 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700386 },
387 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
388 &quot;bounds&quot;: [ # The values must be monotonically increasing.
389 3.14,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700390 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700391 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700392 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
393 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
394 &quot;scale&quot;: 3.14, # Must be greater than 0.
395 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
396 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700397 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700398 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700399 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
400 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
401 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
402 # Maximum of default 500 metric descriptors per service is allowed.
403 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
404 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
405 &quot;A String&quot;,
406 ],
407 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
408 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
409 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
410 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
411 },
412 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
413 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
414 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
415 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
416 # &quot;external.googleapis.com/prometheus/up&quot;
417 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700418 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700419 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700420 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700421 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700422 # bit bit
423 # By byte
424 # s second
425 # min minute
426 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700427 # d day
428 # 1 dimensionlessPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700429 # k kilo (10^3)
430 # M mega (10^6)
431 # G giga (10^9)
432 # T tera (10^12)
433 # P peta (10^15)
434 # E exa (10^18)
435 # Z zetta (10^21)
436 # Y yotta (10^24)
437 # m milli (10^-3)
438 # u micro (10^-6)
439 # n nano (10^-9)
440 # p pico (10^-12)
441 # f femto (10^-15)
442 # a atto (10^-18)
443 # z zepto (10^-21)
444 # y yocto (10^-24)
445 # Ki kibi (2^10)
446 # Mi mebi (2^20)
447 # Gi gibi (2^30)
448 # Ti tebi (2^40)
449 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
450 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
451 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
Bu Sun Kim65020912020-05-20 12:08:20 -0700452 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700453 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700454 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700455 # | Annotation
Bu Sun Kim65020912020-05-20 12:08:20 -0700456 # | &quot;1&quot;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700457 # ;
458 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700459 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700461 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
462 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
Bu Sun Kim65020912020-05-20 12:08:20 -0700463 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
464 # % 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 value 3 means &quot;3 percent&quot;).
465 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700466 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
467 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
468 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
469 # Only upper and lower-case letters, digits and underscores (_) are allowed.
470 # Label name must start with a letter or digit.
471 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700472 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700473 &quot;key&quot;: &quot;A String&quot;, # The label key.
474 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700475 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700476 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700477 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700478 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700479 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700480 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
481 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
482 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700483 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
484 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800485 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700486 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
487 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
488 &quot;a_key&quot;: &quot;A String&quot;,
489 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700490 }</pre>
491</div>
492
493<div class="method">
494 <code class="details" id="list">list(parent, pageToken=None, pageSize=None, x__xgafv=None)</code>
495 <pre>Lists logs-based metrics.
496
497Args:
498 parent: string, Required. The name of the project containing the metrics:
499&quot;projects/[PROJECT_ID]&quot;
500 (required)
501 pageToken: string, Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.
502 pageSize: integer, Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.
503 x__xgafv: string, V1 error format.
504 Allowed values
505 1 - v1 error format
506 2 - v2 error format
507
508Returns:
509 An object of the form:
510
511 { # Result returned from ListLogMetrics.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700512 &quot;nextPageToken&quot;: &quot;A String&quot;, # If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.
Bu Sun Kim65020912020-05-20 12:08:20 -0700513 &quot;metrics&quot;: [ # A list of logs-based metrics.
514 { # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700515 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700516 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700517 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700518 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700519 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700520 },
521 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
522 &quot;bounds&quot;: [ # The values must be monotonically increasing.
523 3.14,
524 ],
525 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700526 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
527 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
528 &quot;scale&quot;: 3.14, # Must be greater than 0.
529 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
530 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700531 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700532 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700533 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
534 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
535 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
536 # Maximum of default 500 metric descriptors per service is allowed.
537 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
538 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
539 &quot;A String&quot;,
540 ],
541 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
542 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
543 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
544 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
545 },
546 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
547 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
548 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
549 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
550 # &quot;external.googleapis.com/prometheus/up&quot;
551 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700552 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700553 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700554 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700555 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
556 # bit bit
557 # By byte
558 # s second
559 # min minute
560 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700561 # d day
562 # 1 dimensionlessPrefixes (PREFIX)
Bu Sun Kim65020912020-05-20 12:08:20 -0700563 # k kilo (10^3)
564 # M mega (10^6)
565 # G giga (10^9)
566 # T tera (10^12)
567 # P peta (10^15)
568 # E exa (10^18)
569 # Z zetta (10^21)
570 # Y yotta (10^24)
571 # m milli (10^-3)
572 # u micro (10^-6)
573 # n nano (10^-9)
574 # p pico (10^-12)
575 # f femto (10^-15)
576 # a atto (10^-18)
577 # z zepto (10^-21)
578 # y yocto (10^-24)
579 # Ki kibi (2^10)
580 # Mi mebi (2^20)
581 # Gi gibi (2^30)
582 # Ti tebi (2^40)
583 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
584 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
585 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
586 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
587 #
588 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
589 # | Annotation
590 # | &quot;1&quot;
591 # ;
592 #
593 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
594 # Notes:
595 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
596 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
597 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
598 # % 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 value 3 means &quot;3 percent&quot;).
599 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700600 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
601 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
602 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
603 # Only upper and lower-case letters, digits and underscores (_) are allowed.
604 # Label name must start with a letter or digit.
605 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700606 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700607 &quot;key&quot;: &quot;A String&quot;, # The label key.
608 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700609 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700610 },
611 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700612 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
613 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700614 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
615 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
616 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700617 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
618 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
619 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700620 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
621 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
622 &quot;a_key&quot;: &quot;A String&quot;,
623 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700624 },
625 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700626 }</pre>
627</div>
628
629<div class="method">
630 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
631 <pre>Retrieves the next page of results.
632
633Args:
634 previous_request: The request for the previous page. (required)
635 previous_response: The response from the request for the previous page. (required)
636
637Returns:
638 A request object that you can call &#x27;execute()&#x27; on to request the next
639 page. Returns None if there are no more items in the collection.
640 </pre>
641</div>
642
643<div class="method">
644 <code class="details" id="update">update(metricName, body=None, x__xgafv=None)</code>
645 <pre>Creates or updates a logs-based metric.
646
647Args:
648 metricName: string, Required. The resource name of the metric to update:
649&quot;projects/[PROJECT_ID]/metrics/[METRIC_ID]&quot;
650The updated metric must be provided in the request and it&#x27;s name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. (required)
651 body: object, The request body.
652 The object takes the form of:
653
654{ # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700655 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700656 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700657 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700658 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700659 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700660 },
661 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
662 &quot;bounds&quot;: [ # The values must be monotonically increasing.
663 3.14,
664 ],
665 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700666 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
667 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
668 &quot;scale&quot;: 3.14, # Must be greater than 0.
669 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
670 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700671 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700672 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700673 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
674 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
675 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
676 # Maximum of default 500 metric descriptors per service is allowed.
677 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
678 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
679 &quot;A String&quot;,
680 ],
681 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
682 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
683 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
684 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
685 },
686 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
687 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
688 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
689 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
690 # &quot;external.googleapis.com/prometheus/up&quot;
691 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700692 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700693 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700694 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700695 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
696 # bit bit
697 # By byte
698 # s second
699 # min minute
700 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700701 # d day
702 # 1 dimensionlessPrefixes (PREFIX)
Bu Sun Kim65020912020-05-20 12:08:20 -0700703 # k kilo (10^3)
704 # M mega (10^6)
705 # G giga (10^9)
706 # T tera (10^12)
707 # P peta (10^15)
708 # E exa (10^18)
709 # Z zetta (10^21)
710 # Y yotta (10^24)
711 # m milli (10^-3)
712 # u micro (10^-6)
713 # n nano (10^-9)
714 # p pico (10^-12)
715 # f femto (10^-15)
716 # a atto (10^-18)
717 # z zepto (10^-21)
718 # y yocto (10^-24)
719 # Ki kibi (2^10)
720 # Mi mebi (2^20)
721 # Gi gibi (2^30)
722 # Ti tebi (2^40)
723 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
724 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
725 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
726 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
727 #
728 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
729 # | Annotation
730 # | &quot;1&quot;
731 # ;
732 #
733 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
734 # Notes:
735 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
736 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
737 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
738 # % 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 value 3 means &quot;3 percent&quot;).
739 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700740 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
741 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
742 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
743 # Only upper and lower-case letters, digits and underscores (_) are allowed.
744 # Label name must start with a letter or digit.
745 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700746 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700747 &quot;key&quot;: &quot;A String&quot;, # The label key.
748 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700749 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700750 },
751 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700752 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
753 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700754 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
755 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
756 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700757 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
758 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
759 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700760 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
761 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
762 &quot;a_key&quot;: &quot;A String&quot;,
763 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700764}
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700765
766 x__xgafv: string, V1 error format.
767 Allowed values
768 1 - v1 error format
769 2 - v2 error format
770
771Returns:
772 An object of the form:
773
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700774 { # Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
Bu Sun Kim65020912020-05-20 12:08:20 -0700775 &quot;bucketOptions&quot;: { # BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i &gt; 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. # Optional. The bucket_options are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values.
Bu Sun Kim65020912020-05-20 12:08:20 -0700776 &quot;linearBuckets&quot;: { # Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): offset + (width * i). Lower bound (1 &lt;= i &lt; N): offset + (width * (i - 1)). # The linear bucket.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700777 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700778 &quot;width&quot;: 3.14, # Must be greater than 0.
Bu Sun Kim65020912020-05-20 12:08:20 -0700779 &quot;offset&quot;: 3.14, # Lower bound of the first bucket.
Bu Sun Kim65020912020-05-20 12:08:20 -0700780 },
781 &quot;explicitBuckets&quot;: { # Specifies a set of buckets with arbitrary widths.There are size(bounds) + 1 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): boundsi Lower bound (1 &lt;= i &lt; N); boundsi - 1The bounds field must contain at least one element. If bounds has only one element, then there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. # The explicit buckets.
782 &quot;bounds&quot;: [ # The values must be monotonically increasing.
783 3.14,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700784 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700785 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700786 &quot;exponentialBuckets&quot;: { # Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has the following boundaries:Upper bound (0 &lt;= i &lt; N-1): scale * (growth_factor ^ i). Lower bound (1 &lt;= i &lt; N): scale * (growth_factor ^ (i - 1)). # The exponential buckets.
787 &quot;growthFactor&quot;: 3.14, # Must be greater than 1.
788 &quot;scale&quot;: 3.14, # Must be greater than 0.
789 &quot;numFiniteBuckets&quot;: 42, # Must be greater than 0.
790 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700791 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700792 &quot;name&quot;: &quot;A String&quot;, # Required. The client-assigned metric identifier. Examples: &quot;error_count&quot;, &quot;nginx/requests&quot;.Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*&#x27;,()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: &quot;projects/my-project/metrics/nginx%2Frequests&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700793 &quot;valueExtractor&quot;: &quot;A String&quot;, # Optional. A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction: EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1. field: The name of the log entry field from which the value is to be extracted. 2. regex: A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.The result of the extraction must be convertible to a double type, as the distribution always records double values. If either the extraction or the conversion to double fails, then those values are not recorded in the distribution.Example: REGEXP_EXTRACT(jsonPayload.request, &quot;.*quantity=(\d+).*&quot;)
794 &quot;metricDescriptor&quot;: { # 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&#x27;s existing data unusable.The following are specific rules for service defined Monitoring metric descriptors: # Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of &quot;1&quot;. Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.
795 # type, metric_kind, value_type, description, display_name, launch_stage fields are all required. The unit field must be specified if the value_type is any of DOUBLE, INT64, DISTRIBUTION.
796 # Maximum of default 500 metric descriptors per service is allowed.
797 # Maximum of default 10 labels per metric descriptor is allowed.The default maximum limit can be overridden. Please follow https://cloud.google.com/monitoring/quotas
798 &quot;monitoredResourceTypes&quot;: [ # Read-only. If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here.
799 &quot;A String&quot;,
800 ],
801 &quot;metadata&quot;: { # Additional annotations that can be used to guide the usage of a metric. # Optional. Metadata which can be used to guide usage of the metric.
802 &quot;samplePeriod&quot;: &quot;A String&quot;, # The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period.
803 &quot;launchStage&quot;: &quot;A String&quot;, # Deprecated. Must use the MetricDescriptor.launch_stage instead.
804 &quot;ingestDelay&quot;: &quot;A String&quot;, # The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors.
805 },
806 &quot;type&quot;: &quot;A String&quot;, # The metric type, including its DNS name prefix. The type is not URL-encoded.All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must follow:
807 # Only upper and lower-case letters, digits, &#x27;/&#x27; and underscores &#x27;_&#x27; are allowed.
808 # The maximum number of characters allowed for the relative_metric_name is 100.All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.Metric types should use a natural hierarchical grouping. For example:
809 # &quot;custom.googleapis.com/invoice/paid/amount&quot;
810 # &quot;external.googleapis.com/prometheus/up&quot;
811 # &quot;appengine.googleapis.com/http/server/response_latencies&quot;
Bu Sun Kim65020912020-05-20 12:08:20 -0700812 &quot;displayName&quot;: &quot;A String&quot;, # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example &quot;Request count&quot;. This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700813 &quot;launchStage&quot;: &quot;A String&quot;, # Optional. The launch stage of the metric definition.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700814 &quot;description&quot;: &quot;A String&quot;, # A detailed description of the metric, which can be used in documentation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700815 &quot;unit&quot;: &quot;A String&quot;, # 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 custom 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 (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
816 # bit bit
817 # By byte
818 # s second
819 # min minute
820 # h hour
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700821 # d day
822 # 1 dimensionlessPrefixes (PREFIX)
Bu Sun Kim65020912020-05-20 12:08:20 -0700823 # k kilo (10^3)
824 # M mega (10^6)
825 # G giga (10^9)
826 # T tera (10^12)
827 # P peta (10^15)
828 # E exa (10^18)
829 # Z zetta (10^21)
830 # Y yotta (10^24)
831 # m milli (10^-3)
832 # u micro (10^-6)
833 # n nano (10^-9)
834 # p pico (10^-12)
835 # f femto (10^-15)
836 # a atto (10^-18)
837 # z zepto (10^-21)
838 # y yocto (10^-24)
839 # Ki kibi (2^10)
840 # Mi mebi (2^20)
841 # Gi gibi (2^30)
842 # Ti tebi (2^40)
843 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
844 # / division or ratio (as an infix operator). For examples, kBy/{email} or MiBy/10ms (although you should almost never have /s in a metric unit; rates should always be computed at query time from the underlying cumulative or delta value).
845 # . multiplication or composition (as an infix operator). For examples, GBy.d or k{watt}.h.The grammar for a unit is as follows:
846 # Expression = Component { &quot;.&quot; Component } { &quot;/&quot; Component } ;
847 #
848 # Component = ( [ PREFIX ] UNIT | &quot;%&quot; ) [ Annotation ]
849 # | Annotation
850 # | &quot;1&quot;
851 # ;
852 #
853 # Annotation = &quot;{&quot; NAME &quot;}&quot; ;
854 # Notes:
855 # Annotation is just a comment if it follows a UNIT. If the annotation is used alone, then the unit is equivalent to 1. For examples, {request}/s == 1/s, By{transmitted}/s == By/s.
856 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
857 # 1 represents a unitary dimensionless unit (https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such as in 1/s. It is typically used when none of the basic units are appropriate. For example, &quot;new users per day&quot; can be represented as 1/d or {new-users}/d (and a metric value 5 would mean &quot;5 new users). Alternatively, &quot;thousands of page views per day&quot; would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean &quot;5300 page views per day&quot;).
858 # % 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 value 3 means &quot;3 percent&quot;).
859 # 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 value 0.03 means &quot;3 percent&quot;).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700860 &quot;metricKind&quot;: &quot;A String&quot;, # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
861 &quot;valueType&quot;: &quot;A String&quot;, # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
862 &quot;labels&quot;: [ # The set of labels that can be used to describe a specific instance of this metric type.The label key name must follow:
863 # Only upper and lower-case letters, digits and underscores (_) are allowed.
864 # Label name must start with a letter or digit.
865 # The maximum length of a label name is 100 characters.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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700866 { # A description of a label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700867 &quot;key&quot;: &quot;A String&quot;, # The label key.
868 &quot;description&quot;: &quot;A String&quot;, # A human-readable description for the label.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700869 &quot;valueType&quot;: &quot;A String&quot;, # The type of data that can be assigned to the label.
Bu Sun Kim65020912020-05-20 12:08:20 -0700870 },
871 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700872 &quot;name&quot;: &quot;A String&quot;, # The resource name of the metric descriptor.
873 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700874 &quot;description&quot;: &quot;A String&quot;, # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
875 &quot;createTime&quot;: &quot;A String&quot;, # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
876 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Bu Sun Kim65020912020-05-20 12:08:20 -0700877 &quot;filter&quot;: &quot;A String&quot;, # Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced_filters) which is used to match log entries. Example:
878 # &quot;resource.type=gae_app AND severity&gt;=ERROR&quot;
879 # The maximum length of the filter is 20000 characters.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700880 &quot;version&quot;: &quot;A String&quot;, # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
881 &quot;labelExtractors&quot;: { # Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field.The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false.Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.
882 &quot;a_key&quot;: &quot;A String&quot;,
883 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700884 }</pre>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700885</div>
886
887</body></html>