google / cloud-monitoring
PHP的Stackdriver Monitoring客户端
v1.11.0
2024-06-21 16:37 UTC
Requires
- php: ^8.0
- google/gax: ^1.34.0
Requires (Dev)
- google/cloud-core: ^1.52.7
- phpunit/phpunit: ^9.0
Suggests
- ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.
- dev-main
- v1.11.0
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.0
- v0.18.0
- v0.17.0
- v0.16.5
- v0.16.4
- v0.16.3
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.0
- v0.14.2
- v0.14.1
- v0.14.0
- v0.13.0
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.1
- v0.10.0
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.3
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.0
- dev-policy-bot-ba514906-b998-40f5-add3-8bf7ac20aec3
- dev-policy-bot-7f5628cc-a5f9-4ccb-905d-5fa6adb9c952
This package is auto-updated.
Last update: 2024-09-21 17:14:14 UTC
README
注意: 此存储库是Google Cloud PHP的一部分。任何支持请求、错误报告或开发贡献都应直接发送到该项目。
Stackdriver Monitoring可以提供云应用程序性能、正常运行时间和整体健康情况的可见性。
安装
首先,安装PHP首选的依赖关系管理器 Composer。
现在安装此组件
$ composer require google/cloud-monitoring
此组件支持HTTP/1.1上方的REST和gRPC。为了利用gRPC提供的优势(如流方法),请参阅我们的gRPC安装指南。
身份验证
请参阅我们的身份验证指南以获取有关客户端身份验证的更多信息。身份验证后,您就可以开始发送请求了。
示例
use Google\Api\Metric; use Google\Api\MonitoredResource; use Google\Cloud\Monitoring\V3\MetricServiceClient; use Google\Cloud\Monitoring\V3\Point; use Google\Cloud\Monitoring\V3\TimeInterval; use Google\Cloud\Monitoring\V3\TimeSeries; use Google\Cloud\Monitoring\V3\TypedValue; use Google\Protobuf\Timestamp; $metricServiceClient = new MetricServiceClient(); $formattedProjectName = $metricServiceClient->projectName($projectId); $labels = [ 'instance_id' => $instanceId, 'zone' => $zone, ]; $m = new Metric(); $m->setType('custom.googleapis.com/my_metric'); $r = new MonitoredResource(); $r->setType('gce_instance'); $r->setLabels($labels); $value = new TypedValue(); $value->setDoubleValue(3.14); $timestamp = new Timestamp(); $timestamp->setSeconds(time()); $interval = new TimeInterval(); $interval->setStartTime($timestamp); $interval->setEndTime($timestamp); $point = new Point(); $point->setValue($value); $point->setInterval($interval); $points = [$point]; $timeSeries = new TimeSeries(); $timeSeries->setMetric($m); $timeSeries->setResource($r); $timeSeries->setPoints($points); try { $metricServiceClient->createTimeSeries($formattedProjectName, [$timeSeries]); print('Successfully submitted a time series' . PHP_EOL); } finally { $metricServiceClient->close(); }
版本
此组件被认为是GA(一般可用)。因此,它不会在任何次要或补丁版本中引入与向后不兼容的改变。我们将优先处理问题和请求。