Google\Cloud\Logging\V2\MetricsServiceV2Client::updateLogMetric PHP Méthode

updateLogMetric() public méthode

Sample code: try { $metricsServiceV2Client = new MetricsServiceV2Client(); $formattedMetricName = MetricsServiceV2Client::formatMetricName("[PROJECT]", "[METRIC]"); $metric = new LogMetric(); $response = $metricsServiceV2Client->updateLogMetric($formattedMetricName, $metric); } finally { if (isset($metricsServiceV2Client)) { $metricsServiceV2Client->close(); } }
public updateLogMetric ( string $metricName, google\logging\v2\LogMetric $metric, array $optionalArgs = [] ) : google\logging\v2\LogMetric
$metricName string The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created.
$metric google\logging\v2\LogMetric The updated metric.
$optionalArgs array { Optional. @type \Google\GAX\RetrySettings $retrySettings Retry settings to use for this call. If present, then $timeoutMillis is ignored. @type int $timeoutMillis Timeout to use for this call. Only used if $retrySettings is not set. }
Résultat google\logging\v2\LogMetric
    public function updateLogMetric($metricName, $metric, $optionalArgs = [])
    {
        $request = new UpdateLogMetricRequest();
        $request->setMetricName($metricName);
        $request->setMetric($metric);
        $mergedSettings = $this->defaultCallSettings['updateLogMetric']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->metricsServiceV2Stub, 'UpdateLogMetric', $mergedSettings, $this->descriptors['updateLogMetric']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }