| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Google Monitoring API filters support <,<=,>,>= operators as described in its documentation: https://cloud.google.com/monitoring/api/v3/filters. Current version of the library only has mappings of: 1. ’{key}_prefix:{value}' -> '{key} = starts_with("{value}")' 2. ’{key}_suffix:{value}' -> '{key} = ends_with("{value}")' This patch introduces additional mappings of: 3. ’{key}_greater:{value}' -> '{key} > {value}' 4. ’{key}_greaterequal:{value}' -> '{key} >= {value}' 5. ’{key}_less:{value}' -> '{key} < {value}' 6. ’{key}_lessequal:{value}' -> '{key} <= {value}' So that it is possible, for example, to filter based on the response_code values range, as shown below: metric.type = "appengine.googleapis.com/http/server/response_count" AND metric.label.response_code < 600 AND metric.label.response_code >= 500 This patch will allow to remove “hack” in the following tool: https://github.com/odin-public/gcpmetrics that enables queries to the monitoring api from the command line.
Fixed `tox -e cover` to have 100% coverage after proposed patch
|
I would suggest inserting something like the following in the docstring for select_metrics at Line 315, immediately after the explanation of _prefix and _suffix. I don't think we need to say anything in the docstring for select_resources, because all of the currently defined monitored resource labels are strings. If the label's value type is ``INT64``, a similar notation can be
used to express inequalities:
``<label>_less=<value>`` generates::
metric.label.<label> < <value>
``<label>_lessequal=<value>`` generates::
metric.label.<label> <= <value>
``<label>_greater=<value>`` generates::
metric.label.<label> > <value>
``<label>_greaterequal=<value>`` generates::
metric.label.<label> >= <value>
|
Sorry, something went wrong.
| if key.endswith('_prefix') or key.endswith('_suffix'): | ||
| ends = ['_prefix', '_suffix', '_greater', '_greaterequal', | ||
| '_less', '_lessequal'] | ||
| if key.endswith(tuple(ends)): |
|
I made just a couple of comments. Thank you for the contribution! |
Sorry, something went wrong.
1. Added docstring for select_metrics with the explanation of additional endings. No reason to do the same for select_resources, because all of the currently defined monitored resource labels are strings. 2. Removed array->tuple conversion, moved constant directly into the if condition.
oops i did it again: messed docstring indentation while copy/pasting… :-)
|
Hi Ken, updated PR now has improvements you've suggested. |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
PR googleapis/google-cloud-python#2234 was merged and functionality available since release 0.19.0
| Back | FazBrowse Home | New Git URL |
Google Monitoring API filters support <,<=,>,>= operators as described
in its documentation:
https://cloud.google.com/monitoring/api/v3/filters.
Current version of the library only has mappings of:
This patch introduces additional mappings of:
So that it is possible, for example, to filter based on the
response_code values range, as shown below:
metric.type = "appengine.googleapis.com/http/server/response_count"
AND metric.label.response_code < 600
AND metric.label.response_code >= 500
This patch will allow to remove “hack” in the following tool:
https://github.com/odin-public/gcpmetrics that enables
queries to the monitoring api from the command line.