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

Bug 1679375 - Implement the base of the metrics database module #9

Merged
merged 7 commits into from
Dec 14, 2020

Conversation

brizental
Copy link
Contributor

@brizental brizental commented Dec 10, 2020

As was described in the proposal, the database module will differ from the glean-core database module.

While it will serve as an abstraction layer over the underlying storage, it will also be the interface to retrive the ping / metric payload data from the storage. This is a bit easier for Glean.js, because the data is saved already in the format that is expected by the ping schema.

I will leave comments on the code about some doubts that lingered after I was finished with this implementation.

src/database.ts Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
@brizental
Copy link
Contributor Author

brizental commented Dec 10, 2020

FYI: CI didn't run for this PR, because it was not set up to run for PRs from forks. I changed that and it should run for next commits.

src/database.ts Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/metrics/index.ts Outdated Show resolved Hide resolved
src/metrics/index.ts Show resolved Hide resolved
tests/database.spec.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/storage/utils.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
src/database.ts Show resolved Hide resolved
src/database.ts Outdated Show resolved Hide resolved
tests/database.spec.ts Show resolved Hide resolved
Copy link
Contributor

@Dexterp37 Dexterp37 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

src/database.ts Outdated Show resolved Hide resolved
if (isObject(value)) {
console.error(`Unexpected value found for metric ${metric}: ${JSON.stringify(value)}. Clearing.`);
await store.delete([ping, metric.type, storageKey]);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still a bit puzzled by this, but we can revisit later: promises can be resolved or rejected, so maybe we can just assume that if it is resolved it has a value, otherwise rejected? Nothing to do now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I considered just leaving the data there. But that would just mean this would fail until we record/transform again, because we leave the corrupted data there...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can keep up this discussion on the bug I opened to investigate the best behaviour for this :)

@brizental brizental merged commit b35dcf8 into mozilla:main Dec 14, 2020
@brizental brizental deleted the 1679375-database branch December 14, 2020 13:25
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