Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to config metrics properly #335

Open
dfang opened this issue Apr 26, 2024 · 2 comments
Open

How to config metrics properly #335

dfang opened this issue Apr 26, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@dfang
Copy link

dfang commented Apr 26, 2024

Improve documentation

Link

https://supabase.github.io/supavisor/monitoring/metrics/

Describe the problem

curl -X 'GET' 'http://localhost:4000/metrics/supabase-staging' -H 'accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODAxNjIxNTR9.U9orU6YYqXAtpF8uAiw6MS553tm4XxRzxOhz2IwDhpY' | jq

curl -X 'GET' 'http://localhost:4000/metrics' -H 'accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODAxNjIxNTR9.U9orU6YYqXAtpF8uAiw6MS553tm4XxRzxOhz2IwDhpY' | jq

both return nothing

Describe the improvement

How to config metrics properly ?

@dfang dfang added the documentation Improvements or additions to documentation label Apr 26, 2024
@J0
Copy link
Contributor

J0 commented May 2, 2024

Hey @dfang,

Thanks for flagging the issue. Mind sharing what your setup looks like?

I'm running

  1. make dev
  2. make db_start
  3. curl -X 'GET' 'http://localhost:4000/metrics' -H 'accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODAxNjIxNTR9.U9orU6YYqXAtpF8uAiw6MS553tm4XxRzxOhz2IwDhpY' | jq

and am able to receive metrics.

Here's a truncated sample:

# HELP supavisor_prom_ex_phoenix_endpoint_port_info The configured port of the Endpoint module.
# TYPE supavisor_prom_ex_phoenix_endpoint_port_info gauge
supavisor_prom_ex_phoenix_endpoint_port_info{endpoint="SupavisorWeb.Endpoint",port="4000",host="127.0.0.1",region="eu",short_alloc_id="111e4567"} 1
# HELP supavisor_prom_ex_phoenix_endpoint_url_info The configured URL of the Endpoint module.
# TYPE supavisor_prom_ex_phoenix_endpoint_url_info gauge
supavisor_prom_ex_phoenix_endpoint_url_info{endpoint="SupavisorWeb.Endpoint",url="http://localhost:4000",host="127.0.0.1",region="eu",short_alloc_id="111e4567"} 1
# HELP supavisor_prom_ex_beam_system_schedulers_online_info The number of scheduler threads that are online.
# TYPE supavisor_prom_ex_beam_system_schedulers_online_info gauge
supavisor_prom_ex_beam_system_schedulers_online_info{host="127.0.0.1",region="eu",short_alloc_id="111e4567"} 10
# HELP supavisor_prom_ex_beam_system_schedulers_info The number of scheduler threads in use by the BEAM.
# TYPE supavisor_prom_ex_beam_system_schedulers_info gauge
supavisor_prom_ex_beam_system_schedulers_info{host="127.0.0.1",region="eu",short_alloc_id="111e4567"} 10
# HELP supavisor_prom_ex_beam_system_dirty_io_schedulers_info The total number of dirty I/O schedulers used to execute I/O bound native functions.
# TYPE supavisor_prom_ex_beam_system_dirty_io_schedulers_info gauge

@dfang
Copy link
Author

dfang commented Jun 2, 2024

version: '3'

services:
  supavisor:
    image: supabase/supavisor:1.1.45
    container_name: supavisor
    restart: always
    ports:
      - 4000:4000
      - 5452:5452
      - 6543:6543
    environment:
      PORT: 4000
      PROXY_PORT_SESSION: 5452
      PROXY_PORT_TRANSACTION: 6543
      # DATABASE_URL: "ecto://postgres:[email protected]:5432/postgres"
      DATABASE_URL: "ecto://supavisor:[email protected]:5432/postgres"
      # DATABASE_URL: "ecto://postgres:password@db:5432/postgres"
      CLUSTER_POSTGRES: "true"
      SECRET_KEY_BASE: "4dbd5a53cd015363f63942622186ba205b498708f8b84679aaf9878737a766b2"
      VAULT_ENC_KEY: "12345678901234567890123456789032"
      API_JWT_SECRET: "dev"
      METRICS_JWT_SECRET: "b8b55cf842a180997addc72c10493adbe35f6b2d13b223a9aa105b189a695317"
      REGION: "local"
      ERL_AFLAGS: -proto_dist inet_tcp
    depends_on:
      - db
    command:  sh -c "/app/bin/migrate && /app/bin/server"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants