Skip to content

PrometheusApiClientException: HTTP Status Code 414 Request-URI Too Large #66

Closed

Description

@infa-ddeore

Describe the bug
"krr simple -n kube-system -p https://prometheus.example.com" gives "Request-URI Too Large" exception

To Reproduce
not sure if this is reproducible in every environment, i am trying the command on a cluster having 165 nodes, not sure if that is a big number for krr

Expected behavior
report should appear

Screenshots
pasting the error with masked url and cluster name

$ krr simple -n kube-system -p https://prometheus.example.com


 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\



Running Robusta's KRR (Kubernetes Resource Recommender) v1.2.1
Using strategy: Simple
Using formatter: table

[INFO] Using clusters: ['k8-cluster']
[INFO] Listing scannable objects in k8-cluster
[INFO] Found 30 objects across 1 namespaces in k8-cluster
on 0: [INFO] Connecting to Prometheus for k8-cluster cluster
on 0: [INFO] Using Prometheus at https://prometheus.example.com for cluster k8-cluster
on 0: [INFO] Prometheus found
on 0: [INFO] Prometheus connected successfully for k8-cluster cluster
Calculating Recommendation |⚠︎                                       | (!) 0/30 [0%] in 1:55.2 (0.00/s)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /private/tmp/robusta_krr/core/runner.py:174 in run                                               │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/robusta_krr/core/runner.py'                   │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/runner.py:153 in _collect_result                                   │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/robusta_krr/core/runner.py'                   │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/runner.py:125 in _gather_objects_recommendations                   │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/robusta_krr/core/runner.py'                   │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/runner.py:101 in _calculate_object_recommendations                 │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/robusta_krr/core/runner.py'                   │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/integrations/prometheus/loader.py:90 in gather_data                │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ '/private/tmp/robusta_krr/core/integrations/prometheus/loader.py'                                │
│                                                                                                  │
│                                     ... 2 frames hidden ...                                      │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/integrations/prometheus/metrics/base_filtered_metric.py:61 in      │
│ query_prometheus                                                                                 │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ '/private/tmp/robusta_krr/core/integrations/prometheus/metrics/base_filtered_metric.py'          │
│                                                                                                  │
│ /private/tmp/robusta_krr/core/integrations/prometheus/metrics/base_metric.py:71 in               │
│ query_prometheus                                                                                 │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ '/private/tmp/robusta_krr/core/integrations/prometheus/metrics/base_metric.py'                   │
│                                                                                                  │
│ /private/tmp/asyncio/threads.py:25 in to_thread                                                  │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/asyncio/threads.py'                           │
│                                                                                                  │
│ /private/tmp/concurrent/futures/thread.py:58 in run                                              │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/concurrent/futures/thread.py'                 │
│                                                                                                  │
│ /private/tmp/prometheus_api_client/prometheus_connect.py:408 in custom_query_range               │
│                                                                                                  │
│ [Errno 2] No such file or directory: '/private/tmp/prometheus_api_client/prometheus_connect.py'  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
PrometheusApiClientException: HTTP Status Code 414 (b'<html>\r\n<head><title>414 Request-URI Too Large</title></head>\r\n<body>\r\n<center><h1>414 Request-URI Too
Large</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n')

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
on same cluster, it worked on a namespace having 3 pods, looks like something to do with large number of pods

Activity

  1. arikalon1 commented on Jun 9, 2023

    @arikalon1
    Contributor

    Thanks for reporting it @infa-ddeore
    I think this is similar to #60
    We're working on fixing it ASAP

  2. otherguy commented on Jun 20, 2023

    @otherguy

    Hey :) Any progress on this? With GKE's Prometheus, it's not a 414 but simply a 400:

    PrometheusApiClientException: HTTP Status Code 400 (b'<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n  <title>Error 400
    (Bad Request)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px
    0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and
    (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media
    only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100%
    100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and
    (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100%
    100%}}#logo{display:inline-block;height:54px;width:150px}\n  </style>\n  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n  <p><b>400.</b> <ins>That\xe2\x80\x99s an error.</ins>\n  <p>Your client
    has issued a malformed or illegal request.  <ins>That\xe2\x80\x99s all we know.</ins>\n')
    

    Currently, we need to look at namespaces one by one which is time consuming.

  3. added
    bug
    on Jun 23, 2023
  4. MarcinWojtasEit commented on Jun 28, 2023

    @MarcinWojtasEit

    Hello, any progress on this?

  5. linked a pull request that will close this issuePrometheus post usage for queries #97on Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions