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: exclude archived features in max reporting #7559

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Jul 9, 2024

About the changes

When reporting max values in prometheus metrics we want to exclude strategies that belong to archived features. It means we need to join with the features table in the queries.

Important files

Discussion points

Copy link

vercel bot commented Jul 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2024 0:37am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jul 9, 2024 0:37am

Copy link
Contributor

github-actions bot commented Jul 9, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

this.db.raw(
'feature_strategies, jsonb_array_elements(constraints) AS constraint_value',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this had to be rewritten to cross join after adding join to the feature table so that the syntax is correct

@kwasniew kwasniew requested a review from thomasheartman July 9, 2024 11:56
Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

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

This is probably fine, but should we add a test or two to at least one of the queries to check that

  • it doesn't count archived flags
  • if you archive and then unarchive a flag, the newly unarchived flag starts to count towards these metrics again?

'features.name',
'feature_strategies.feature_name',
)
.where('features.archived_at', null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder: if a feature is archived and then revived, is archived_at set to null again? I know we've run into issues with this before, but I think that archived_at might have been the solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested this manually and reviving brings the feature back to the reported metrics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added one test to show archived feature exclusion.

@kwasniew kwasniew merged commit 3fe110f into main Jul 10, 2024
12 checks passed
@kwasniew kwasniew deleted the max-values-reporting-exclude-archived branch July 10, 2024 07:11
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