mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-04 16:12:20 +02:00
Merge branch 'release/0.4.4'
This commit is contained in:
@@ -268,8 +268,8 @@ The impact using UDP/IP or HTTP adapters
|
|||||||
Corley\Benchmarks\InfluxDB\AdapterEvent
|
Corley\Benchmarks\InfluxDB\AdapterEvent
|
||||||
Method Name Iterations Average Time Ops/second
|
Method Name Iterations Average Time Ops/second
|
||||||
------------------------ ------------ -------------- -------------
|
------------------------ ------------ -------------- -------------
|
||||||
sendDataUsingHttpAdapter: [1,000 ] [0.0162619416714] [61.49327]
|
sendDataUsingHttpAdapter: [1,000 ] [0.0167509446144] [59.69813]
|
||||||
sendDataUsingUdpAdapter : [1,000 ] [0.0000890662670] [11,227.59529]
|
sendDataUsingUdpAdapter : [1,000 ] [0.0000905156136] [11,047.81773]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Message to inline protocol conversion
|
### Message to inline protocol conversion
|
||||||
@@ -283,8 +283,8 @@ The impact of message to inline protocol conversion is:
|
|||||||
Corley\Benchmarks\InfluxDB\MessageToInlineProtocolEvent
|
Corley\Benchmarks\InfluxDB\MessageToInlineProtocolEvent
|
||||||
Method Name Iterations Average Time Ops/second
|
Method Name Iterations Average Time Ops/second
|
||||||
---------------------------------------------------- ------------ -------------- -------------
|
---------------------------------------------------- ------------ -------------- -------------
|
||||||
convertMessageToInlineProtocolWithNoTags : [10,000 ] [0.0000230122805] [43,455.05877]
|
convertMessageToInlineProtocolWithNoTags : [10,000 ] [0.0000237422466] [42,119.01324]
|
||||||
convertMessageToInlineProtocolWithGlobalTags : [10,000 ] [0.0000301691532] [33,146.43911]
|
convertMessageToInlineProtocolWithGlobalTags : [10,000 ] [0.0000306700468] [32,605.10185]
|
||||||
convertMessageToInlineProtocolWithDifferentTagLevels: [10,000 ] [0.0000327563763] [30,528.40741]
|
convertMessageToInlineProtocolWithDifferentTagLevels: [10,000 ] [0.0000343942404] [29,074.63543]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -15,23 +15,21 @@ class AdapterEvent extends AthleticEvent
|
|||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new Client();
|
|
||||||
$options = new Options();
|
$options = new Options();
|
||||||
$options->setHost("localhost");
|
$options->setHost("localhost");
|
||||||
$options->setPort(8086);
|
$options->setPort(8086);
|
||||||
$options->setUsername("root");
|
$options->setUsername("root");
|
||||||
$options->setPassword("root");
|
$options->setPassword("root");
|
||||||
$options->setDatabase("tcp.test");
|
$options->setDatabase("tcp.test");
|
||||||
$client->setAdapter(
|
|
||||||
new GuzzleAdapter(new HttpClient(), $options)
|
$client = new Client(new GuzzleAdapter(new HttpClient(), $options));
|
||||||
);
|
|
||||||
$this->httpClient = $client;
|
$this->httpClient = $client;
|
||||||
|
|
||||||
$opts = new Options();
|
$opts = new Options();
|
||||||
$opts->setPort(4444);
|
$opts->setPort(4444);
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client(new UdpAdapter($opts));
|
||||||
$client->setAdapter(new UdpAdapter($opts));
|
|
||||||
|
|
||||||
$this->udpClient = $client;
|
$this->udpClient = $client;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,17 @@
|
|||||||
namespace InfluxDB\Adapter;
|
namespace InfluxDB\Adapter;
|
||||||
|
|
||||||
use InfluxDB\Options;
|
use InfluxDB\Options;
|
||||||
|
use InfluxDB\Adapter\WritableInterface;
|
||||||
|
|
||||||
abstract class AdapterAbstract implements AdapterInterface
|
abstract class AdapterAbstract implements WritableInterface
|
||||||
{
|
{
|
||||||
private $options;
|
private $options;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Options $options
|
|
||||||
*/
|
|
||||||
public function __construct(Options $options)
|
public function __construct(Options $options)
|
||||||
{
|
{
|
||||||
$this->options = $options;
|
$this->options = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Options
|
|
||||||
*/
|
|
||||||
public function getOptions()
|
public function getOptions()
|
||||||
{
|
{
|
||||||
return $this->options;
|
return $this->options;
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace InfluxDB\Adapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Every InfluxDB adapter implements this interface
|
|
||||||
*/
|
|
||||||
interface AdapterInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Send series into database
|
|
||||||
* @param mixed $message
|
|
||||||
* @param string|boolean $timePrecision
|
|
||||||
*/
|
|
||||||
public function send(array $message);
|
|
||||||
}
|
|
||||||
@@ -4,12 +4,6 @@ namespace InfluxDB\Adapter;
|
|||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use InfluxDB\Options;
|
use InfluxDB\Options;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class GuzzleAdapter
|
|
||||||
* @package InfluxDB\Adapter
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
class GuzzleAdapter extends AdapterAbstract implements QueryableInterface
|
class GuzzleAdapter extends AdapterAbstract implements QueryableInterface
|
||||||
{
|
{
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace InfluxDB\Adapter;
|
||||||
|
|
||||||
|
interface WritableInterface
|
||||||
|
{
|
||||||
|
public function send(array $message);
|
||||||
|
}
|
||||||
+6
-2
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace InfluxDB;
|
namespace InfluxDB;
|
||||||
|
|
||||||
|
use InfluxDB\Adapter\WritableInterface;
|
||||||
use InfluxDb\Adapter\QueryableInterface;
|
use InfluxDb\Adapter\QueryableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,10 +12,9 @@ class Client
|
|||||||
{
|
{
|
||||||
private $adapter;
|
private $adapter;
|
||||||
|
|
||||||
public function __construct(Adapter\AdapterInterface $adapter)
|
public function __construct($adapter)
|
||||||
{
|
{
|
||||||
$this->adapter = $adapter;
|
$this->adapter = $adapter;
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAdapter()
|
public function getAdapter()
|
||||||
@@ -24,6 +24,10 @@ class Client
|
|||||||
|
|
||||||
public function mark($name, array $values = [])
|
public function mark($name, array $values = [])
|
||||||
{
|
{
|
||||||
|
if (!($this->getAdapter() instanceOf WritableInterface)) {
|
||||||
|
throw new \BadMethodCallException("You can write data to database only if the adapter supports it!");
|
||||||
|
}
|
||||||
|
|
||||||
$data = $name;
|
$data = $name;
|
||||||
if (!is_array($name)) {
|
if (!is_array($name)) {
|
||||||
$data =[];
|
$data =[];
|
||||||
|
|||||||
Reference in New Issue
Block a user