Files
librenms/lib/influxdb-php-sdk/benchmarks/Benchmarks/InfluxDB/AdapterEvent.php
T
laf 0ee83437e3 Add 'lib/influxdb-php-sdk/' from commit '1928d59eb90bfcba40a957074987c5311afd4e3b'
git-subtree-dir: lib/influxdb-php-sdk
git-subtree-mainline: 15a338061d
git-subtree-split: 1928d59eb9
2015-08-09 15:52:58 +00:00

55 lines
1.2 KiB
PHP

<?php
namespace Corley\Benchmarks\InfluxDB;
use InfluxDB\Client;
use InfluxDB\Adapter\GuzzleAdapter;
use InfluxDB\Adapter\UdpAdapter;
use Athletic\AthleticEvent;
use GuzzleHttp\Client as HttpClient;
use InfluxDB\Options;
class AdapterEvent extends AthleticEvent
{
private $httpClient;
private $udpClient;
public function setUp()
{
$options = new Options();
$options->setHost("localhost");
$options->setPort(8086);
$options->setUsername("root");
$options->setPassword("root");
$options->setDatabase("tcp.test");
$client = new Client(new GuzzleAdapter(new HttpClient(), $options));
$client->createDatabase("tcp.test");
$client->createDatabase("udp.test");
$this->httpClient = $client;
$opts = new Options();
$opts->setPort(4444);
$client = new Client(new UdpAdapter($opts));
$this->udpClient = $client;
}
/**
* @iterations 1000
*/
public function sendDataUsingHttpAdapter()
{
$this->httpClient->mark("metric.name", ["key" => "value"]);
}
/**
* @iterations 1000
*/
public function sendDataUsingUdpAdapter()
{
$this->udpClient->mark("metric.name", ["key" => "value"]);
}
}