Code Monkey home page Code Monkey logo

influxdb-bundle's People

Contributors

alessandrogallidcb avatar algatux avatar aliance avatar curry684 avatar dkarlovi avatar jerome1337 avatar kocal avatar nibynool avatar salvatorecordiano avatar smatyas avatar soullivaneuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

influxdb-bundle's Issues

Bump Symfony version to ^3.4

In same philosophy as #88, we can bump Symfony sypport to ^3.4 as it's the last LTS.

This can be done on a new minor if we don't change our public API.

warning: Deprecated use of Drop database in a read only context

Hi
I got the following error when tried to remove DB.

The code:
$this->influxConnection->query('Drop Database ....');

DB is removed, but as a result, I got the following error (see below full output).

I can not find any mentions in the documentation on how to change the mode for the connection or query.

influxdb-bundle: 2.4.0

unfortunately can not find the influx version, but should be latest or very close to the latest (I have access only via SQL or via Chronograf)

Full error message:

object(InfluxDB\ResultSet)#1067 (2) {
  ["parsedResults":protected]=>
  array(1) {
    ["results"]=>
    array(1) {
      [0]=>
      array(2) {
        ["statement_id"]=>
        int(0)
        ["messages"]=>
        array(1) {
          [0]=>
          array(2) {
            ["level"]=>
            string(7) "warning"
            ["text"]=>
            string(128) "deprecated use of 'DROP DATABASE XXXXX' in a read only context, please use a POST request instead"
          }
        }
      }
    }
  }
  ["rawResults":protected]=>
  string(204) "{"results":[{"statement_id":0,"messages":[{"level":"warning","text":"deprecated use of 'DROP DATABASE XXXXX' in a read only context, please use a POST request instead"}]}]}
"
}

Support a DSN for connections

If using this bundle with Symfony Flex, the established approach is to support a DSN for connection strings instead of having each individual part be separate, as is currently the case.

This allow to pass the connection string as one variable instead of several (up to 5) which significantly simplifies secrets management for containerized apps, you just put the entire DSN in the secret.

Here's an example usage by Doctrine Bundle in a Symfony Flex recipe:
https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/config/packages/doctrine.yaml#L18

Create and drop database commands

It would be great to have a create and drop commands for databases.

This is particularly useful for deploy script and integration tests.

Make udp optionals

Currently, both http and upd client/database instances are created, even if we don't needed.

Maybe we could make it optional with the config:

influx_db:
    connections:
        telegraf:
            host: '%influxdb_host%'
            database: '%influxdb_telegraf_db%'
            udp: false # Disable UDP

Both udp and http port would be false by default and a configuration validation could check if at least one of them is enabled.

Edit: Only udp will be optional: #36 (comment)

What do you think?

Support PHP 8

Currently the bundle can't be used on PHP 8 because of the version constraint. Please consider supporting PHP 8 as well.

From a quick check your dependencies all support PHP 8, so they won't stop you from upgrading. Not sure about the actual code though.

Queries profiler

It would be a very great addition to have Influx-db queries listing on the profiler.

Like Doctrine does:

image

image

What do you think?

Symfony 7 support

Symfony 7 support will be more tricky because of the removal of the container aware trait.

It make the needed refactor a bit more complex because of the called of services named "on the fly" like this:

? $this->getContainer()->get('algatux_influx_db.connection.'.$input->getOption('connection').'.http')
: $this->getContainer()->get('algatux_influx_db.connection.http')

I'll update this MR for Symfony 6 support only in order to have a quick release and support LTS.

Symfony 7 support will be the object of a separated work.

Originally posted by @soullivaneuh in #102 (comment)

Bundle not maintained ?

Hi guys,

Do you know if you will continue to maintain bundle?
PHP8 and Symfony 6 not supported
No release since 2 years

Thx for your anwer

Support timeout inside connection config

If we request and need a response from InfluxDB but we may want to have a timeout to stop InfluxDB request instead letting them running indefinitely.

It would be great to be able to set a timeout directly inside Influx connection config, for example :

influx_db:
    connections:
        default:
            host: '%influxdb_host%'
            database: '%influxdb_db%'
            username: '%influxdb_user%'
            password: '%influxdb_password%'
            timeout: 2

Abstract prefix for abstract classes

According to the Symfony Coding Standards:

Prefix abstract classes with Abstract. Please note some early Symfony classes do not follow this convention and have not been renamed for backward compatibility reasons. However all new abstract classes must follow this naming convention;

Do you want to follow this rule?

We can take profit of the next major to rename the concerned class.

Add support for symfony 4

  • blocked by matthiasnoback/symfony-dependency-injection-test
  • blocked by influxdb/influxdb-php (fix is on master, waiting for release)
  • fix services visibility for symfony 3.3 / 4.*
  • update composer.json requirements

Make some class internal

Use the @internal tag on some class.

The @internal tag means that the class should not be used except for internal stuff.

In a nutshell, you can do BC break change on this class without have to push a new major! ๐Ÿ˜‰

For example, the ClientFactory should not be used by the end user. It could be internal.

Bundle class should be vendor prefixed

It should be AlgatuxInfluxDbBundle and not just InfluxDbBundle to reduce possible bundle conflicts.

This is the adopted way for 99% of external bundles as you can see on this AppKernel extract:

new FOS\UserBundle\FOSUserBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new FOS\RestBundle\FOSRestBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Gregwar\ImageBundle\GregwarImageBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Ornicar\GravatarBundle\OrnicarGravatarBundle(),
new Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle(),
new Rollerworks\Bundle\PasswordStrengthBundle\RollerworksPasswordStrengthBundle(),
new Hackzilla\Bundle\PasswordGeneratorBundle\HackzillaPasswordGeneratorBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
new Browscap\BrowscapBundle\BrowscapBundle(),
new Hautelook\AliceBundle\HautelookAliceBundle(),
new Algatux\InfluxDbBundle\InfluxDbBundle(),
new Greg0ire\Enum\Bridge\Symfony\Bundle\Greg0ireEnumBundle(),

This can be done on a BC way by deprecating the old bundle class name.

How to use this extension with new EventDispatcherInterface

Hi, when I use your bundle in my project I get always this deprecation notice:

User Deprecated: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.

Do you know how to adjust it? I checked your code and InfluxDbEventListener is subscribed to the event with name influxdb.points_collected and it's impossible to use EventDispatcherInterface in a new way like this:

        $this->eventDispatcher->dispatch(new UdpEvent([$point], Database::PRECISION_SECONDS));

Do you have any suggestions?

The goal of PointCollection

What is the goal of PointCollection The implementation looks superfluous IMHO.

From your doc, you have to do this:

$time = new \DateTime();

$points = new PointsCollection([new Point(
    'test_metric', // name of the measurement
    0.64, // the measurement value
    ['host' => 'server01', 'region' => 'italy'], // optional tags
    ['cpucount' => rand(1,100), 'memory' => memory_get_usage(true)], // optional additional fields
    $time->getTimestamp()
)],Database::PRECISION_SECONDS);

$container
    ->get('algatux_influx_db.client.http.writer_client')
    ->write($points);

But from influxdb-php documentation:

// create an array of points
$points = array(
    new Point(
        'test_metric', // name of the measurement
        0.64, // the measurement value
        ['host' => 'server01', 'region' => 'us-west'], // optional tags
        ['cpucount' => 10], // optional additional fields
        1435255849 // Time precision has to be set to seconds!
    ),
    new Point(
        'test_metric', // name of the measurement
        0.84, // the measurement value
        ['host' => 'server01', 'region' => 'us-west'], // optional tags
        ['cpucount' => 10], // optional additional fields
        1435255849 // Time precision has to be set to seconds!
    )
);

// we are writing unix timestamps, which have a second precision
$result = $database->writePoints($points, Database::PRECISION_SECONDS);

This is basically the same.

Plus, since #10, we will directly get an access to the Database instance. So PointCollection would not be used at all.

What do you think?

Manage multiple databases

It would be great to allow multiple databases in configuration.

I have an idea of how to do it, I'll PR that soon. ๐Ÿ˜‰

Add a read client

Currently, if we use your bundle, we can only write points.

I know this is the goal of this bundle, but it's a little bit disappointing to have a bundle for influxdb and having to use directly the library outside the Symfony services scope:

$database = \InfluxDB\Client::fromDSN(sprintf(
    'influxdb://:@%s:%s/%s',
    $this->getParameter('influx_db.host'),
    $this->getParameter('influx_db.http.port'),
    $this->getParameter('influx_db.database')
));
$result = $database->getQueryBuilder()
    ->select('*')
    ->from('cpu')
    ->limit(10)
    ->orderBy('time', 'DESC')
    ->where([
        "cpu = 'cpu-total'",
        "host = '".$server->getCompleteName()."'",
    ])
    ->getResultSet()
    ->getPoints();
dump($result);

I'll look at your code and make a proposition.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.