0

Says that I already had a Hasura container running on cloud, so I want to monitor the Hasura container performance with Prometheus and Grafana.

From the Hasura official docs here, it says I need to set these env variables :

  • HASURA_GRAPHQL_ENABLED_APIS=metadata,graphql,config,metrics
  • HASURA_GRAPHQL_METRICS_SECRET=SOME_SECRET_KEY

I did set both of these in the docker-compose file :

  graphql-engine:
    image: hasura/graphql-engine:v2.18.0.cli-migrations-v3
    restart: on-failure:1
    ports:
      - "8080:8080"
    environment:
      HASURA_GRAPHQL_METADATA_DATABASE_URL: MY_DB_URL
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set "false" to disable console
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "anonymous"
      HASURA_GRAPHQL_ADMIN_SECRET: SOME_SECRET
      ## For Monitoring uses, with Prometheus and Grafana
      HASURA_GRAPHQL_ENABLED_APIS: "metadata,graphql,config,metrics"
      HASURA_GRAPHQL_METRICS_SECRET: "PROMETHEUSSECRET"
    command:
    - graphql-engine
    - serve

Then I use this command to try to get the metrics value :
curl 'http://localhost:8080/v1/metrics' -H 'Authorization: Bearer PROMETHEUSSECRET'

But I received this error instead : {"code":"not-found","error":"resource does not exist","path":"$"}

Also this is my Prometheus config file :

global:
  scrape_interval:     15s 
scrape_configs:

  - job_name: 'hasura'
    static_configs:
      - targets: ['localhost:8080']
Jackk-Doe
  • 109
  • 7
  • While prometheus config has nothing to do with your problem, you have an error there too: you need to specify `metrics_path:` if your metrics exposed on something else than `/metrics` – markalex Mar 30 '23 at 08:17
  • @markalex I realised that I might had to set the metrics_path other than `/metrics`, BUT THE PROBLEM is that I do not know which metrics path does Hasura use. Which I checked that it's not the same of what mentioned in Hasura official docs. – Jackk-Doe Mar 30 '23 at 08:30

0 Answers0