Baidu AI Cloud
中国站

百度智能云

CDN

Statistical Interface (new version)

New version statistic interface adopts unified entrance query, and the queries of different data items are distinguished through parameters.

Parameter description:

Parameter Optional Type Description Effective range
metric Required String Specify the statistical dimension of the query, such as pv, pv_region and flow. -
end_time Optional String End value of the time range queried, the default is the current time. The time span is 90 days at most ALL
start_time Optional String Start time of the time range queried, the default is 24 hours ahead of the endTime. ALL
period Optional Long Granularity of the query, in seconds, you can select 60, 300, 3,600 and 86,400, and the default is 300. uv is 3,600 by default. ALL
key_type Optional Long Identify the key content, 0=> domain name, 1=>username id, 2=>tag, 0 by default ALL
key Optional list Domain name or user Id or Tag ALL
groupBy Optional String Return the aggregate granular of the result, key=> aggregate according to key, null=> return the overall result ALL
level Optional String All nodes (all), edge (edge) or internal (internal), defaults to all pv、flow
prov Optional String Full spell of the province queried, and it is empty by default. Query national data. region related
isp Optional String ISP code to be queried, it is empty by default. Query all operator data. region related
protocol Optional String Query http or https traffic and bandwidth. The value is {‘http’, ‘https’, ‘all’}, and the default is ‘all’. flow_protocol
extra Optional Long Query the record of the specified http status code, the default value:"" top n related

Comments:

Effective range means that some parameters are effective for all metrics, and some parameters are effective for some metrics. See the test case for details.

Average Speed

Query average rate

public function testGetDomainStatsAvgSpeed() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'avg_speed', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query the average rate of access distribution by client

public function testGetDomainStatsAvgSpeedRegion() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'prov' => 'beijing', 
        'isp' => 'ct', 
        'metric' => 'avg_speed_region', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query pv/qps

public function testGetDomainStatsPv() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'level' => 'edge', 
        'metric' => 'pv', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query pv/qps of access distribution by client

public function testGetDomainStatsPvRegion() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'prov' => 'beijing', 
        'isp' => 'ct', 
        'metric' => 'pv_region', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query origin pv/qps

public function testGetDomainStatsPvSrc() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'pv_src', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query UV

public function testGetDomainStatsUv() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 3600, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'uv', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query traffic and bandwidth

public function testGetDomainStatsFlow() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'level' => 'edge', 
        'metric' => 'flow', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query traffic and bandwidth by protocol

public function testGetDomainStatsFlowProtocol() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'protocol' => 'https', 
        'metric' => 'flow_protocol', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query the traffic bandwidth of the Internet service provider in different provinces

public function testGetDomainStatsFLowRegion() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'prov' => 'beijing', 
        'isp' => 'ct', 
        'metric' => 'flow_region', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query origin traffic and bandwidth

public function testGetDomainStatsFlowSrc() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'src_flow', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query byte hit rate

public function testGetDomainStatsHit() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'real_hit', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query request hit rate

public function testGetDomainStatsHitPv() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'pv_hit', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Statistical query of status code

public function testGetDomainStatsHttpCode() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'httpcode', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query origin status codes

public function testGetDomainStatsHttpCodeSrc() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'src_httpcode', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query the states code of operators by province

public function testGetDomainStatsHttpCodeRegion() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'prov' => 'beijing', 
        'isp' => 'ct', 
        'metric' => 'httpcode_region', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Top NQuery

Top Urls

public function testGetDomainStatsTopUrls() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'extra' => 200, 
        'metric' => 'top_urls', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Top Referers

public function testGetDomainStatsTopReferers() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'extra' => 200, 
        'metric' => 'top_referers', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Top Domains

public function testGetDomainStatsTopDomains() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'groupBy' => '', 
        'extra' => 200, 
        'metric' => 'top_domains', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
} 

Query reasons of status code error

public function testGetDomainStatsError() { 
    $statParam = array( 
        'startTime' => '2019-05-26T00:00:00Z', 
        'endTime' => '2019-05-27T00:00:00Z', 
        'period' => 300, 
        'key_type' => 0, 
        'key' => array('test-sdk.sys-qa.com'), 
        'groupBy' => '', 
        'metric' => 'error', 
    ); 

    $resp = $this->client->getDomainStats($statParam); 
    $this->assertNotNull($resp); 
}
Previous
Dynamic Acceleration Interface
Next
Statistical Interface (old version)