lablabs / cloudflare-exporter

Prometheus CloudFlare Exporter
Apache License 2.0
306 stars 104 forks source link

More verbose error logs when communication with cloudflare fails #99

Open lipelix opened 1 year ago

lipelix commented 1 year ago

More verbose error logs when communication with cloudflare fails

Metrics are exposed on /metrics endpoint and everything seems to work. But in logs I got bunch of errors which are not verbose enough. It would be great to have it more verbose - by default or by some env variable e.g. DEBUG=1..

Output

time="2023-09-19 08:00:24" level=info msg="Beginning to serve on port:8080, metrics path /metrics"
time="2023-09-19 08:02:27" level=error msg="graphql: Internal server error"
time="2023-09-19 08:02:28" level=error msg="graphql: Internal server error"
time="2023-09-19 08:02:29" level=error msg="graphql: Internal server error"
time="2023-09-19 08:11:28" level=error msg="graphql: Internal server error"
time="2023-09-19 08:19:28" level=error msg="graphql: Internal server error"
time="2023-09-19 08:25:28" level=error msg="graphql: Internal server error"
time="2023-09-19 08:29:29" level=error msg="graphql: Internal server error"

or

time="2023-09-19 11:18:54" level=info msg="Beginning to serve on port:8080, metrics path /metrics"
time="2023-09-19 11:25:26" level=error msg="graphql: Internal authentication error: internal server error"
time="2023-09-19 11:25:27" level=error msg="graphql: Internal authentication error: internal server error"
time="2023-09-19 11:25:27" level=error msg="graphql: Internal authentication error: internal server error"
time="2023-09-19 11:25:27" level=error msg="graphql: Internal authentication error: internal server error"
time="2023-09-19 11:25:27" level=error msg="graphql: Internal authentication error: internal server error"

Steps to Reproduce

  1. deploy ghcr.io/lablabs/cloudflare_exporter with docker
    version: '3.8'
    services:
    cloudflare_exporter:
    image: ghcr.io/lablabs/cloudflare_exporter
    read_only: true
    environment:
      - CF_API_TOKEN=<token_generated_in_cloudflare>
      - SCRAPE_DELAY=30
    ports:
      - 8080:8080
    restart: always
  2. wait until errors emerge

Expected Behavior

Errors have more details (which call failed, status code, stacktrace..)

Actual Behavior

Just common error message is shown.

Important Factoids

This behaviour is seen when cloudflare-exporter localy and also in gcp kubernetes cluster.