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 viareload().
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [3.12.1 (latest)](/python/docs/reference/logging/latest/metric)\n- [3.12.0](/python/docs/reference/logging/3.12.0/metric)\n- [3.11.3](/python/docs/reference/logging/3.11.3/metric)\n- [3.10.0](/python/docs/reference/logging/3.10.0/metric)\n- [3.9.0](/python/docs/reference/logging/3.9.0/metric)\n- [3.8.0](/python/docs/reference/logging/3.8.0/metric)\n- [3.7.0](/python/docs/reference/logging/3.7.0/metric)\n- [3.6.0](/python/docs/reference/logging/3.6.0/metric)\n- [3.5.0](/python/docs/reference/logging/3.5.0/metric)\n- [3.4.0](/python/docs/reference/logging/3.4.0/metric)\n- [3.3.1](/python/docs/reference/logging/3.3.1/metric)\n- [3.2.5](/python/docs/reference/logging/3.2.5/metric)\n- [3.1.2](/python/docs/reference/logging/3.1.2/metric)\n- [3.0.0](/python/docs/reference/logging/3.0.0/metric)\n- [2.7.2](/python/docs/reference/logging/2.7.2/metric)\n- [2.6.0](/python/docs/reference/logging/2.6.0/metric)\n- [2.5.0](/python/docs/reference/logging/2.5.0/metric)\n- [2.4.0](/python/docs/reference/logging/2.4.0/metric)\n- [2.3.1](/python/docs/reference/logging/2.3.1/metric)\n- [2.2.0](/python/docs/reference/logging/2.2.0/metric)\n- [2.1.1](/python/docs/reference/logging/2.1.1/metric)\n- [2.0.2](/python/docs/reference/logging/2.0.2/metric)\n- [1.15.3](/python/docs/reference/logging/1.15.3/metric)\n- [1.14.0](/python/docs/reference/logging/1.14.0/metric)\n- [1.13.0](/python/docs/reference/logging/1.13.0/metric)\n- [1.12.1](/python/docs/reference/logging/1.12.1/metric) \n\nMetrics\n=======\n\nDefine Cloud Logging API Metrics.\n\n### *class* google.cloud.logging_v2.metric.Metric(name, \\*, filter_=None, client=None, description='')\n\nBases: [`object`](https://docs.python.org/3/library/functions.html#object)\n\nMetrics represent named filters for log entries.\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics\u003e\n\n- **Parameters**\n\n - **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The name of the metric.\n\n - **filter** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- the advanced logs filter expression defining the entries\n tracked by the metric. If not passed, the instance should\n already exist, to be refreshed via `reload()`.\n\n - **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]*) -- A client which holds\n credentials and project configuration for the sink (which requires a project).\n\n - **description** (*Optional* *\\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\\]*) -- An optional description of the metric.\n\n#### *property* client()\n\nClent bound to the logger.\n\n#### create(\\*, client=None)\n\nCreate the metric via a PUT request\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create\u003e\n\n- **Parameters**\n\n **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]* ) -- The client to use. If not passed, falls back to the\n `client` stored on the current sink.\n\n#### delete(\\*, client=None)\n\nAPI call: delete a metric via a DELETE request\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete\u003e\n\n- **Parameters**\n\n **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]* ) -- The client to use. If not passed, falls back to the\n `client` stored on the current sink.\n\n#### exists(\\*, client=None)\n\nTest for the existence of the metric via a GET request\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get\u003e\n\n- **Parameters**\n\n **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]* ) -- The client to use. If not passed, falls back to the\n `client` stored on the current sink.\n- **Returns**\n\n Boolean indicating existence of the metric.\n- **Return type**\n\n [bool](https://docs.python.org/3/library/functions.html#bool)\n\n#### *classmethod* from_api_repr(resource, client)\n\nConstruct a metric given its API representation\n\n- **Parameters**\n\n - **resource** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)) -- metric resource representation returned from the API\n\n - **client** ([*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)) -- Client which holds\n credentials and project configuration for the sink.\n\n- **Returns**\n\n google.cloud.logging_v2.metric.Metric\n\n#### *property* full_name()\n\nFully-qualified name used in metric APIs\n\n#### *property* path()\n\nURL path for the metric's APIs\n\n#### *property* project()\n\nProject bound to the logger.\n\n#### reload(\\*, client=None)\n\nAPI call: sync local metric configuration via a GET request\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get\u003e\n\n- **Parameters**\n\n **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]* ) -- The client to use. If not passed, falls back to the\n `client` stored on the current sink.\n\n#### update(\\*, client=None)\n\nAPI call: update metric configuration via a PUT request\n\nSee\n\u003chttps://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update\u003e\n\n- **Parameters**\n\n **client** (*Optional* *\\[* [*Client*](/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\\]* ) -- The client to use. If not passed, falls back to the\n `client` stored on the current sink."]]