Giter VIP home page Giter VIP logo

quickmetrics's Introduction

Quickmetrics

NOTE: This is for demonstration purposes only. Not intended for use in production infrastructure.

Quickly set up metrics with Prometheus and an Aggregation Gateway, so you can push metrics to Prometheus locally with Autometrics.

Test out Autometrics Grafana dashboards as well.

TODO!!! Instructions

Setup

To run, you need Docker installed locally, and a local copy of this repository.

# Start things up
docker compose up

# NOTE - If you ever make changes, e.g., to the api, you'll want to rebuild the docker images
docker compose up --build
  • Prometheus runs locally on localhost:9090, and loads autometrics alerting rules from prometheus/autometrics.rules.yml
  • Prometheus will try to scrape localhost:8080/metrics by default. You can change this under scrape_configs in prometheus/prometheus.yml
  • The aggregation gateway runs on localhost:8081
  • Grafana runs on localhost:9011 and does not require a username/password to log in
  • An API runs on localhost:8082 and will proxy requests to /metrics to the aggregation gateway, setting proper CORS headers so you can push metrics from the browser

Prometheus will scrape the aggregation gateway every 5 seconds, but you can change this in the prometheus/prometheus.yml config file.

Go to http://localhost:9090/targets to check the health of the aggregation gateway.

Configuration

You can configure the ports on which services are exposed by modifying the .env file:

  • FP_PROMETHEUS_PORT - The port that Prometheus runs on, on your machine
  • FP_PUSH_GATEWAY_PORT - The port that the aggregation gateway runs on, on your machine
  • FP_GRAFANA_PORT - The port that Grafana runs on, on your machine
  • FP_ALERTMANAGER_PORT - The port that Alertmanager runs on, on your machine
  • FP_API_PORT - The port that the api proxy to the aggregation gateway port runs on, on your machine

To configure the Prometheus scrape interval, modify the prometheus/prometheus.yml file

To load the Grafana Autometrics dashboards, go to Grafana, and import the JSON files located in this repo under ./grafana/dashboards. These are copy-pasted from the autometrics-shared repo, see here.

(In a future version, we will try to autoload these dashboards.)

Test it out

Once you've spun up the containers, you can push metrics to the api that's sitting in front of the aggregation gateway:

echo '
http_requests_total{result="ok", function="curl", module=""} 1027
http_errors_total{result="error", function="curl", module=""} 6
' | curl --data-binary @- http://localhost:8081/metrics/

Then, look for the metrics in Prometheus: http://localhost:9090/graph. Search for http_requests_total{function="curl"} or http_errors_total{function="curl"}.

Thanks

This makes use of Zapier's prom-aggregation-gateway to support client-side (browser) metrics.

quickmetrics's People

Contributors

actualwitch avatar brettimus avatar flenter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

quickmetrics's Issues

Automatically load Grafana Autometrics dashboards

Once #3 is merged, it will still be necessary to manually import the grafana dashboards for autometrics. I would like to find a way to do this automatically, however right now it's not possible because the JSON files require that the user selects a prometheus datasource upon importing. Not sure if there's a way around this.

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.