Skip to content

Conversation

@Dexterp37
Copy link
Contributor

See the individual commit messages descriptions for easier review.

This exclusively adds the metric type, it doesn't take care of adding the 'events' ping.

This introduces the `test:unit` npm script,
which quickly runs all the unit tests.
This field is required, but it can be an empty
string.
This is modeled after the events database in the
Glean SDK (without the append-only file).
This is the primary API for dealing with events.
Change the payload structure to declare them
as an array instead of an object.
@Dexterp37 Dexterp37 requested a review from brizental February 2, 2021 18:17
@Dexterp37 Dexterp37 self-assigned this Feb 2, 2021
private eventsStore: Store;

constructor() {
this.eventsStore = new WeakStore("unused");
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 should probably use the persistent storage :-P

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, I think this one was missed :)

Copy link
Contributor

@brizental brizental left a comment

Choose a reason for hiding this comment

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

Approach looks fine for me overall. Left a bunch of comments but most of them are nits.

My main concern is the liberal usage of as to bypass the type checker.

private eventsStore: Store;

constructor() {
this.eventsStore = new WeakStore("unused");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, I think this one was missed :)

): Promise<RecordedEvent[] | undefined> {
const events = await this.getAndValidatePingData(ping);
if (events.length === 0) {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

uber nit: If you change the return type to Promise<RecordedEvent[] | void> you can do just return; here.

Copy link
Contributor

@brizental brizental left a comment

Choose a reason for hiding this comment

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

r+wc!


constructor() {
this.eventsStore = new WeakStore("unused");
this.eventsStore = new PersistentStore("unused");
Copy link
Contributor

Choose a reason for hiding this comment

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

"unused" may not the most descriptive storage name. Maybe "events"?

@Dexterp37 Dexterp37 merged commit bff10a8 into mozilla:main Feb 3, 2021
@Dexterp37 Dexterp37 deleted the events branch February 3, 2021 13:54
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