1<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 75<h1><a href="logging_v2.html">Stackdriver Logging API</a> . <a href="logging_v2.projects.html">projects</a> . <a href="logging_v2.projects.metrics.html">metrics</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#create">create(parent, body, x__xgafv=None)</a></code></p> 79<p class="firstline">Creates a logs-based metric.</p> 80<p class="toc_element"> 81 <code><a href="#delete">delete(metricName, x__xgafv=None)</a></code></p> 82<p class="firstline">Deletes a logs-based metric.</p> 83<p class="toc_element"> 84 <code><a href="#get">get(metricName, x__xgafv=None)</a></code></p> 85<p class="firstline">Gets a logs-based metric.</p> 86<p class="toc_element"> 87 <code><a href="#list">list(parent, pageToken=None, x__xgafv=None, pageSize=None)</a></code></p> 88<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"> 93 <code><a href="#update">update(metricName, body, x__xgafv=None)</a></code></p> 94<p class="firstline">Creates or updates a logs-based metric.</p> 95<h3>Method Details</h3> 96<div class="method"> 97 <code class="details" id="create">create(parent, body, x__xgafv=None)</code> 98 <pre>Creates a logs-based metric. 99 100Args: 101 parent: string, The resource name of the project in which to create the metric: 102"projects/[PROJECT_ID]" 103The new metric must be provided in the request. (required) 104 body: object, The request body. (required) 105 The object takes the form of: 106 107{ # 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. 109 "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". 110 "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. 111 "description": "A String", # A detailed description of the metric, which can be used in documentation. 112 "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. 113 "name": "A String", # The resource name of the metric descriptor. 114 "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. 115 "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. 116 "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. 117 { # A description of a label. 118 "valueType": "A String", # The type of data that can be assigned to the label. 119 "description": "A String", # A human-readable description for the label. 120 "key": "A String", # The label key. 121 }, 122 ], 123 "launchStage": "A String", # Optional. The launch stage of the metric definition. 124 "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: 125 # "custom.googleapis.com/invoice/paid/amount" 126 # "external.googleapis.com/prometheus/up" 127 # "appengine.googleapis.com/http/server/response_latencies" 128 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 129 # bit bit 130 # By byte 131 # s second 132 # min minute 133 # h hour 134 # d dayPrefixes (PREFIX) 135 # k kilo (10**3) 136 # M mega (10**6) 137 # G giga (10**9) 138 # T tera (10**12) 139 # P peta (10**15) 140 # E exa (10**18) 141 # Z zetta (10**21) 142 # Y yotta (10**24) 143 # m milli (10**-3) 144 # u micro (10**-6) 145 # n nano (10**-9) 146 # p pico (10**-12) 147 # f femto (10**-15) 148 # a atto (10**-18) 149 # z zepto (10**-21) 150 # y yocto (10**-24) 151 # Ki kibi (2**10) 152 # Mi mebi (2**20) 153 # Gi gibi (2**30) 154 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 155 # / division (as an infix operator, e.g. 1/s). 156 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 157 # Expression = Component { "." Component } { "/" Component } ; 158 # 159 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 160 # | Annotation 161 # | "1" 162 # ; 163 # 164 # Annotation = "{" NAME "}" ; 165 # Notes: 166 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 167 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 168 # 1 represents dimensionless value 1, such as in 1/s. 169 # % represents dimensionless value 1/100, and annotates values giving a percentage. 170 "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. 171 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 172 "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. 173 "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. 174 }, 175 }, 176 "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 > 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. 177 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 178 "scale": 3.14, # Must be greater than 0. 179 "growthFactor": 3.14, # Must be greater than 1. 180 "numFiniteBuckets": 42, # Must be greater than 0. 181 }, 182 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 183 "width": 3.14, # Must be greater than 0. 184 "numFiniteBuckets": 42, # Must be greater than 0. 185 "offset": 3.14, # Lower bound of the first bucket. 186 }, 187 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 188 "bounds": [ # The values must be monotonically increasing. 189 3.14, 190 ], 191 }, 192 }, 193 "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. 194 "a_key": "A String", 195 }, 196 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 197 # "resource.type=gae_app AND severity>=ERROR" 198 # The maximum length of the filter is 20000 characters. 199 "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+).*") 200 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 201 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 202 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 203 } 204 205 x__xgafv: string, V1 error format. 206 Allowed values 207 1 - v1 error format 208 2 - v2 error format 209 210Returns: 211 An object of the form: 212 213 { # 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. 214 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics. 215 "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". 216 "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. 217 "description": "A String", # A detailed description of the metric, which can be used in documentation. 218 "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. 219 "name": "A String", # The resource name of the metric descriptor. 220 "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. 221 "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. 222 "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. 223 { # A description of a label. 224 "valueType": "A String", # The type of data that can be assigned to the label. 225 "description": "A String", # A human-readable description for the label. 226 "key": "A String", # The label key. 227 }, 228 ], 229 "launchStage": "A String", # Optional. The launch stage of the metric definition. 230 "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: 231 # "custom.googleapis.com/invoice/paid/amount" 232 # "external.googleapis.com/prometheus/up" 233 # "appengine.googleapis.com/http/server/response_latencies" 234 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 235 # bit bit 236 # By byte 237 # s second 238 # min minute 239 # h hour 240 # d dayPrefixes (PREFIX) 241 # k kilo (10**3) 242 # M mega (10**6) 243 # G giga (10**9) 244 # T tera (10**12) 245 # P peta (10**15) 246 # E exa (10**18) 247 # Z zetta (10**21) 248 # Y yotta (10**24) 249 # m milli (10**-3) 250 # u micro (10**-6) 251 # n nano (10**-9) 252 # p pico (10**-12) 253 # f femto (10**-15) 254 # a atto (10**-18) 255 # z zepto (10**-21) 256 # y yocto (10**-24) 257 # Ki kibi (2**10) 258 # Mi mebi (2**20) 259 # Gi gibi (2**30) 260 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 261 # / division (as an infix operator, e.g. 1/s). 262 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 263 # Expression = Component { "." Component } { "/" Component } ; 264 # 265 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 266 # | Annotation 267 # | "1" 268 # ; 269 # 270 # Annotation = "{" NAME "}" ; 271 # Notes: 272 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 273 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 274 # 1 represents dimensionless value 1, such as in 1/s. 275 # % represents dimensionless value 1/100, and annotates values giving a percentage. 276 "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. 277 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 278 "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. 279 "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. 280 }, 281 }, 282 "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 > 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. 283 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 284 "scale": 3.14, # Must be greater than 0. 285 "growthFactor": 3.14, # Must be greater than 1. 286 "numFiniteBuckets": 42, # Must be greater than 0. 287 }, 288 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 289 "width": 3.14, # Must be greater than 0. 290 "numFiniteBuckets": 42, # Must be greater than 0. 291 "offset": 3.14, # Lower bound of the first bucket. 292 }, 293 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 294 "bounds": [ # The values must be monotonically increasing. 295 3.14, 296 ], 297 }, 298 }, 299 "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. 300 "a_key": "A String", 301 }, 302 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 303 # "resource.type=gae_app AND severity>=ERROR" 304 # The maximum length of the filter is 20000 characters. 305 "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+).*") 306 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 307 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 308 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 309 }</pre> 310</div> 311 312<div class="method"> 313 <code class="details" id="delete">delete(metricName, x__xgafv=None)</code> 314 <pre>Deletes a logs-based metric. 315 316Args: 317 metricName: string, The resource name of the metric to delete: 318"projects/[PROJECT_ID]/metrics/[METRIC_ID]" 319 (required) 320 x__xgafv: string, V1 error format. 321 Allowed values 322 1 - v1 error format 323 2 - v2 error format 324 325Returns: 326 An object of the form: 327 328 { # 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: 329 # service Foo { 330 # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 331 # } 332 # The JSON representation for Empty is empty JSON object {}. 333 }</pre> 334</div> 335 336<div class="method"> 337 <code class="details" id="get">get(metricName, x__xgafv=None)</code> 338 <pre>Gets a logs-based metric. 339 340Args: 341 metricName: string, The resource name of the desired metric: 342"projects/[PROJECT_ID]/metrics/[METRIC_ID]" 343 (required) 344 x__xgafv: string, V1 error format. 345 Allowed values 346 1 - v1 error format 347 2 - v2 error format 348 349Returns: 350 An object of the form: 351 352 { # 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. 353 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics. 354 "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". 355 "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. 356 "description": "A String", # A detailed description of the metric, which can be used in documentation. 357 "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. 358 "name": "A String", # The resource name of the metric descriptor. 359 "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. 360 "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. 361 "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. 362 { # A description of a label. 363 "valueType": "A String", # The type of data that can be assigned to the label. 364 "description": "A String", # A human-readable description for the label. 365 "key": "A String", # The label key. 366 }, 367 ], 368 "launchStage": "A String", # Optional. The launch stage of the metric definition. 369 "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: 370 # "custom.googleapis.com/invoice/paid/amount" 371 # "external.googleapis.com/prometheus/up" 372 # "appengine.googleapis.com/http/server/response_latencies" 373 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 374 # bit bit 375 # By byte 376 # s second 377 # min minute 378 # h hour 379 # d dayPrefixes (PREFIX) 380 # k kilo (10**3) 381 # M mega (10**6) 382 # G giga (10**9) 383 # T tera (10**12) 384 # P peta (10**15) 385 # E exa (10**18) 386 # Z zetta (10**21) 387 # Y yotta (10**24) 388 # m milli (10**-3) 389 # u micro (10**-6) 390 # n nano (10**-9) 391 # p pico (10**-12) 392 # f femto (10**-15) 393 # a atto (10**-18) 394 # z zepto (10**-21) 395 # y yocto (10**-24) 396 # Ki kibi (2**10) 397 # Mi mebi (2**20) 398 # Gi gibi (2**30) 399 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 400 # / division (as an infix operator, e.g. 1/s). 401 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 402 # Expression = Component { "." Component } { "/" Component } ; 403 # 404 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 405 # | Annotation 406 # | "1" 407 # ; 408 # 409 # Annotation = "{" NAME "}" ; 410 # Notes: 411 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 412 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 413 # 1 represents dimensionless value 1, such as in 1/s. 414 # % represents dimensionless value 1/100, and annotates values giving a percentage. 415 "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. 416 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 417 "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. 418 "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. 419 }, 420 }, 421 "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 > 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. 422 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 423 "scale": 3.14, # Must be greater than 0. 424 "growthFactor": 3.14, # Must be greater than 1. 425 "numFiniteBuckets": 42, # Must be greater than 0. 426 }, 427 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 428 "width": 3.14, # Must be greater than 0. 429 "numFiniteBuckets": 42, # Must be greater than 0. 430 "offset": 3.14, # Lower bound of the first bucket. 431 }, 432 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 433 "bounds": [ # The values must be monotonically increasing. 434 3.14, 435 ], 436 }, 437 }, 438 "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. 439 "a_key": "A String", 440 }, 441 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 442 # "resource.type=gae_app AND severity>=ERROR" 443 # The maximum length of the filter is 20000 characters. 444 "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+).*") 445 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 446 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 447 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 448 }</pre> 449</div> 450 451<div class="method"> 452 <code class="details" id="list">list(parent, pageToken=None, x__xgafv=None, pageSize=None)</code> 453 <pre>Lists logs-based metrics. 454 455Args: 456 parent: string, Required. The name of the project containing the metrics: 457"projects/[PROJECT_ID]" 458 (required) 459 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. 460 x__xgafv: string, V1 error format. 461 Allowed values 462 1 - v1 error format 463 2 - v2 error format 464 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. 465 466Returns: 467 An object of the form: 468 469 { # Result returned from ListLogMetrics. 470 "metrics": [ # A list of logs-based metrics. 471 { # 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. 472 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics. 473 "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". 474 "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. 475 "description": "A String", # A detailed description of the metric, which can be used in documentation. 476 "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. 477 "name": "A String", # The resource name of the metric descriptor. 478 "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. 479 "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. 480 "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. 481 { # A description of a label. 482 "valueType": "A String", # The type of data that can be assigned to the label. 483 "description": "A String", # A human-readable description for the label. 484 "key": "A String", # The label key. 485 }, 486 ], 487 "launchStage": "A String", # Optional. The launch stage of the metric definition. 488 "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: 489 # "custom.googleapis.com/invoice/paid/amount" 490 # "external.googleapis.com/prometheus/up" 491 # "appengine.googleapis.com/http/server/response_latencies" 492 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 493 # bit bit 494 # By byte 495 # s second 496 # min minute 497 # h hour 498 # d dayPrefixes (PREFIX) 499 # k kilo (10**3) 500 # M mega (10**6) 501 # G giga (10**9) 502 # T tera (10**12) 503 # P peta (10**15) 504 # E exa (10**18) 505 # Z zetta (10**21) 506 # Y yotta (10**24) 507 # m milli (10**-3) 508 # u micro (10**-6) 509 # n nano (10**-9) 510 # p pico (10**-12) 511 # f femto (10**-15) 512 # a atto (10**-18) 513 # z zepto (10**-21) 514 # y yocto (10**-24) 515 # Ki kibi (2**10) 516 # Mi mebi (2**20) 517 # Gi gibi (2**30) 518 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 519 # / division (as an infix operator, e.g. 1/s). 520 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 521 # Expression = Component { "." Component } { "/" Component } ; 522 # 523 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 524 # | Annotation 525 # | "1" 526 # ; 527 # 528 # Annotation = "{" NAME "}" ; 529 # Notes: 530 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 531 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 532 # 1 represents dimensionless value 1, such as in 1/s. 533 # % represents dimensionless value 1/100, and annotates values giving a percentage. 534 "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. 535 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 536 "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. 537 "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. 538 }, 539 }, 540 "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 > 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. 541 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 542 "scale": 3.14, # Must be greater than 0. 543 "growthFactor": 3.14, # Must be greater than 1. 544 "numFiniteBuckets": 42, # Must be greater than 0. 545 }, 546 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 547 "width": 3.14, # Must be greater than 0. 548 "numFiniteBuckets": 42, # Must be greater than 0. 549 "offset": 3.14, # Lower bound of the first bucket. 550 }, 551 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 552 "bounds": [ # The values must be monotonically increasing. 553 3.14, 554 ], 555 }, 556 }, 557 "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. 558 "a_key": "A String", 559 }, 560 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 561 # "resource.type=gae_app AND severity>=ERROR" 562 # The maximum length of the filter is 20000 characters. 563 "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+).*") 564 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 565 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 566 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 567 }, 568 ], 569 "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. 570 }</pre> 571</div> 572 573<div class="method"> 574 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 575 <pre>Retrieves the next page of results. 576 577Args: 578 previous_request: The request for the previous page. (required) 579 previous_response: The response from the request for the previous page. (required) 580 581Returns: 582 A request object that you can call 'execute()' on to request the next 583 page. Returns None if there are no more items in the collection. 584 </pre> 585</div> 586 587<div class="method"> 588 <code class="details" id="update">update(metricName, body, x__xgafv=None)</code> 589 <pre>Creates or updates a logs-based metric. 590 591Args: 592 metricName: string, The resource name of the metric to update: 593"projects/[PROJECT_ID]/metrics/[METRIC_ID]" 594The 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) 595 body: object, The request body. (required) 596 The object takes the form of: 597 598{ # 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. 599 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics. 600 "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". 601 "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. 602 "description": "A String", # A detailed description of the metric, which can be used in documentation. 603 "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. 604 "name": "A String", # The resource name of the metric descriptor. 605 "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. 606 "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. 607 "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. 608 { # A description of a label. 609 "valueType": "A String", # The type of data that can be assigned to the label. 610 "description": "A String", # A human-readable description for the label. 611 "key": "A String", # The label key. 612 }, 613 ], 614 "launchStage": "A String", # Optional. The launch stage of the metric definition. 615 "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: 616 # "custom.googleapis.com/invoice/paid/amount" 617 # "external.googleapis.com/prometheus/up" 618 # "appengine.googleapis.com/http/server/response_latencies" 619 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 620 # bit bit 621 # By byte 622 # s second 623 # min minute 624 # h hour 625 # d dayPrefixes (PREFIX) 626 # k kilo (10**3) 627 # M mega (10**6) 628 # G giga (10**9) 629 # T tera (10**12) 630 # P peta (10**15) 631 # E exa (10**18) 632 # Z zetta (10**21) 633 # Y yotta (10**24) 634 # m milli (10**-3) 635 # u micro (10**-6) 636 # n nano (10**-9) 637 # p pico (10**-12) 638 # f femto (10**-15) 639 # a atto (10**-18) 640 # z zepto (10**-21) 641 # y yocto (10**-24) 642 # Ki kibi (2**10) 643 # Mi mebi (2**20) 644 # Gi gibi (2**30) 645 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 646 # / division (as an infix operator, e.g. 1/s). 647 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 648 # Expression = Component { "." Component } { "/" Component } ; 649 # 650 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 651 # | Annotation 652 # | "1" 653 # ; 654 # 655 # Annotation = "{" NAME "}" ; 656 # Notes: 657 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 658 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 659 # 1 represents dimensionless value 1, such as in 1/s. 660 # % represents dimensionless value 1/100, and annotates values giving a percentage. 661 "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. 662 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 663 "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. 664 "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. 665 }, 666 }, 667 "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 > 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. 668 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 669 "scale": 3.14, # Must be greater than 0. 670 "growthFactor": 3.14, # Must be greater than 1. 671 "numFiniteBuckets": 42, # Must be greater than 0. 672 }, 673 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 674 "width": 3.14, # Must be greater than 0. 675 "numFiniteBuckets": 42, # Must be greater than 0. 676 "offset": 3.14, # Lower bound of the first bucket. 677 }, 678 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 679 "bounds": [ # The values must be monotonically increasing. 680 3.14, 681 ], 682 }, 683 }, 684 "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. 685 "a_key": "A String", 686 }, 687 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 688 # "resource.type=gae_app AND severity>=ERROR" 689 # The maximum length of the filter is 20000 characters. 690 "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+).*") 691 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 692 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 693 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 694 } 695 696 x__xgafv: string, V1 error format. 697 Allowed values 698 1 - v1 error format 699 2 - v2 error format 700 701Returns: 702 An object of the form: 703 704 { # 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. 705 "updateTime": "A String", # Output only. The last update timestamp of the metric.This field may not be present for older metrics. 706 "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". 707 "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. 708 "description": "A String", # A detailed description of the metric, which can be used in documentation. 709 "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. 710 "name": "A String", # The resource name of the metric descriptor. 711 "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. 712 "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. 713 "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. 714 { # A description of a label. 715 "valueType": "A String", # The type of data that can be assigned to the label. 716 "description": "A String", # A human-readable description for the label. 717 "key": "A String", # The label key. 718 }, 719 ], 720 "launchStage": "A String", # Optional. The launch stage of the metric definition. 721 "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: 722 # "custom.googleapis.com/invoice/paid/amount" 723 # "external.googleapis.com/prometheus/up" 724 # "appengine.googleapis.com/http/server/response_latencies" 725 "unit": "A String", # The unit in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT) 726 # bit bit 727 # By byte 728 # s second 729 # min minute 730 # h hour 731 # d dayPrefixes (PREFIX) 732 # k kilo (10**3) 733 # M mega (10**6) 734 # G giga (10**9) 735 # T tera (10**12) 736 # P peta (10**15) 737 # E exa (10**18) 738 # Z zetta (10**21) 739 # Y yotta (10**24) 740 # m milli (10**-3) 741 # u micro (10**-6) 742 # n nano (10**-9) 743 # p pico (10**-12) 744 # f femto (10**-15) 745 # a atto (10**-18) 746 # z zepto (10**-21) 747 # y yocto (10**-24) 748 # Ki kibi (2**10) 749 # Mi mebi (2**20) 750 # Gi gibi (2**30) 751 # Ti tebi (2**40)GrammarThe grammar also includes these connectors: 752 # / division (as an infix operator, e.g. 1/s). 753 # . multiplication (as an infix operator, e.g. GBy.d)The grammar for a unit is as follows: 754 # Expression = Component { "." Component } { "/" Component } ; 755 # 756 # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] 757 # | Annotation 758 # | "1" 759 # ; 760 # 761 # Annotation = "{" NAME "}" ; 762 # Notes: 763 # Annotation is just a comment if it follows a UNIT and is equivalent to 1 if it is used alone. For examples, {requests}/s == 1/s, By{transmitted}/s == By/s. 764 # NAME is a sequence of non-blank printable ASCII characters not containing '{' or '}'. 765 # 1 represents dimensionless value 1, such as in 1/s. 766 # % represents dimensionless value 1/100, and annotates values giving a percentage. 767 "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. 768 "launchStage": "A String", # Deprecated. Please use the MetricDescriptor.launch_stage instead. The launch stage of the metric definition. 769 "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. 770 "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. 771 }, 772 }, 773 "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 > 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. 774 "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 <= i < N-1): scale * (growth_factor ^ i). Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). # The exponential buckets. 775 "scale": 3.14, # Must be greater than 0. 776 "growthFactor": 3.14, # Must be greater than 1. 777 "numFiniteBuckets": 42, # Must be greater than 0. 778 }, 779 "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 <= i < N-1): offset + (width * i). Lower bound (1 <= i < N): offset + (width * (i - 1)). # The linear bucket. 780 "width": 3.14, # Must be greater than 0. 781 "numFiniteBuckets": 42, # Must be greater than 0. 782 "offset": 3.14, # Lower bound of the first bucket. 783 }, 784 "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 <= i < N-1): boundsi Lower bound (1 <= i < 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. 785 "bounds": [ # The values must be monotonically increasing. 786 3.14, 787 ], 788 }, 789 }, 790 "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. 791 "a_key": "A String", 792 }, 793 "filter": "A String", # Required. An advanced logs filter which is used to match log entries. Example: 794 # "resource.type=gae_app AND severity>=ERROR" 795 # The maximum length of the filter is 20000 characters. 796 "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+).*") 797 "version": "A String", # Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. 798 "createTime": "A String", # Output only. The creation timestamp of the metric.This field may not be present for older metrics. 799 "description": "A String", # Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. 800 }</pre> 801</div> 802 803</body></html>