Class Metric (1.14.0)

  Metric 
 ( 
 name 
 , 
 filter_ 
 = 
 None 
 , 
 client 
 = 
 None 
 , 
 description 
 = 
 "" 
 ) 
 

Metrics represent named filters for log entries.

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

Parameters

Name
Description
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
Client

A client which holds credentials and project configuration for the metric (which requires a project).

description
str

an optional description of the 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
Name
Description
client
Client or NoneType

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

delete

  delete 
 ( 
 client 
 = 
 None 
 ) 
 
Parameter
Name
Description
client
Client or NoneType

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

exists

  exists 
 ( 
 client 
 = 
 None 
 ) 
 

API call: 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
Name
Description
client
Client or NoneType

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

Returns
Type
Description
bool
Boolean indicating existence of the metric.

from_api_repr

  from_api_repr 
 ( 
 resource 
 , 
 client 
 ) 
 

Factory: construct a metric given its API representation

Parameters
Name
Description
resource
dict

metric resource representation returned from the API

client
Client

Client which holds credentials and project configuration for the metric.

Returns
Type
Description
Metric parsed from resource .

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
Name
Description
client
Client or NoneType

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

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
Name
Description
client
Client or NoneType

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

Create a Mobile Website
View Site in Mobile | Classic
Share by: