Git Product home page Git Product logo

prometheus-sql's Introduction

Prometheus SQL

GoDoc

Service that generates basic metrics for SQL result sets and exposing them as Prometheus metrics.

This service relies on the SQL Agent service to execute and return the SQL result sets.

Status

This is a prototype and may be merged into the SQL Agent repo directly.

Behavior

  • A static configuration file is used to define the queries to monitor.
  • Each query has a designated worker for execution.
  • An interval is used to define how often to execute the query.
  • Failed queries are automatically retried using a backoff mechanism.
  • The result set of each query is held in memory for a subsequent comparison.
  • Metrics are emitted for each query using a label (see caveats below).
  • The state of a query is exposed at /state/<query>

Install

go get -u github.com/chop-dbhi/prometheus-sql

Usage

Create a queries.yml file in the current directory that defines the set of named queries to monitor (see the example file in this repository).

prometheus-sql

or for an alternate path, use the -queries option:

prometheus-sql -queries /path/to/queries.yml

Docker

Run the SQL agent service.

docker run -d --name sqlagent dbhi/sql-agent

Run this service. Mount the queries.yml file and link the SQL Agent service.

docker run -d \
    -p 8080:8080 \
    -v /path/to/queries.yml:/queries.yml \
    --link sqlagent:sqlagent \
    dbhi/prometheus-sql

To view a plain text version of the metrics, open up the browser to the http://localhost:8080 (or http://192.168.59.103:8080/metrics for boot2docker users).

Compose

Alternately, use the docker-compose.yml file included in this repository. The volumes section be added for mounting the queries.yml file.

Caveats

Currently, the Prometheus client library does not support creating a separate registry (of metrics) for each query, so metrics are differentiated using a query:<name> label. The side effect to this is that there is a single endpoint for all queries rather than one endpoint per query. See prometheus/client_golang#46 for details.

prometheus-sql's People

Contributors

bruth avatar

Watchers

Tokuhiro Matsuno avatar James Cloos avatar  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.