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: count variant metrics based on enabled state #131

Merged
merged 1 commit into from Dec 22, 2022

Conversation

FredrikOseberg
Copy link
Collaborator

About the changes

This PR fixes a bug where getVariant would always count as true, disregarding the enabled state of the toggle.

Closes #

Important files

Discussion points

@@ -211,15 +211,15 @@ export class UnleashClient extends TinyEmitter {
const enabled = toggle?.enabled || false;
const variant = toggle ? toggle.variant : defaultVariant;

this.metrics.count(toggleName, true);
this.metrics.count(toggleName, enabled);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This line is the important change.

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

👍 similar to the fix we did for go-client

@kwasniew kwasniew self-requested a review December 22, 2022 09:15
@FredrikOseberg FredrikOseberg merged commit d5f0c74 into main Dec 22, 2022
@FredrikOseberg FredrikOseberg deleted the fix/variant-metrics branch December 22, 2022 09:35
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

Successfully merging this pull request may close these issues.

None yet

3 participants