Class Metric

Metrics represent named filters for log entries.

See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics

Inheritance

builtins.object > Metric

Properties

client

Clent bound to the logger.

full_name

Fully-qualified name used in metric APIs

path

URL path for the metric's APIs

project

Project bound to the logger.

Methods

create

create(*, client=None)
Parameter
NameDescription
client Optional[`logging_v2.client.Client`]

The client to use. If not passed, falls back to the client stored on the current sink.

delete

delete(*, client=None)
Parameter
NameDescription
client Optional[`logging_v2.client.Client`]

The client to use. If not passed, falls back to the client stored on the current sink.

exists

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

Parameter
NameDescription
client Optional[`logging_v2.client.Client`]

The client to use. If not passed, falls back to the client stored on the current sink.

Returns
TypeDescription
boolBoolean indicating existence of the metric.

from_api_repr

from_api_repr(resource, client)

Construct a metric given its API representation

Parameters
NameDescription
resource dict

metric resource representation returned from the API

client `logging_v2.client.Client`

Client which holds credentials and project configuration for the sink.

reload

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

Parameter
NameDescription
client Optional[`logging_v2.client.Client`]

The client to use. If not passed, falls back to the client stored on the current sink.

update

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

Parameter
NameDescription
client Optional[`logging_v2.client.Client`]

The client to use. If not passed, falls back to the client stored on the current sink.