Reference documentation and code samples for the Stackdriver Logging Client class Metric.
A metric counts the number of log entries that match a given filter. You can use these metrics to create charts and alerting policies in Stackdriver Monitoring.
Example:
use Google\Cloud\Logging\LoggingClient; $logging = new LoggingClient(); $metric = $logging->metric('my-metric'); Namespace
Google \ Cloud \ LoggingMethods
__construct
| Parameters | |
|---|---|
| Name | Description | 
| connection | Google\Cloud\Logging\Connection\ConnectionInterfaceRepresents a connection to Cloud Logging. This object is created by LoggingClient, and should not be instantiated outside of this client. | 
| name | stringThe metric's name. | 
| projectId | stringThe project's ID. | 
| info | array[optional] The metric's metadata. | 
exists
Check whether or not the metric exists.
Example:
if ($metric->exists()) { echo 'Metric exists!'; } | Parameter | |
|---|---|
| Name | Description | 
| options | array[optional] Configuration Options | 
| Returns | |
|---|---|
| Type | Description | 
| bool | |
delete
| Parameter | |
|---|---|
| Name | Description | 
| options | array[optional] Configuration Options. | 
update
| Parameters | |
|---|---|
| Name | Description | 
| metadata | arrayThe data to update. | 
| ↳ description | stringA description of the metric. | 
| ↳ filter | string | 
| options | array[optional] Configuration Options. | 
| Returns | |
|---|---|
| Type | Description | 
| array | |
info
See also:
| Parameter | |
|---|---|
| Name | Description | 
| options | array[optional] Configuration Options. | 
| Returns | |
|---|---|
| Type | Description | 
| array | |
reload
See also:
| Parameter | |
|---|---|
| Name | Description | 
| options | array[optional] Configuration Options. | 
| Returns | |
|---|---|
| Type | Description | 
| array | |
name
Returns the metric's name.
Example:
echo $metric->name(); | Returns | |
|---|---|
| Type | Description | 
| string | |