Git Product home page Git Product logo

pgwatch3's Introduction

License: MIT Go Build & Test Coverage Status

pgwatch3 WIP. Please do not use it in production!

This is the next generation of pgwatch2.

Warning

This repo is under active development! Formats, schemas, and APIs are subject to rapid and backward incompatible changes!

Quick Start

For the fastest development experience the Docker compose file is provided:

git clone https://github.com/cybertec-postgresql/pgwatch3.git && cd pgwatch3

docker-compose up --detach
 ✔ Network pgwatch3_default       Created
 ✔ Container pgwatch3-postgres-1  Healthy
 ✔ Container pgwatch3-pgwatch3-1  Started
 ✔ Container pgwatch3-grafana-1   Started

These commands will build and start services listed in the compose file:

  • configuration and metric database;
  • pgwatch3 monitoring agent with WebUI;
  • Grafana with dashbords.

Monitor Database

After start, you could open the monitoring dashboard and start looking at metrics. You may log in as admin (admin/admin) to apply changes to dashboards or create new ones.

To add a test database under monitoring, you can use built-in WebUI. Or simply execute from command line:

$ docker-compose up add-test-db
[+] Running 2/0
 ✔ Container pgwatch3-postgres-1     Running                                                                       0.0s
 ✔ Container pgwatch3-add-test-db-1  Created                                                                       0.0s
Attaching to pgwatch3-add-test-db-1
pgwatch3-add-test-db-1  | BEGIN
...
pgwatch3-add-test-db-1  | GRANT
pgwatch3-add-test-db-1  | COMMENT
pgwatch3-add-test-db-1  | INSERT 0 1
pgwatch3-add-test-db-1 exited with code 0

Produce Workload

To emulate workload for added test database execute:

$ docker-compose up pgbench
[+] Running 2/2
 ✔ Container pgwatch3-postgres-1  Running                                                                          0.0s
 ✔ Container pgwatch3-pgbench-1   Created                                                                          0.1s
Attaching to pgwatch3-pgbench-1
pgwatch3-pgbench-1  | dropping old tables...
pgwatch3-pgbench-1  | NOTICE:  table "pgbench_accounts" does not exist, skipping
pgwatch3-pgbench-1  | NOTICE:  table "pgbench_branches" does not exist, skipping
pgwatch3-pgbench-1  | NOTICE:  table "pgbench_history" does not exist, skipping
pgwatch3-pgbench-1  | NOTICE:  table "pgbench_tellers" does not exist, skipping
pgwatch3-pgbench-1  | creating tables...
pgwatch3-pgbench-1  | generating data (client-side)...
pgwatch3-pgbench-1  | 100000 of 5000000 tuples (2%) done (elapsed 0.11 s, remaining 5.17 s)
pgwatch3-pgbench-1  | 200000 of 5000000 tuples (4%) done (elapsed 0.25 s, remaining 6.06 s)
...
pgwatch3-pgbench-1  | 5000000 of 5000000 tuples (100%) done (elapsed 16.28 s, remaining 0.00 s)
pgwatch3-pgbench-1  | vacuuming...
pgwatch3-pgbench-1  | creating primary keys...
pgwatch3-pgbench-1  | done in 42.29 s (drop tables 0.03 s, create tables 0.04 s, client-side generate 18.23 s, vacuum 1.29 s, primary keys 22.70 s).
pgwatch3-pgbench-1  | pgbench (15.4)
pgwatch3-pgbench-1  | starting vacuum...
pgwatch3-pgbench-1  | end.
pgwatch3-pgbench-1  | progress: 5.0 s, 642.2 tps, lat 15.407 ms stddev 11.794, 0 failed
pgwatch3-pgbench-1  | progress: 10.0 s, 509.6 tps, lat 19.541 ms stddev 9.493, 0 failed
...
pgwatch3-pgbench-1  | progress: 185.0 s, 325.3 tps, lat 16.825 ms stddev 8.330, 0 failed
pgwatch3-pgbench-1  |
pgwatch3-pgbench-1  |
pgwatch3-pgbench-1  | transaction type: 
pgwatch3-pgbench-1  | scaling factor: 50
pgwatch3-pgbench-1  | query mode: simple
pgwatch3-pgbench-1  | number of clients: 10
pgwatch3-pgbench-1  | number of threads: 2
pgwatch3-pgbench-1  | maximum number of tries: 1
pgwatch3-pgbench-1  | number of transactions per client: 10000
pgwatch3-pgbench-1  | number of transactions actually processed: 100000/100000
pgwatch3-pgbench-1  | number of failed transactions: 0 (0.000%)
pgwatch3-pgbench-1  | latency average = 18.152 ms
pgwatch3-pgbench-1  | latency stddev = 13.732 ms
pgwatch3-pgbench-1  | initial connection time = 25.085 ms
pgwatch3-pgbench-1  | tps = 534.261013 (without initial connection time)
pgwatch3-pgbench-1  | dropping old tables...
pgwatch3-pgbench-1  | done in 0.45 s (drop tables 0.45 s).
pgwatch3-pgbench-1 exited with code 0

Development

If you apply any changes to the source code and want to restart the agent, it's usually enough to run:

$ docker-compose up pgwatch3 --build --force-recreate --detach

The command above will rebuild the pgwatch3 agent from sources and relaunch the container.

Logs

If you are running containers in detached mode, you still can follow the logs:

$ docker compose logs --follow

Or you may check the log of a particular service:

$ docker compose logs pgwatch3 --follow

Contributing

Feedback, suggestions, problem reports, and pull requests are very much appreciated.

pgwatch3's People

Contributors

kmoppel avatar pashagolub avatar dependabot[bot] avatar kmoppel-cognite avatar denys-holub avatar pmpetit avatar eshkinkot avatar sascha8a avatar henriavelabarbe avatar jimgolfgti avatar jinnerbichler avatar lana8lee avatar cleitondomazak avatar andrewjackson2020 avatar dankasak avatar rockaut avatar adrianhartanto93 avatar bpaquet avatar silverfire avatar evgkrsk avatar yanchenko-igor avatar kostiantyn-nemchenko avatar carobme avatar cah-tyler-rasor avatar vladimirfx avatar markwort avatar renee2468 avatar xunop 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.