Skip to content

Conversation

@Dexterp37
Copy link
Contributor

@Dexterp37 Dexterp37 commented Mar 9, 2021

This introduces the labelled metric types for string, boolean and counter types. The implementation closely follows what's in the Glean SDK, with no major deviation.

Note that this required adding a couple more functions to the database.

TODO:

  • Port test coverage.
  • Enable dynamic labels.
  • Add documentation.
  • Enforce label limits.
  • Enable different labelled metric types (instead of hardcoding)

@Dexterp37 Dexterp37 force-pushed the labeled branch 5 times, most recently from 264eb36 to 5b35e84 Compare March 12, 2021 14:08
@Dexterp37 Dexterp37 self-assigned this Mar 12, 2021
@Dexterp37 Dexterp37 marked this pull request as ready for review March 12, 2021 14:20
@Dexterp37 Dexterp37 requested a review from brizental March 12, 2021 16:37
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.

It is Friday EOD and I probably missing something in this review. Please consider this a "first pass" and I'll take a closer look on Monday 🧇

* whatever is stored internally, without performing any specific
* validation.
*/
export class PassthroughMetric extends Metric<JSONValue, JSONValue> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: PassThroughMetric?

Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to self: I don't understand why we need the PassthorughMetric at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I get it now. I was wrong when I assumed Labeled metrics did not need a Metric declaration. Even though we don't care about their internal representation, they need a Metric representation for generating the ping payload. I am sorry for the back and forth here, but I would prefer if instead of PassthrougMetric you made this LabeledMetric.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mh, too bad :) Now, I could do that and move it back to the labeled metric implementation file. Unfortunately doing so will trigger a circular dependency that breaks the TS build :(

Copy link
Contributor

Choose a reason for hiding this comment

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

Argh, come on TS.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, if you move this line to somewhere after you define the Metric abstract class the error goes away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed this as requested and added a better comment.

@Dexterp37 Dexterp37 requested a review from brizental March 15, 2021 12:41
This internally changes the id getter on the
`MetricType` to read from the store in case
of dyanmic labels, as done in the Glean SDK.
This is required in order to attempt recording to
Glean metrics before it gets initialized.
This supports string, boolean and counter labeled
types and ports over tests from the Kotlin implementation
in the SDK and the glean-core internals.
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.

Good to go, assuming the PassthroughMetric comments are addressed.

* The only internal event triggered at this point is the `afterPingCollection` event, which is triggered after ping collection and logging, and before ping storing.
* Plugins are built to listen to a specific Glean event. Each plugin must define an `action`, which is executed everytime the event they are listening to is triggered.
* [#101](https://github.com/mozilla/glean.js/pull/101): BUGFIX: Only validate Debug View Tag and Source Tags when they are present.
* [#101](https://github.com/mozilla/glean.js/pull/101): BUGFIX: Only validate Debug View Tag and Source Tags when they are present.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have two entries here... Whathever, can be fixed when we make the next release.

@Dexterp37 Dexterp37 merged commit 647c5ad into mozilla:main Mar 15, 2021
@Dexterp37 Dexterp37 deleted the labeled branch March 15, 2021 18:57
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