ChappIO / directus-extension-prometheus

Expose metrics about your data through prometheus
17 stars 0 forks source link

Does not work with Repliacs - Kubernetes #4

Open NilsBaumgartner1994 opened 1 week ago

NilsBaumgartner1994 commented 1 week ago

https://docs.directus.io/blog/understanding-kubernetes.html

When deploying with replicas we get different results when hitting /metrics

docker-compose.yaml

version: '3.8'

services:

  # The Directus backend
  rocket-meals-directus:
    image: directus/directus:10.11.2
    deploy:
      mode: replicated
      replicas: 8
      endpoint_mode: vip # Virtual IP - https://docs.docker.com/compose/compose-file/deploy/#endpoint_mode
ChappIO commented 3 hours ago

Yes, depending on the type of metric you will get different results. Mainly the request counter.

This is expected behaviour for prometheus. For counters, you need to consume all pods and sum them. This means you will most likely have to run prometheus inside your kubernetes cluster.

ChappIO commented 3 hours ago

Sorry, my assumption was that you were using kubernetes but obviously you are sharing a docker compose file. The same concept still stands: Use prometheus target discovery to make sure it polls all containers.

https://prometheus.io/docs/guides/dockerswarm/