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

feat(metrics_server): do not invalidate legacy report types #1532

Merged
merged 15 commits into from
Apr 19, 2024

Conversation

sbruens
Copy link
Contributor

@sbruens sbruens commented Apr 5, 2024

Servers released before #1242 or #1529 will continue to send reports with multiple countries or a userId property respectively. This change reinstates backwards compatibility (broken in #1528) and makes support for these old types more explicit to help future devs.

@github-actions github-actions bot added the size/M label Apr 5, 2024
@sbruens sbruens changed the title Sbruens/backwards compatible user feat(metrics_server): do not invalidate legacy report types Apr 5, 2024
@sbruens sbruens marked this pull request as ready for review April 5, 2024 15:32
@sbruens sbruens requested a review from a team as a code owner April 5, 2024 15:32
@sbruens sbruens requested a review from fortuna April 5, 2024 15:32
Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

I found the new logic a lot more confusing than the original one.
I propose we restore the old logic. We can still process the report like before in terms of validation. But just drop them instead.

src/metrics_server/connection_metrics.spec.ts Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
Copy link
Contributor Author

@sbruens sbruens left a comment

Choose a reason for hiding this comment

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

I'll address the other comments once I get clarity on whether we need to drop the access key reports or not.

src/metrics_server/connection_metrics.spec.ts Show resolved Hide resolved
src/metrics_server/connection_metrics.ts Outdated Show resolved Hide resolved
@sbruens
Copy link
Contributor Author

sbruens commented Apr 5, 2024

I'll address the other comments once I get clarity on whether we need to drop the access key reports or not.

Actually, nevermind this - I didn't initially see your top-level comment re: dropping them.

@sbruens sbruens requested a review from fortuna April 15, 2024 20:21
for (const userReport of testObject.userReports) {
// Check that `bytesTransferred` is a number between min and max transfer limits
// We require at least the userId or the country to be set.
if (!userReport.userId && (userReport.countries?.length ?? 0) === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this check is unnecessary, since the body here already knows how to trigger on the different cases. It's no big issue, but it's kind of duplicated logic. And if we add new report types in the future, this will have to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It knows how to handle those properties, but it doesn't verify that the report has at least 1 of them. I'll remove it and change the model to make it more forgiving, though I don't think we ever allowed neither to be set?

@sbruens sbruens requested a review from fortuna April 19, 2024 15:22
@sbruens sbruens merged commit 01ca585 into master Apr 19, 2024
10 checks passed
@sbruens sbruens deleted the sbruens/backwards-compatible-user-id branch April 19, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants