Code Monkey home page Code Monkey logo

artifacts's Introduction

Artifacts

Small application that counts some data in MySQL database (this application call it artifacts) and then send it to InfluxDB using UDP.

Preparation

  1. Download and compile application
  2. Create database table holding requests to made:
CREATE TABLE `__artifacts` (
  `name` varchar(1024) CHARACTER SET latin1 NOT NULL,
  `query` varchar(2048) COLLATE utf8mb4_unicode_ci NOT NULL,
  `interval` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
  1. Fill some data to table
  2. Create configuration file config.yaml. Take a look to config.yaml.dist for syntax

Query format

Application works with almost any query type that meets following criteria

  • Metric value must be integer
  • Metric value must be last column
  • One metric value per query
  • Grouping columns must be first

Valid queries:

SELECT count(1) FROM foo;
SELECT count(1) FROM foo WHERE bar='baz';
SELECT g1, g2, count(1) FROM foo GROUP BY g1, g2;

Not supported queries:

SELECT min(f), max(f) FROM foo;           -- Two values in single query
SELECT avg(f) FROM foo;                   -- Possibly non integer value
SELECT count(1), g1 FROM foo GROUP BY g1; -- Value column is not last

Testing

To test that everything is ok, run command app test. This will establish connection to MySQL server and performs all queries in sequential order. No data will be sent to InfluxDB.

For further information and configuration options run app test --help

Running daemon

app serve to run server, app serve --help for more information and configuration options.

Limitations

  1. Despite queries are stored in database, no hot reload yet supported. To refresh active queries restart is required.
  2. No locking applied - if two or more instances of this application are running for same settings, there will be data duplication.

artifacts's People

Contributors

gotterdemarung avatar

Watchers

 avatar

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.