evrimagaci / periodum-api

A database that compiles tons of information about elements and compounds.
https://periodum.com
Open Software License 3.0
19 stars 10 forks source link

Prometheus and Grafana supports added. #14

Closed sonerpyci closed 2 years ago

sonerpyci commented 2 years ago

Prometheus and Grafana configuration files and docker-compose services were implemented. One of the required endpoints for monitoring(/metrics) and one of the dummy endpoints for monitoring tests(/slow) were added to app.ts.

The Image below contains some example metrics collected on my local system. To show similar graphs, users should create them at grafana which will be available on http://localhost:8080/ with required queries.

Here is my queries to create charts :

  1. Request Per Minutes : sum(rate(http_request_duration_seconds_count[1m])) by (route, method, code) * 60
  2. Request Per Seconds : sum(rate(http_request_duration_seconds_count[2m])) by (route)
  3. Memory Usage In Mb's : avg(nodejs_external_memory_bytes / 1024)
  4. CPU Usage

         - Cpu Usage : sum(avg by (instance,mode) (irate(node_cpu_seconds_total{mode!='idle'}[1m]))) * 100
         - Cpu Free : sum(avg by (instance,mode) (irate(node_cpu_seconds_total{mode='idle'}[1m]))) * 100 

image

As I mentioned in the related issue with using different metrics and queries, different charts can be created to monitor some other resources as well.

nesimtunc commented 2 years ago

Hi @sonerpyci

Thank you for the changes! Please accept some delay from me in order to test it.

nesimtunc commented 2 years ago

Sorry @sonerpyci

Due to another PR's merging this one has conflicts now, can you resolve them, please? Maybe both PRs. I guess today I'll be able to review the PRs.

Thank you.

nesimtunc commented 2 years ago

Hi @sonerpyci,

We just got AppSignal account, we'll be using it for monitoring, so, for now I'm closing this PR. The logging PR may remain and we might use it.