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

First implementation of Cobalt Telemetry core logic #551

Merged
merged 5 commits into from
Jun 15, 2023

Conversation

joeltine
Copy link
Contributor

@joeltine joeltine commented Jun 6, 2023

See go/cobalt-telemetry for design.

This PR implements Cobalt versions of all the core metrics control classes supported by //components/metrics. A future CL will add their instantiation and bootstrapping into application.cc.

A H5vcc interface is added to facilitate a callback mechanism in JavaScript to intercept metric's payloads.

For now, only UMA is supported. UKM is explicitly disabled everywhere as is anything related to Chromium experiments (i.e., Field Trials).

Note: I want to get early feedback on the core logic before adding unit tests. Once this CL is looking stable, I'll add tests.

b/280094891

Change-Id: I1f6da00b9bb269f5597c4b6b329262fc45dd0908

@joeltine joeltine requested a review from kaidokert June 6, 2023 18:56
@joeltine
Copy link
Contributor Author

joeltine commented Jun 6, 2023

Apologize for the size of this PR. I honestly couldn't think of a way to easily split it up without a bunch of intermediate changes. Everything depends on each other to work.

@joeltine joeltine force-pushed the cobalt-telemetry branch 9 times, most recently from 6c86368 to 6402f94 Compare June 7, 2023 20:51
@joeltine
Copy link
Contributor Author

joeltine commented Jun 7, 2023

Woohoo all CI checks are passing \o/. Should be g2g for review.

@kaidokert
Copy link
Member

Woohoo all CI checks are passing \o/. Should be g2g for review.

I'll get my pass through done tomorrow

@kaidokert kaidokert requested review from jellefoks and y4vor June 8, 2023 07:55
cobalt/h5vcc/script_callback_wrapper.h Outdated Show resolved Hide resolved
Copy link
Member

@kaidokert kaidokert left a comment

Choose a reason for hiding this comment

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

Overall the structure looks fine. Could use quite a few more NOTIMPLEMENTED and DCHECK quards to avoid surprises.

Also, a number of the concerns poured into the code here should be brought into a design doc and reviewed.

cobalt/browser/metrics/cobalt_metrics_log_uploader.h Outdated Show resolved Hide resolved
cobalt/browser/metrics/cobalt_enabled_state_provider.h Outdated Show resolved Hide resolved
cobalt/browser/metrics/cobalt_enabled_state_provider.h Outdated Show resolved Hide resolved
cobalt/h5vcc/h5vcc_metrics.idl Show resolved Hide resolved
cobalt/h5vcc/h5vcc_metrics.idl Show resolved Hide resolved
cobalt/h5vcc/script_callback_wrapper.h Show resolved Hide resolved
components/crash/core/common/crash_key.h Show resolved Hide resolved
@joeltine
Copy link
Contributor Author

First round of comments addressed and I didn't see any major structural change recommendations. As such, I'll follow-up with unit tests and a doc on the open design questions.

@joeltine
Copy link
Contributor Author

Here's the design doc w/ the open questions: go/cobalt-telemetry-impl

@joeltine
Copy link
Contributor Author

So I'm starting on unit and black box tests for this, but I'm realizing it's going to be a long road. Any qualms with me submitting the code as-is and following up with a PR dedicated to testing everything?

@kaidokert
Copy link
Member

So I'm starting on unit and black box tests for this, but I'm realizing it's going to be a long road. Any qualms with me submitting the code as-is and following up with a PR dedicated to testing everything?

We had a testing team that should chime in on this. @hlwarriner @sideb0ard for comments.

I'd rather personally would like to see design and tests go in first. Especially because in the component layers we already disabled component tests, even though they are already there and written, e.g. b/283258321 and b/283275474 from here: https://github.com/youtube/cobalt/pull/387/files.

@joeltine
Copy link
Contributor Author

So I'm starting on unit and black box tests for this, but I'm realizing it's going to be a long road. Any qualms with me submitting the code as-is and following up with a PR dedicated to testing everything?

We had a testing team that should chime in on this. @hlwarriner @sideb0ard for comments.

I'd rather personally would like to see design and tests go in first. Especially because in the component layers we already disabled component tests, even though they are already there and written, e.g. b/283258321 and b/283275474 from here: #387 (files).

Understandable. Can I do just trunk-only for now? Just psychologically it would be good to check this in and not continue to bloat this CL. I also have other CLs floating around that are based on this branch. Would be nice to have those tied to main instead and stop needing to sync those with this every time I make a change.

I will follow-up with tests on this. It's my next priority.

@hlwarriner
Copy link
Contributor

Is this telemetry MVP something we're trying to get into Cobalt 24?

We said we wouldn't push the new unit test policy too hard until after the main Cobalt 24 deadlines pass, so I'm ok with this. My answer would probably change if this came up in a month or two, though.

@sideb0ard
Copy link
Contributor

I will follow-up with tests on this. It's my next priority.

Cools, yeah, I'd just say make sure there is a ticket to track adding the tests

@joeltine
Copy link
Contributor Author

Ya, would really like to get this into C24.

Here's a tracking bug for tests https://b.corp.google.com/issues/287248166

Copy link
Member

@kaidokert kaidokert left a comment

Choose a reason for hiding this comment

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

LGTM if the tests come soon

go/cobalt-telemetry.

This PR implements Cobalt versions of all the core metrics control
classes supported by //components/metrics.

A H5vcc interface is added to facilitate a callback mechanism in
Javascript to intercept metric's payloads.

For now, only UMA is supported. UKM is explicitly disabled everywhere as
is anything related to Chromium experiments (i.e., Field Trials).

b/280094891

Change-Id: I1f6da00b9bb269f5597c4b6b329262fc45dd0908
b/280094891

Change-Id: I1e833a6947065fb7f2e6fe398c2249ca72d28007
b/280094891

Change-Id: I951ae45b7e359e0426c1e69ccdcc919e7e063842
b/280094891

Change-Id: Ib4336b1948db7ffaa380319700b2c97f317053d6
Misc changes to support testing. E.g., to avoid needing to create
a V8 Script h5vcc, introduced cobalt_metrics_uploader_callback abstract
class that can be mocked in tests.

b/280094891

Change-Id: I0b1a19547b1be2747571fb451286ae67dd31b554
@joeltine
Copy link
Contributor Author

FYI: I was able to get the unit tests done and just included them in the latest commit of this PR. PTAL. See test results: https://paste.googleplex.com/5234633187786752.

The tests required a few unique changes of their own, with the most significant being needing to wrap the H5vcc Script callback in a new interface CobaltMetricsUploaderCallback. This allowed mocking in tests as constructing a V8 object is non-trivial.

@joeltine
Copy link
Contributor Author

Also, black box tests will be a follow-up PR.

Copy link
Member

@kaidokert kaidokert left a comment

Choose a reason for hiding this comment

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

Had a look at tests and looks great. I guess we'll now even see coverage delta on this once submitted.

Integration tests in follow-up CLs is perfectly fine.

@hlwarriner
Copy link
Contributor

FYI: I was able to get the unit tests done and just included them in the latest commit of this PR. PTAL. See test results: https://paste.googleplex.com/5234633187786752.

The tests required a few unique changes of their own, with the most significant being needing to wrap the H5vcc Script callback in a new interface CobaltMetricsUploaderCallback. This allowed mocking in tests as constructing a V8 object is non-trivial.

Thanks for taking the time to add unit tests!

@joeltine joeltine merged commit 73f2621 into youtube:main Jun 15, 2023
@joeltine joeltine deleted the cobalt-telemetry branch June 15, 2023 17:34
dmytro-golovchenko-luminartech pushed a commit to dmytro-golovchenko-luminartech/cobalt that referenced this pull request Jun 22, 2023
* First implementation of Cobalt Telemetry core logic, see
go/cobalt-telemetry.

This PR implements Cobalt versions of all the core metrics control
classes supported by //components/metrics.

A H5vcc interface is added to facilitate a callback mechanism in
Javascript to intercept metric's payloads.

For now, only UMA is supported. UKM is explicitly disabled everywhere as
is anything related to Chromium experiments (i.e., Field Trials).

b/280094891

Change-Id: I1f6da00b9bb269f5597c4b6b329262fc45dd0908
Former-commit-id: 73f2621
@joeltine joeltine added the cp-24.lts.1+ Cherry Pick to the 24.lts.1+ branch label Jun 27, 2023
cobalt-github-releaser-bot pushed a commit that referenced this pull request Jun 27, 2023
* First implementation of Cobalt Telemetry core logic, see
go/cobalt-telemetry.

This PR implements Cobalt versions of all the core metrics control
classes supported by //components/metrics.

A H5vcc interface is added to facilitate a callback mechanism in
Javascript to intercept metric's payloads.

For now, only UMA is supported. UKM is explicitly disabled everywhere as
is anything related to Chromium experiments (i.e., Field Trials).

b/280094891

Change-Id: I1f6da00b9bb269f5597c4b6b329262fc45dd0908
(cherry picked from commit 73f2621)
joeltine added a commit that referenced this pull request Jun 27, 2023
…gic (#729)

* First implementation of Cobalt Telemetry core logic, see
go/cobalt-telemetry.

This PR implements Cobalt versions of all the core metrics control
classes supported by //components/metrics.

A H5vcc interface is added to facilitate a callback mechanism in
Javascript to intercept metric's payloads.

For now, only UMA is supported. UKM is explicitly disabled everywhere as
is anything related to Chromium experiments (i.e., Field Trials).

b/280094891

Change-Id: I1f6da00b9bb269f5597c4b6b329262fc45dd0908
(cherry picked from commit 73f2621)

Co-authored-by: Joel Martinez <[email protected]>
joeltine added a commit to joeltine/cobalt that referenced this pull request Jul 24, 2023
These protos were added in th PR youtube#551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
joeltine added a commit to joeltine/cobalt that referenced this pull request Jul 24, 2023
These protos were added in th PR youtube#551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
joeltine added a commit to joeltine/cobalt that referenced this pull request Jul 24, 2023
These protos were added in th PR youtube#551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
joeltine added a commit to joeltine/cobalt that referenced this pull request Jul 24, 2023
These protos were added in th PR youtube#551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
joeltine added a commit that referenced this pull request Jul 24, 2023
These protos were added in th PR #551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

Protos removed: omnibox_event.proto, sampled_profile.proto,
memory_leak.proto.

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
cobalt-github-releaser-bot pushed a commit that referenced this pull request Jul 24, 2023
These protos were added in th PR #551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

Protos removed: omnibox_event.proto, sampled_profile.proto,
memory_leak.proto.

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141
(cherry picked from commit eb78ed1)
joeltine added a commit that referenced this pull request Jul 25, 2023
…ary size increase (#1029)

Refer to the original PR: #1025

These protos were added in th PR #551 for the first introduction of
Cobalt Telemetry. They are currently unused in Cobalt and removing them
seems to reduce the binary size significantly (per bloaty analysis).

Protos removed: omnibox_event.proto, sampled_profile.proto,
memory_leak.proto.

b/290819695

Change-Id: I350742ea55621b29fa3d565618098791f666c141

Co-authored-by: Joel Martinez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cp-24.lts.1+ Cherry Pick to the 24.lts.1+ branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants