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: filter empty metrics before we collect last seen toggles. #2172

Merged
merged 6 commits into from Oct 17, 2022

Conversation

ivarconr
Copy link
Member

@ivarconr ivarconr commented Oct 11, 2022

This PR fixes two things related to lastSeen details for feature toggles.

  1. Only update lastSeen when yes or no count is larger than 0.
  2. Allow batching of lastSeen updates, hidden behind feature flag named batchMetrics. With the flag enabled lastSeen will only be updated every 30th second.

fixes: #2104

@vercel
Copy link

vercel bot commented Oct 11, 2022

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

Name Status Preview Updated
unleash-docs ✅ Ready (Inspect) Visit Preview Oct 17, 2022 at 7:01AM (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview Oct 17, 2022 at 7:01AM (UTC)

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LG. Added a small suggestion.

src/lib/services/client-metrics/last-seen-service.ts Outdated Show resolved Hide resolved

if (this.config.flagResolver.isEnabled('batchMetrics')) {
this.unsavedMetrics = collapseHourlyMetrics([
...this.unsavedMetrics,
...clientMetrics,
]);
this.lastSeenService.updateLastSeen(clientMetrics);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer to have it behind a flag, and the batch flag seems natural.

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
@chriswk chriswk merged commit 1f0fa6a into main Oct 17, 2022
@chriswk chriswk deleted the fix/last-seen-filter-empty branch October 17, 2022 07:07
FredrikOseberg added a commit that referenced this pull request Oct 17, 2022
* fix: filter empty metrics before we collect last seen toggles.

fixes: #2104

* fix: add a last-seen service to batch last-seen toggle updates

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
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.

inactive toggle showing up in the overview with 'recently seen' times
3 participants