InfluxDB connector | Multivac
InfluxDB connector

InfluxDB connector

InfluxDB is the database we use to store data and build dashboards. Our InfluxDB connector is in multivac/

Run and connect to InfluxDB locally

  1. Install InfluxDB 2 according to official instruction.

  2. Launch InfluxDB:

    $ influxd

    After that you will be able to work with your InfluxDB with web-interface at http://localhost:8086 . You can change it with instruction. Go to your site and create the account. Save your login organisation as environmental variable or in .env as INFLUX_ORG

  3. Go to <localhost:8086> -> Load data -> Buckets to create bucket. Save bucket name to environmental variable or in .env file as INFLUX_BUCKET=<bucket>

  4. Go to <localhost:8086> -> Load data -> API Tokens to get your token. Save token to environmental variable or in .env file as INFLUX_TOKEN=<token>

  5. Save your InfluxDB site to environmental variable or in .env file as INFLUX_URL

  6. If you’ve written variables to .env, run the following command:

    $ source .env && export $(cut -d= -f1 .env)

Now you are ready to start any python script using InfluxDB connector

Using InfluxDB connector from code

To use our connector from your code, import the connector:

from multivac.influxdb import influx_connector
bucket = os.getenv('INFLUX_BUCKET')
org = os.getenv('INFLUX_ORG')

write_api = influx_connector()
data = {
    'measurement': <your_record_ID, required>,
    'tags': {<'indexed key/value structure, not required'>},
    'fields': {<'not indexed key/value structure, required'>},
    'time': <'unix time in nanoseconds, not required'>
write_api.write(bucket, org, [data])

InfluxDB connector in

Job data:

  • Measurement: failure type (or “successful jobs”);

  • Tags: job_name, job_id, run_id, branch, commit_sha, platform, conclusion, runner_label, gc64;

  • Fields: always: {“value”: 1};

  • Time: queued at, timestamp in nanoseconds.

Test data:

  • Measurement: test name;

  • Tags: job_name, commit_sha, job_id, test_configuration, test_attempt; The test_attempt increments if already stored this test with this configuration for this job ID.

  • Fields: always: {“value”: 1};

  • Time: queued at, timestamp in nanoseconds.


$ multivac/ --format influxdb
Found what you were looking for?