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

fix: posting metrics fails due to stop being null #73

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

gastonfournier
Copy link
Contributor

About the changes

When posting metrics the stop variable of the bucket is null. This makes Unleash reject metrics with a 400 error.

This PR fixes that and adds a test validating the body format

Comment on lines +87 to +89
val bucketRef = bucket
bucket = Bucket(start = stop)
val clonedMetrics = bucketRef.copy(stop = stop)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Immediately swap variables so new counts are against the new bucket, only then make a copy. If due to a race condition a count is still counted against the old bucket it'll still be counted, so we should not lose data

Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@gastonfournier gastonfournier merged commit a201869 into main Mar 1, 2024
2 checks passed
@gastonfournier gastonfournier deleted the fix-metrics-posting branch March 1, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants