Skip to content

Conversation

felipecsl
Copy link
Contributor

Towards: FF-3608
Towards: FF-3609

Motivation and Context

Hook into Eppo-exp/js-sdk-common#139 to use new event dispatcher API

Description

Integrate new event tracking API

How has this been tested?

Wrote tests

@felipecsl felipecsl marked this pull request as ready for review November 25, 2024 23:15
package.json Outdated
},
"dependencies": {
"@eppo/js-client-sdk-common": "4.3.0"
"@eppo/js-client-sdk-common": "https://github.com/Eppo-exp/js-sdk-common.git#0bd1de8d06426d91006cfda5070554001ff1184e"
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 will eventually point to the next release version of js-client-sdk-common once that's published

skipInitialPoll: skipInitialRequest,
};
instance.setConfigurationRequestParameters(requestConfiguration);
instance.setEventDispatcher(newEventDispatcher(apiKey));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

relevant change

Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

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

Pieces coming together! 💪 💪

package.json Outdated
},
"dependencies": {
"@eppo/js-client-sdk-common": "4.3.0"
"@eppo/js-client-sdk-common": "https://github.com/Eppo-exp/js-sdk-common.git#66aa69971c488927297e7aa611300d6dda0fd706"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a reminder not to check this in

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore test code
// noinspection JSConstantReassignment
navigator.onLine = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

woah cool I didn't even know browsers had this
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🎉 despite the awful onLine casing 🤮

Comment on lines +66 to +68
applicationLogger.error(
`Failed to parse event queue ${this.name} state. Initializing empty queue.`,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I appreciate the fallback modes (vs exploding)

Comment on lines +87 to +90
for (let i = 0; i < serializedEvent.length; i++) {
hash = (hash << 5) - hash + serializedEvent.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we're doing this ourselves vs some hashing library? Or reusing the hashing code we do for shard numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, actually no reason. I'll look into reusing that

* Configuration used for initializing the Eppo client
* @public
*/
export interface IClientConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pulling this out into it's own file, much cleaner 🧼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🧹

skipInitialPoll: skipInitialRequest,
};
instance.setConfigurationRequestParameters(requestConfiguration);
instance.setEventDispatcher(newEventDispatcher(apiKey));
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

@@ -0,0 +1,11 @@
/* Returns elements from arr until the predicate returns false. */
export function takeWhile<T>(arr: T[], predicate: (item: T) => boolean): T[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

oh interesting utility method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

poor man's lodash

},
"dependencies": {
"@eppo/js-client-sdk-common": "4.3.0"
"@eppo/js-client-sdk-common": "^4.5.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@felipecsl felipecsl merged commit 7146207 into main Nov 26, 2024
8 checks passed
@felipecsl felipecsl deleted the felipecsl--event-dispatcher branch November 26, 2024 18:53
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.

3 participants