Metrics
Define Cloud Logging API Metrics.
class google.cloud.logging_v2.metric.Metric(name, *, filter_=None, client=None, description='')
Bases: object
Metrics represent named filters for log entries.
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
-
Parameters
-
name( str ) – The name of the metric.
-
filter( str ) – the advanced logs filter expression defining the entries tracked by the metric. If not passed, the instance should already exist, to be refreshed via
reload()
. -
client( Optional [ Client ] ) – A client which holds credentials and project configuration for the sink (which requires a project).
-
description( Optional [ str ] ) – An optional description of the metric.
-
property client()
Clent bound to the logger.
create(*, client=None)
Create the metric via a PUT request
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create
-
Parameters
client( Optional [ Client ] ) – The client to use. If not passed, falls back to the
client
stored on the current sink.
delete(*, client=None)
API call: delete a metric via a DELETE request
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete
-
Parameters
client( Optional [ Client ] ) – The client to use. If not passed, falls back to the
client
stored on the current sink.
exists(*, client=None)
Test for the existence of the metric via a GET request
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get
-
Parameters
client( Optional [ Client ] ) – The client to use. If not passed, falls back to the
client
stored on the current sink. -
Returns
Boolean indicating existence of the metric.
-
Return type
classmethod from_api_repr(resource, client)
Construct a metric given its API representation
-
Parameters
-
Returns
google.cloud.logging_v2.metric.Metric
property full_name()
Fully-qualified name used in metric APIs
property path()
URL path for the metric’s APIs
property project()
Project bound to the logger.
reload(*, client=None)
API call: sync local metric configuration via a GET request
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get
-
Parameters
client( Optional [ Client ] ) – The client to use. If not passed, falls back to the
client
stored on the current sink.
update(*, client=None)
API call: update metric configuration via a PUT request
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update
-
Parameters
client( Optional [ Client ] ) – The client to use. If not passed, falls back to the
client
stored on the current sink.