Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

fix(metrics): POST metrics if *any* field has changed since the last send. #4602

Merged
merged 1 commit into from Jan 11, 2017

Conversation

shane-tomlinson
Copy link

This fixes a problem where clicks on the app store marketing buttons were not
recorded if metrics were already flushed but no new events were logged.

The only two fields that do not cause metrics to be flushed are
duration and flushTime since these will be different on every send.

fixes #4479

@vladikoff - r?

// a subset of `_lastFlushedData`, in which case no flush should occur.
return _.any(data, (value, key) => {
// these keys are distinct every flush attempt, ignore.
if (key === 'duration' || key === 'flushTime') {
Copy link
Author

Choose a reason for hiding this comment

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

I'm OK with ignoring both duration and flushTime when doing the comparison. _isFlushRequired used to return false if both data.events and data.timers was empty, which would occur after a flush. If either array contained an entry, data would be sent. This function still acts the same, if both events and timers are empty, no send, if either has an entry, send.

@shane-tomlinson shane-tomlinson changed the title fix(metrics): POST metrics if *any* field has changed since the last send. WIP: fix(metrics): POST metrics if *any* field has changed since the last send. Jan 10, 2017
…send.

This fixes a problem where clicks on the app store marketing buttons were not
recorded if metrics were already flushed but no new events were logged.

The only two fields that do *not* cause metrics to be flushed are
`duration` and `flushTime` since these will be different on every send.

fixes #4479
@shane-tomlinson shane-tomlinson changed the title WIP: fix(metrics): POST metrics if *any* field has changed since the last send. fix(metrics): POST metrics if *any* field has changed since the last send. Jan 10, 2017
@shane-tomlinson shane-tomlinson force-pushed the issue-4479-app-store-button-clicks branch from eb2fd6b to 90b0627 Compare January 10, 2017 12:26
@vladikoff vladikoff merged commit 7c468e7 into master Jan 11, 2017
@vladikoff vladikoff deleted the issue-4479-app-store-button-clicks branch January 11, 2017 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clicks on app store buttons not recorded if metrics already flushed
2 participants