blob: 6df110d2394eccb1bfc3d687cfc4d39e8cf81468 [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">
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040087 <code><a href="#list">list(parent, pageToken=None, x__xgafv=None, pageSize=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:
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800102"projects/[PROJECT_ID]"
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.
108 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700109 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700110 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
111 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
112 "description": "A String", # A detailed description of the metric, which can be used in documentation.
113 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
114 "name": "A String", # The resource name of the metric descriptor.
115 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
116 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
117 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
118 { # A description of a label.
119 "valueType": "A String", # The type of data that can be assigned to the label.
120 "description": "A String", # A human-readable description for the label.
121 "key": "A String", # The label key.
122 },
123 ],
124 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700125 "unit": "A String", # 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 -0700126 # bit bit
127 # By byte
128 # s second
129 # min minute
130 # h hour
131 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700132 # k kilo (10^3)
133 # M mega (10^6)
134 # G giga (10^9)
135 # T tera (10^12)
136 # P peta (10^15)
137 # E exa (10^18)
138 # Z zetta (10^21)
139 # Y yotta (10^24)
140 # m milli (10^-3)
141 # u micro (10^-6)
142 # n nano (10^-9)
143 # p pico (10^-12)
144 # f femto (10^-15)
145 # a atto (10^-18)
146 # z zepto (10^-21)
147 # y yocto (10^-24)
148 # Ki kibi (2^10)
149 # Mi mebi (2^20)
150 # Gi gibi (2^30)
151 # Ti tebi (2^40)
152 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
153 # / 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).
154 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700155 # Expression = Component { "." Component } { "/" Component } ;
156 #
157 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
158 # | Annotation
159 # | "1"
160 # ;
161 #
162 # Annotation = "{" NAME "}" ;
163 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700164 # 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.
165 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
166 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
167 # % 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 "3 percent").
168 # 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 "3 percent").
169 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
170 # "custom.googleapis.com/invoice/paid/amount"
171 # "external.googleapis.com/prometheus/up"
172 # "appengine.googleapis.com/http/server/response_latencies"
173 "monitoredResourceTypes": [ # 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.
174 "A String",
175 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700176 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700177 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700178 "ingestDelay": "A String", # 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.
179 "samplePeriod": "A String", # 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.
180 },
181 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700182 "bucketOptions": { # 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.
183 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700184 "scale": 3.14, # Must be greater than 0.
185 "growthFactor": 3.14, # Must be greater than 1.
186 "numFiniteBuckets": 42, # Must be greater than 0.
187 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700188 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700189 "width": 3.14, # Must be greater than 0.
190 "numFiniteBuckets": 42, # Must be greater than 0.
191 "offset": 3.14, # Lower bound of the first bucket.
192 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700193 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700194 "bounds": [ # The values must be monotonically increasing.
195 3.14,
196 ],
197 },
198 },
199 "labelExtractors": { # 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.
200 "a_key": "A String",
201 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800202 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700203 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800204 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700205 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
206 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
207 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700208 }
209
210 x__xgafv: string, V1 error format.
211 Allowed values
212 1 - v1 error format
213 2 - v2 error format
214
215Returns:
216 An object of the form:
217
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700218 { # 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.
219 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700220 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700221 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
222 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
223 "description": "A String", # A detailed description of the metric, which can be used in documentation.
224 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
225 "name": "A String", # The resource name of the metric descriptor.
226 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
227 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
228 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
229 { # A description of a label.
230 "valueType": "A String", # The type of data that can be assigned to the label.
231 "description": "A String", # A human-readable description for the label.
232 "key": "A String", # The label key.
233 },
234 ],
235 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700236 "unit": "A String", # 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 -0700237 # bit bit
238 # By byte
239 # s second
240 # min minute
241 # h hour
242 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700243 # k kilo (10^3)
244 # M mega (10^6)
245 # G giga (10^9)
246 # T tera (10^12)
247 # P peta (10^15)
248 # E exa (10^18)
249 # Z zetta (10^21)
250 # Y yotta (10^24)
251 # m milli (10^-3)
252 # u micro (10^-6)
253 # n nano (10^-9)
254 # p pico (10^-12)
255 # f femto (10^-15)
256 # a atto (10^-18)
257 # z zepto (10^-21)
258 # y yocto (10^-24)
259 # Ki kibi (2^10)
260 # Mi mebi (2^20)
261 # Gi gibi (2^30)
262 # Ti tebi (2^40)
263 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
264 # / 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).
265 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700266 # Expression = Component { "." Component } { "/" Component } ;
267 #
268 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
269 # | Annotation
270 # | "1"
271 # ;
272 #
273 # Annotation = "{" NAME "}" ;
274 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700275 # 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.
276 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
277 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
278 # % 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 "3 percent").
279 # 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 "3 percent").
280 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
281 # "custom.googleapis.com/invoice/paid/amount"
282 # "external.googleapis.com/prometheus/up"
283 # "appengine.googleapis.com/http/server/response_latencies"
284 "monitoredResourceTypes": [ # 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.
285 "A String",
286 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700287 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700288 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700289 "ingestDelay": "A String", # 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.
290 "samplePeriod": "A String", # 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.
291 },
292 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700293 "bucketOptions": { # 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.
294 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700295 "scale": 3.14, # Must be greater than 0.
296 "growthFactor": 3.14, # Must be greater than 1.
297 "numFiniteBuckets": 42, # Must be greater than 0.
298 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700299 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700300 "width": 3.14, # Must be greater than 0.
301 "numFiniteBuckets": 42, # Must be greater than 0.
302 "offset": 3.14, # Lower bound of the first bucket.
303 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700304 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700305 "bounds": [ # The values must be monotonically increasing.
306 3.14,
307 ],
308 },
309 },
310 "labelExtractors": { # 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.
311 "a_key": "A String",
312 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800313 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700314 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800315 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700316 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
317 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
318 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700319 }</pre>
320</div>
321
322<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700323 <code class="details" id="delete">delete(metricName, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700324 <pre>Deletes a logs-based metric.
325
326Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700327 metricName: string, Required. The resource name of the metric to delete:
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800328"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
329 (required)
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700330 x__xgafv: string, V1 error format.
331 Allowed values
332 1 - v1 error format
333 2 - v2 error format
334
335Returns:
336 An object of the form:
337
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800338 { # 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:
339 # service Foo {
340 # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
341 # }
342 # The JSON representation for Empty is empty JSON object {}.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700343 }</pre>
344</div>
345
346<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700347 <code class="details" id="get">get(metricName, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700348 <pre>Gets a logs-based metric.
349
350Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700351 metricName: string, Required. The resource name of the desired metric:
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800352"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
353 (required)
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700354 x__xgafv: string, V1 error format.
355 Allowed values
356 1 - v1 error format
357 2 - v2 error format
358
359Returns:
360 An object of the form:
361
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700362 { # 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.
363 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700364 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700365 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
366 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
367 "description": "A String", # A detailed description of the metric, which can be used in documentation.
368 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
369 "name": "A String", # The resource name of the metric descriptor.
370 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
371 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
372 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
373 { # A description of a label.
374 "valueType": "A String", # The type of data that can be assigned to the label.
375 "description": "A String", # A human-readable description for the label.
376 "key": "A String", # The label key.
377 },
378 ],
379 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700380 "unit": "A String", # 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 -0700381 # bit bit
382 # By byte
383 # s second
384 # min minute
385 # h hour
386 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700387 # k kilo (10^3)
388 # M mega (10^6)
389 # G giga (10^9)
390 # T tera (10^12)
391 # P peta (10^15)
392 # E exa (10^18)
393 # Z zetta (10^21)
394 # Y yotta (10^24)
395 # m milli (10^-3)
396 # u micro (10^-6)
397 # n nano (10^-9)
398 # p pico (10^-12)
399 # f femto (10^-15)
400 # a atto (10^-18)
401 # z zepto (10^-21)
402 # y yocto (10^-24)
403 # Ki kibi (2^10)
404 # Mi mebi (2^20)
405 # Gi gibi (2^30)
406 # Ti tebi (2^40)
407 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
408 # / 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).
409 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700410 # Expression = Component { "." Component } { "/" Component } ;
411 #
412 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
413 # | Annotation
414 # | "1"
415 # ;
416 #
417 # Annotation = "{" NAME "}" ;
418 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700419 # 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.
420 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
421 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
422 # % 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 "3 percent").
423 # 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 "3 percent").
424 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
425 # "custom.googleapis.com/invoice/paid/amount"
426 # "external.googleapis.com/prometheus/up"
427 # "appengine.googleapis.com/http/server/response_latencies"
428 "monitoredResourceTypes": [ # 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.
429 "A String",
430 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700431 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700432 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700433 "ingestDelay": "A String", # 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.
434 "samplePeriod": "A String", # 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.
435 },
436 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700437 "bucketOptions": { # 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.
438 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700439 "scale": 3.14, # Must be greater than 0.
440 "growthFactor": 3.14, # Must be greater than 1.
441 "numFiniteBuckets": 42, # Must be greater than 0.
442 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700443 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700444 "width": 3.14, # Must be greater than 0.
445 "numFiniteBuckets": 42, # Must be greater than 0.
446 "offset": 3.14, # Lower bound of the first bucket.
447 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700448 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700449 "bounds": [ # The values must be monotonically increasing.
450 3.14,
451 ],
452 },
453 },
454 "labelExtractors": { # 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.
455 "a_key": "A String",
456 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800457 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700458 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800459 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
461 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
462 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700463 }</pre>
464</div>
465
466<div class="method">
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400467 <code class="details" id="list">list(parent, pageToken=None, x__xgafv=None, pageSize=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700468 <pre>Lists logs-based metrics.
469
470Args:
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800471 parent: string, Required. The name of the project containing the metrics:
472"projects/[PROJECT_ID]"
473 (required)
474 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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700475 x__xgafv: string, V1 error format.
476 Allowed values
477 1 - v1 error format
478 2 - v2 error format
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400479 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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700480
481Returns:
482 An object of the form:
483
484 { # Result returned from ListLogMetrics.
485 "metrics": [ # A list of logs-based metrics.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700486 { # 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.
487 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700488 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700489 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
490 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
491 "description": "A String", # A detailed description of the metric, which can be used in documentation.
492 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
493 "name": "A String", # The resource name of the metric descriptor.
494 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
495 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
496 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
497 { # A description of a label.
498 "valueType": "A String", # The type of data that can be assigned to the label.
499 "description": "A String", # A human-readable description for the label.
500 "key": "A String", # The label key.
501 },
502 ],
503 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700504 "unit": "A String", # 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 -0700505 # bit bit
506 # By byte
507 # s second
508 # min minute
509 # h hour
510 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700511 # k kilo (10^3)
512 # M mega (10^6)
513 # G giga (10^9)
514 # T tera (10^12)
515 # P peta (10^15)
516 # E exa (10^18)
517 # Z zetta (10^21)
518 # Y yotta (10^24)
519 # m milli (10^-3)
520 # u micro (10^-6)
521 # n nano (10^-9)
522 # p pico (10^-12)
523 # f femto (10^-15)
524 # a atto (10^-18)
525 # z zepto (10^-21)
526 # y yocto (10^-24)
527 # Ki kibi (2^10)
528 # Mi mebi (2^20)
529 # Gi gibi (2^30)
530 # Ti tebi (2^40)
531 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
532 # / 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).
533 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700534 # Expression = Component { "." Component } { "/" Component } ;
535 #
536 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
537 # | Annotation
538 # | "1"
539 # ;
540 #
541 # Annotation = "{" NAME "}" ;
542 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700543 # 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.
544 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
545 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
546 # % 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 "3 percent").
547 # 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 "3 percent").
548 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
549 # "custom.googleapis.com/invoice/paid/amount"
550 # "external.googleapis.com/prometheus/up"
551 # "appengine.googleapis.com/http/server/response_latencies"
552 "monitoredResourceTypes": [ # 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.
553 "A String",
554 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700555 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700556 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700557 "ingestDelay": "A String", # 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.
558 "samplePeriod": "A String", # 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.
559 },
560 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700561 "bucketOptions": { # 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.
562 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700563 "scale": 3.14, # Must be greater than 0.
564 "growthFactor": 3.14, # Must be greater than 1.
565 "numFiniteBuckets": 42, # Must be greater than 0.
566 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700567 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700568 "width": 3.14, # Must be greater than 0.
569 "numFiniteBuckets": 42, # Must be greater than 0.
570 "offset": 3.14, # Lower bound of the first bucket.
571 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700572 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700573 "bounds": [ # The values must be monotonically increasing.
574 3.14,
575 ],
576 },
577 },
578 "labelExtractors": { # 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.
579 "a_key": "A String",
580 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800581 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700582 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800583 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700584 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
585 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
586 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700587 },
588 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800589 "nextPageToken": "A String", # 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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700590 }</pre>
591</div>
592
593<div class="method">
594 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
595 <pre>Retrieves the next page of results.
596
597Args:
598 previous_request: The request for the previous page. (required)
599 previous_response: The response from the request for the previous page. (required)
600
601Returns:
602 A request object that you can call 'execute()' on to request the next
603 page. Returns None if there are no more items in the collection.
604 </pre>
605</div>
606
607<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700608 <code class="details" id="update">update(metricName, body=None, x__xgafv=None)</code>
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700609 <pre>Creates or updates a logs-based metric.
610
611Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700612 metricName: string, Required. The resource name of the metric to update:
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800613"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
614The updated metric must be provided in the request and it'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)
Dan O'Mearadd494642020-05-01 07:42:23 -0700615 body: object, The request body.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700616 The object takes the form of:
617
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700618{ # 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.
619 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700620 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700621 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
622 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
623 "description": "A String", # A detailed description of the metric, which can be used in documentation.
624 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
625 "name": "A String", # The resource name of the metric descriptor.
626 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
627 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
628 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
629 { # A description of a label.
630 "valueType": "A String", # The type of data that can be assigned to the label.
631 "description": "A String", # A human-readable description for the label.
632 "key": "A String", # The label key.
633 },
634 ],
635 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700636 "unit": "A String", # 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 -0700637 # bit bit
638 # By byte
639 # s second
640 # min minute
641 # h hour
642 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700643 # k kilo (10^3)
644 # M mega (10^6)
645 # G giga (10^9)
646 # T tera (10^12)
647 # P peta (10^15)
648 # E exa (10^18)
649 # Z zetta (10^21)
650 # Y yotta (10^24)
651 # m milli (10^-3)
652 # u micro (10^-6)
653 # n nano (10^-9)
654 # p pico (10^-12)
655 # f femto (10^-15)
656 # a atto (10^-18)
657 # z zepto (10^-21)
658 # y yocto (10^-24)
659 # Ki kibi (2^10)
660 # Mi mebi (2^20)
661 # Gi gibi (2^30)
662 # Ti tebi (2^40)
663 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
664 # / 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).
665 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700666 # Expression = Component { "." Component } { "/" Component } ;
667 #
668 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
669 # | Annotation
670 # | "1"
671 # ;
672 #
673 # Annotation = "{" NAME "}" ;
674 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700675 # 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.
676 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
677 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
678 # % 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 "3 percent").
679 # 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 "3 percent").
680 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
681 # "custom.googleapis.com/invoice/paid/amount"
682 # "external.googleapis.com/prometheus/up"
683 # "appengine.googleapis.com/http/server/response_latencies"
684 "monitoredResourceTypes": [ # 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.
685 "A String",
686 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700687 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700688 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700689 "ingestDelay": "A String", # 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.
690 "samplePeriod": "A String", # 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.
691 },
692 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700693 "bucketOptions": { # 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.
694 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700695 "scale": 3.14, # Must be greater than 0.
696 "growthFactor": 3.14, # Must be greater than 1.
697 "numFiniteBuckets": 42, # Must be greater than 0.
698 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700699 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700700 "width": 3.14, # Must be greater than 0.
701 "numFiniteBuckets": 42, # Must be greater than 0.
702 "offset": 3.14, # Lower bound of the first bucket.
703 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700704 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700705 "bounds": [ # The values must be monotonically increasing.
706 3.14,
707 ],
708 },
709 },
710 "labelExtractors": { # 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.
711 "a_key": "A String",
712 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800713 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700714 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800715 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700716 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
717 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
718 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700719 }
720
721 x__xgafv: string, V1 error format.
722 Allowed values
723 1 - v1 error format
724 2 - v2 error format
725
726Returns:
727 An object of the form:
728
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700729 { # 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.
730 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics.
Dan O'Mearadd494642020-05-01 07:42:23 -0700731 "valueExtractor": "A String", # 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, ".*quantity=(\d+).*")
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700732 "name": "A String", # Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. 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: "projects/my-project/metrics/nginx%2Frequests".
733 "metricDescriptor": { # Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type's existing data unusable. # 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 "1". 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.
734 "description": "A String", # A detailed description of the metric, which can be used in documentation.
735 "displayName": "A String", # A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
736 "name": "A String", # The resource name of the metric descriptor.
737 "metricKind": "A String", # Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metric_kind and value_type might not be supported.
738 "valueType": "A String", # Whether the measurement is an integer, a floating-point number, etc. Some combinations of metric_kind and value_type might not be supported.
739 "labels": [ # The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed.
740 { # A description of a label.
741 "valueType": "A String", # The type of data that can be assigned to the label.
742 "description": "A String", # A human-readable description for the label.
743 "key": "A String", # The label key.
744 },
745 ],
746 "launchStage": "A String", # Optional. The launch stage of the metric definition.
Dan O'Mearadd494642020-05-01 07:42:23 -0700747 "unit": "A String", # 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 -0700748 # bit bit
749 # By byte
750 # s second
751 # min minute
752 # h hour
753 # d dayPrefixes (PREFIX)
Dan O'Mearadd494642020-05-01 07:42:23 -0700754 # k kilo (10^3)
755 # M mega (10^6)
756 # G giga (10^9)
757 # T tera (10^12)
758 # P peta (10^15)
759 # E exa (10^18)
760 # Z zetta (10^21)
761 # Y yotta (10^24)
762 # m milli (10^-3)
763 # u micro (10^-6)
764 # n nano (10^-9)
765 # p pico (10^-12)
766 # f femto (10^-15)
767 # a atto (10^-18)
768 # z zepto (10^-21)
769 # y yocto (10^-24)
770 # Ki kibi (2^10)
771 # Mi mebi (2^20)
772 # Gi gibi (2^30)
773 # Ti tebi (2^40)
774 # Pi pebi (2^50)GrammarThe grammar also includes these connectors:
775 # / 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).
776 # . 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 Kim715bd7f2019-06-14 16:50:42 -0700777 # Expression = Component { "." Component } { "/" Component } ;
778 #
779 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
780 # | Annotation
781 # | "1"
782 # ;
783 #
784 # Annotation = "{" NAME "}" ;
785 # Notes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700786 # 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.
787 # NAME is a sequence of non-blank printable ASCII characters not containing { or }.
788 # 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, "new users per day" can be represented as 1/d or {new-users}/d (and a metric value 5 would mean "5 new users). Alternatively, "thousands of page views per day" would be represented as 1000/d or k1/d or k{page_views}/d (and a metric value of 5.3 would mean "5300 page views per day").
789 # % 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 "3 percent").
790 # 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 "3 percent").
791 "type": "A String", # The metric type, including its DNS name prefix. The type is not URL-encoded. All user-defined metric types have the DNS name custom.googleapis.com or external.googleapis.com. Metric types should use a natural hierarchical grouping. For example:
792 # "custom.googleapis.com/invoice/paid/amount"
793 # "external.googleapis.com/prometheus/up"
794 # "appengine.googleapis.com/http/server/response_latencies"
795 "monitoredResourceTypes": [ # 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.
796 "A String",
797 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700798 "metadata": { # 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.
Dan O'Mearadd494642020-05-01 07:42:23 -0700799 "launchStage": "A String", # Deprecated. Must use the MetricDescriptor.launch_stage instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700800 "ingestDelay": "A String", # 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.
801 "samplePeriod": "A String", # 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.
802 },
803 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700804 "bucketOptions": { # 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.
805 "exponentialBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700806 "scale": 3.14, # Must be greater than 0.
807 "growthFactor": 3.14, # Must be greater than 1.
808 "numFiniteBuckets": 42, # Must be greater than 0.
809 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700810 "linearBuckets": { # 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 Kim715bd7f2019-06-14 16:50:42 -0700811 "width": 3.14, # Must be greater than 0.
812 "numFiniteBuckets": 42, # Must be greater than 0.
813 "offset": 3.14, # Lower bound of the first bucket.
814 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700815 "explicitBuckets": { # 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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700816 "bounds": [ # The values must be monotonically increasing.
817 3.14,
818 ],
819 },
820 },
821 "labelExtractors": { # 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.
822 "a_key": "A String",
823 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800824 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example:
Dan O'Mearadd494642020-05-01 07:42:23 -0700825 # "resource.type=gae_app AND severity&gt;=ERROR"
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800826 # The maximum length of the filter is 20000 characters.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700827 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.
828 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics.
829 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700830 }</pre>
831</div>
832
833</body></html>