Issue with Monitoring KrakenD-API Using Prometheus: HTTP 404 on Metrics Endpoint

40 views
Skip to first unread message

Rohan Shahi

unread,
Dec 16, 2024, 6:33:08 AM12/16/24
to KrakenD Community
Description:

I am encountering an issue while setting up monitoring for my KrakenD-API using Prometheus. The /metrics endpoint is returning an HTTP 404 error, preventing Prometheus from scraping the metrics. Below are the details of my setup:

Environment Details:
Kubernetes Setup: the external IP is through mettallb

  • API Service:
    contacts LoadBalancer 10.96.53.206 172.18.0.3 8080:30564/TCP 11d
  • KrakenD Service:
    apigateway LoadBalancer 10.96.160.185 172.18.0.2 8080:31658/TCP 11d
  • Prometheus Service:
    prometheus-service LoadBalancer 10.96.133.63 172.18.0.1 80:31970/TCP 4d21h

    Current Setup:KrakenD Configuration (krakend.json):
    {
        "version": 2,
        "extra_config": {
            "telemetry/opentelemetry": {
                "service_name": "prometheus-service.default.svc.cluster.local",
                "metric_reporting_period": 1,
                "exporters": {
                    "prometheus": [
                        {
                            "name": "prometheus-service",
                            "port": 9090,
                            "go_metrics": true,
                            "listen_ip": "0.0.0.0/0",
                            "disable_metrics": false,
                            "process_metrics": true
                        }
                    ]
                }
            }
        }
    }


    Prometheus Target Configuration:
    - job_name: 'apigateway'
      scrape_interval: 5s
      static_configs:
        - targets: ['apigateway.default.svc.cluster.local:8080']

    Steps to Reproduce:
  • Deploy KrakenD and Prometheus on Kubernetes as specified.
  • Access the KrakenD /contacts endpoint:
    • URL: http://172.18.0.2:8080/contacts
      http http://172.18.0.2:8080/contacts
      HTTP/1.1 200 OK
      Content-Length: 1009
      Content-Type: application/json; charset=utf-8
      Date: Mon, 16 Dec 2024 11:30:39 GMT
      Server: Kestrel
      Vary: Origin
      X-Krakend: Version 1.2.0
      X-Krakend-Completed: false

    • Response: 200 OK, confirming the API is working.
  • Check the Prometheus target health for the /metrics endpoint:


  • Observed Behavior:
  • The KrakenD /contacts endpoint works correctly, and logs confirm the API is functional:

    [GIN] 2024/12/16 - 11:04:23 | 200 | 66.738199ms | 10.244.1.1 | GET "/contacts"

    Expected Behavior:

    The /metrics endpoint should expose Prometheus-compatible metrics for KrakenD, allowing Prometheus to scrape them successfully.


    Troubleshooting Steps Taken:
  • Verified that the extra_config section in krakend.json includes a valid Prometheus exporter configuration.
  • Confirmed that Prometheus is configured to target the /metrics endpoint for the KrakenD service.
  • Ensured there are no port conflicts between KrakenD and Prometheus.
  • Tested the /contacts endpoint to confirm that KrakenD is operational.

Request for Support:
  1. Guidance on configuring KrakenD to expose Prometheus-compatible metrics at the /metrics endpoint.
  2. Assistance in identifying any misconfigurations in the krakend.json or Prometheus configuration.
  3. Steps to troubleshoot and resolve the HTTP 404 error for the /metrics endpoint.
    Screenshot from 2024-12-16 17-17-09.png


    please anyone help me with this , this is really very important

Rohan Shahi

unread,
Dec 18, 2024, 12:35:37 AM12/18/24
to KrakenD Community, Rohan Shahi
Hi Everyone any update on this !!

Michel Fortes

unread,
Dec 22, 2024, 7:36:03 AM12/22/24
to KrakenD Community, Rohan Shahi
Hello, Rohan.

Did you try to remove "listen_ip", so krakend can use its default value?

Best!

Christopher Dean

unread,
Jan 5, 2025, 8:43:27 AM1/5/25
to KrakenD Community, Michel Fortes, Rohan Shahi
SHOP BELOW
Buy discounted welders, plasma cutters and welding safety gear by premium brands like Miller, Lincoln Electric, Hypertherm, Hobart and Black Stallion - from the mouse with over 86 years of welding experience.
Where to order welding machines and accessories online with safe shipping.
WEBSITE... weldingsupplyshop.com .
we have the best welding tools like reels,miller remote,pipe bender,welding cable, lincoln rods,leads,miller welding helmet,mig guns,tig torches,plasma torches,welding cables,mig welders,tig welders,Etc.
Order now from our website below with safe and guaranteed shipping.
WEBSITE... weldingsupplyshop.com .


Reply all
Reply to author
Forward
0 new messages