Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When SendMetrics fails and calls HandleMetricsErrorResponse it throws an exception #266

Closed
PhbsSmn opened this issue Dec 6, 2024 · 5 comments
Assignees

Comments

@PhbsSmn
Copy link

PhbsSmn commented Dec 6, 2024

Describe the bug
Took a while to find it, the issue started acting up in our system since 2024-11-21 and was introduced by bumping to version 5.0.0
This version deprecated the custom serializers.

All our tests went fine but we didn't notice that sending back metrics started failing. With the following message:

Input string was not in a correct format. Failure to parse near offset 293. Format item ends prematurely.

To Reproduce
Steps to reproduce the behavior:

  1. Create a valid call with the client
  2. Execute the "fetch-feature-toggles-task" manually or automated
  3. Verify a feature using the IUnleash.IsEnabled functionality (not sure if it is needed)
  4. Wait until the report metrics interval is expired, when it is either automated or manually fire the "report-metrics-task"
  5. The response returns that it was not successfull
  6. It fires the HandleMetricsErrorResponse method
  7. If fails at extracting the error

Expected behavior
It shouldn't fail trying to obtain the error but give a hint why it was not successfull instead.

Screenshots
Highlighted the issue as the response.StatusCode although not valid caused it to go to this method.
image

Desktop (please complete the following information):

  • C# Containers & lambda

Smartphone (please complete the following information):
N/A

@daveleek
Copy link
Collaborator

Thank you for raising this @PhbsSmn, we were able to reproduce some aspects (but not all) of this. When metrics were not recorded the SDK would send null metric buckets to Unleash, and Unleash would return a 400 Bad Request. We have a fix on the way out for this.

That said we were able to see the 400 Bad Request error in the SDK when used directly towards an Unleash instance, are you using something between the SDK and Unleash? Proxy/Edge? Some kind of network gateway that could be mangling 400 responses?

@PhbsSmn
Copy link
Author

PhbsSmn commented Dec 10, 2024

I think we are using a proxy but not 100% certain, I will ping to the team responsible for this on our end.
We stumbled by accident also on a massive increase of request but not certain if this is related
image

@daveleek
Copy link
Collaborator

@PhbsSmn those are some big spikes indeed, I think you have a separate conversation going about that with our team, is that correct?

We shipped the update to metrics, it now sends default-buckets instead of null buckets. Unleash.Client 5.0.3. Let me know if you are able to update to that and if that helps the issue.

@PhbsSmn
Copy link
Author

PhbsSmn commented Dec 12, 2024

Got it verified in our library and it seems to like this fix 😄
By accident I also found an answer on the increased request rate, which must most likely be seen as "normal".
Thx for the quick feedback on this matter and fix.

@daveleek
Copy link
Collaborator

Good to hear, thanks for getting back to us with confirmation!

@github-project-automation github-project-automation bot moved this from Investigating to Done in Issues and PRs Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants