You need to enable JavaScript to run this app.
导航

用量统计

最近更新时间2023.03.31 14:08:54

首次发布时间2023.03.03 11:27:58

阅读本文,您可以快速了解用量统计 PHP SDK 的使用方法。

说明

以下 SDK 示例中仅展示了部分参数,您可以在 veImageX 的接口文档中查看该接口支持的全部参数及取值。

初始化

调用接口前请先完成初始化,具体操作请参考初始化

获取资源用量概览

本接口通过指定服务数据范围以及服务 ID,来获取用户的本月资源用量概览,包括带宽、流量、存储、请求次数、基础图像处理。

具体接口参数和返回字段请参考 DescribeImageXSummary。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [
    'Timestamp' => "2023-02-08T00:00:00+08:00",
    'ServiceIds' => 'service1,service2',
];

$response = $client->describeImageXSummary($query);
print_r($response);

查询流量用量

本接口支持通过自定义时间段,来获取加速域名网络流量用量。

具体接口参数和返回字段请参考 DescribeImageXDomainTrafficData。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$body = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'Interval' => "300",
];

$response = $client->describeImageXDomainTrafficData($body);
print_r($response);

查询带宽用量

本接口支持通过自定义时间段,来获取加速域名网络带宽用量。

具体接口参数和返回字段请参考 DescribeImageXDomainBandwidthData。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$body = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'Interval' => "300",
];

$response = $client->describeImageXDomainBandwidthData($body);
print_r($response);

获取基础处理量

本接口支持通过自定义时间段,获取当下时间维度的图像基础处理量。

具体接口参数和返回字段请参考 DescribeImageXBaseOpUsage。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");


$query = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'Interval' => "300",
];

$response = $client->describeImageXBaseOpUsage($query);
print_r($response);

获取资源占用量

本接口支持通过自定义查询时间段,获取该时间段的资源占用量。

具体接口参数和返回字段请参考 DescribeImageXBucketUsage。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'Interval' => "300",
];

$response = $client->describeImageXBucketUsage($query);
print_r($response);

获取请求次数

本接口支持通过自定义查询时间段,获取该时间段的请求次数。

具体接口参数和返回字段请参考 DescribeImageXRequestCntUsage。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$body = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'GroupBy' => "ServiceId",
    'Interval' => "300",
];

$response = $client->describeImageXRequestCntUsage($body);
print_r($response);

获取高效压缩量

本接口支持通过自定义查询时间段,获取该时间段内的图像高效压缩量。

具体接口参数和返回字段请参考 DescribeImageXCompressUsage。我们同时在 GitHub 上提供了参考示例

具体示例如下所示:

<?php
include_once(__DIR__ . '/../../../vendor/autoload.php');

use Volc\Service\ImageX;

$client = ImageX::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [
    'StartTime' => "2023-01-21T00:00:00+08:00",
    'EndTime' => "2023-01-28T00:00:00+08:00",
    'Interval' => "300",
];

$response = $client->describeImageXCompressUsage($query);
print_r($response);