iits-consulting / otc-prometheus-exporter

GNU General Public License v3.0
8 stars 1 forks source link

Batched metric request results in 400 response #12

Closed DrDJIng closed 1 year ago

DrDJIng commented 1 year ago

This was working fine a couple of months ago, but now the scraping seems to fail.

Specifically it's the batched metric request in main.go line 44, it fails with the response:

{"http_code":400,"message":{"details":"Some content in message body is not correct.","code":"ces.0014"}}

I tried a fresh copy of the repo, and got the same response.

Any help with this would be appreciated.

zeljkobekcic commented 1 year ago

Hello, sorry for the late reply. I will look into it now.

zeljkobekcic commented 1 year ago

I just ran the program didn't encounter the error like you did. Can you provide me more information?

Best regards

DrDJIng commented 1 year ago

So I dug into it more deeply, and when I finally managed to get a copy of the actual request being sent, the part of the json in the body that represents the metrics we're requesting was empty.

I'm still not entirely sure what causes this, since we were collecting resources, but the appropriate part of the request was empty.

Also haven't managed to pin down exactly what causes this to happen, but if I do figure that out, I'll update here.

On Tue, Jul 11, 2023 at 5:19 PM TheRealZeljko @.***> wrote:

I just ran the program didn't encounter the error like you did. Can you provide me more information?

  • Where is your project located? eu-de/eu-nl?
  • Do you know how many elements/services/objects you are trying to monitor?
  • Anything else you think is important.

Best regards

— Reply to this email directly, view it on GitHub https://github.com/iits-consulting/otc-prometheus-exporter/issues/12#issuecomment-1631024005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOHLYCFGQ5WU35FGSIRFNZTXPVVH7ANCNFSM6AAAAAAZHO6N7U . You are receiving this because you authored the thread.Message ID: @.***>

zeljkobekcic commented 1 year ago

I was able to reproduce your error.

If we call the batch metric API with an empty input, then the API endpoints returns this errors message:

{"code":400,"element":"Bad Request","message":"The system received a request which cannot be recognized","details":{"details":"Some content in message body is not correct.","code":"ces.0014"}}

I debugged into the relevant part of the code and made a screenshot of the variables. Here you can see that the JSON body is in fact empty and that the error is a HTTP 400.

Screenshot 2023-07-12 at 08 26 37

I will fix soon and inform you about it this issue about it.

Thank you very much!