Skip to content

Commit

Permalink
[~] explain more aboutvalue_extractor
Browse files Browse the repository at this point in the history
Summary of changes:
* Added clarification that value_extractor is required for distribution logs-based metrics
* Provided examples for EXTRACT(field) and REGEXP_EXTRACT(field, regex)
* Clarified the arguments for value_extractor - "field" and "regex"
* Mentioned the requirement of correct regular expression for the "regex" argument
Highlighted the requirement of `bucket_options` and `value_extractor` for DISTRIBUTION value type logs-based metrics
  • Loading branch information
Sahya committed Apr 17, 2023
1 parent 4a1460e commit 2f4dab6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions website/docs/r/logging_metric.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,21 @@ The following arguments are supported:

* `value_extractor` -
(Optional)
A valueExtractor 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.
A valueExtractor 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): e.g. `value_extractor = "EXTRACT(payload.status)"`
* REGEXP_EXTRACT(field, regex): e.g. `value_extractor = "REGEXP_EXTRACT(payload.metadata.responce_time,\"([0-9.]+)\")"`

It takes two arguments:
* "field" - The name of the log entry field from which the value is to be extracted. It called as "capture group".
* "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. If it does not contain a correct regular expression, it will result in an error in the capture group.

* `bucket_options` -
(Optional)
The bucketOptions 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.
The bucketOptions 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.
Structure is [documented below](#nested_bucket_options).

* `project` - (Optional) The ID of the project in which the resource belongs.
Expand Down

0 comments on commit 2f4dab6

Please sign in to comment.