Skip to content

Commit 48f8e29

Browse files
Andrew HwangFuchsia Internal LUCI
authored andcommitted
[System Metrics] Migrate cobalt_system_metrics to CFv2
Migrating cobalt_system_metrics.cmx to CFv2. Creating a new cml file and adding core/cobalt_system_metrics to moniker_rewriter. Tested with: `fx test legacy-metrics-test` Bug: 96512 Change-Id: Ida0c828d58c96ef75d16641b7a74b1e334031ced Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/677093 Commit-Queue: Andrew Hwang <[email protected]> Reviewed-by: Christopher Johnson <[email protected]> Reviewed-by: Shai Barack <[email protected]> Reviewed-by: Francois Rousseau <[email protected]>
1 parent a05c6d9 commit 48f8e29

File tree

8 files changed

+99
-29
lines changed

8 files changed

+99
-29
lines changed

src/cobalt/bin/system-metrics/BUILD.gn

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,8 @@ executable("system-metrics") {
7171
}
7272

7373
fuchsia_package_with_single_component("cobalt_system_metrics") {
74-
manifest = "meta/cobalt_system_metrics.cmx"
75-
deps = [
76-
":system-metrics",
77-
78-
# Configure sysmgr to start cobalt_system_metrics.cmx
79-
"//src/sys/sysmgr:cobalt_system_metrics_config",
80-
]
74+
manifest = "meta/cobalt_system_metrics.cml"
75+
deps = [ ":system-metrics" ]
8176
}
8277

8378
executable("cobalt_system_metrics_unittests") {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2022 The Fuchsia Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
{
5+
include: [
6+
"inspect/client.shard.cml",
7+
"syslog/client.shard.cml",
8+
],
9+
program: {
10+
runner: "elf",
11+
binary: "bin/cobalt_system_metrics",
12+
},
13+
use: [
14+
{
15+
protocol: [
16+
"fuchsia.cobalt.LoggerFactory",
17+
"fuchsia.kernel.Stats",
18+
"fuchsia.logger.LogSink",
19+
"fuchsia.sysinfo.SysInfo",
20+
"fuchsia.tracing.provider.Registry",
21+
"fuchsia.ui.activity.Provider",
22+
],
23+
},
24+
{
25+
storage: "data",
26+
path: "/data",
27+
},
28+
{
29+
directory: "config-data",
30+
rights: [ "r*" ],
31+
path: "/config/data",
32+
},
33+
{
34+
directory: "dev-thermal",
35+
rights: [ "r*" ],
36+
path: "/dev/class/thermal",
37+
},
38+
{
39+
directory: "dev-misc",
40+
rights: [ "r*" ],
41+
path: "/dev/misc",
42+
},
43+
],
44+
}

src/diagnostics/archivist/src/moniker_rewriter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ lazy_static! {
2525
legacy_str: "omaha-client-service.cmx",
2626
modern_str: "core/omaha-client-service",
2727
},
28+
MonikerRewritePair {
29+
legacy_str: "cobalt_system_metrics.cmx",
30+
modern_str: "core/cobalt_system_metrics"
31+
}
2832
];
2933
}
3034

src/diagnostics/config/fire/components.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
id: 107,
3434
label: "Cobalt Sys Metrics",
35-
moniker: "cobalt_system_metrics.cmx",
35+
moniker: "core/cobalt_system_metrics",
3636
},
3737
{
3838
id: 108,

src/sys/appmgr/config/core_component_id_index.json5

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,7 @@
194194
},
195195
{
196196
instance_id: "76777fb21aa060c86680f0fbd7cbd4734ef6b239b429ac4d9cb2a9d08792033d",
197-
appmgr_moniker: {
198-
url: "fuchsia-pkg://fuchsia.com/cobalt_system_metrics#meta/cobalt_system_metrics.cmx",
199-
realm_path: [
200-
"app",
201-
"sys",
202-
],
203-
},
197+
moniker: "/core/cobalt_system_metrics",
204198
},
205199

206200
// An entry for `memory_monitor` is needed to preserve /cache across the v2 migration.

src/sys/core/meta/core.cml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
name: "text_manager",
5757
url: "fuchsia-pkg://fuchsia.com/text_manager#meta/text_manager.cm",
5858
},
59+
{
60+
name: "cobalt_system_metrics",
61+
url: "fuchsia-pkg://fuchsia.com/cobalt_system_metrics#meta/cobalt_system_metrics.cm",
62+
startup: "eager",
63+
},
5964

6065
// Children below this line may be present on some but not all product configurations.
6166
// Children above this line are expected to be present on all configs that include
@@ -226,7 +231,10 @@
226231
"fuchsia.ui.activity.Tracker",
227232
],
228233
from: "#activity",
229-
to: [ "#cobalt" ],
234+
to: [
235+
"#cobalt",
236+
"#cobalt_system_metrics",
237+
],
230238
},
231239
{
232240
directory: "dev",
@@ -238,7 +246,10 @@
238246
{
239247
protocol: "fuchsia.tracing.provider.Registry",
240248
from: "self",
241-
to: "#sysmem_connector",
249+
to: [
250+
"#cobalt_system_metrics",
251+
"#sysmem_connector",
252+
],
242253
dependency: "weak_for_migration",
243254
},
244255
{
@@ -419,6 +430,7 @@
419430
"#bluetooth-core",
420431
"#brightness_manager",
421432
"#cobalt",
433+
"#cobalt_system_metrics",
422434
"#debug_serial",
423435
"#detect",
424436
"#device_settings",
@@ -605,7 +617,10 @@
605617
{
606618
protocol: "fuchsia.kernel.Stats",
607619
from: "parent",
608-
to: "#system-metrics-logger",
620+
to: [
621+
"#cobalt_system_metrics",
622+
"#system-metrics-logger",
623+
],
609624
},
610625
{
611626
protocol: "fuchsia.process.Launcher",
@@ -687,6 +702,20 @@
687702
to: "#metrics-logger",
688703
subdir: "class/power-sensor",
689704
},
705+
{
706+
directory: "dev",
707+
from: "parent",
708+
as: "dev-thermal",
709+
to: "#cobalt_system_metrics",
710+
subdir: "class/thermal",
711+
},
712+
{
713+
directory: "dev",
714+
from: "parent",
715+
as: "dev-misc",
716+
to: [ "#cobalt_system_metrics" ],
717+
subdir: "misc",
718+
},
690719
{
691720
directory: "root-ssl-certificates",
692721
from: "parent",
@@ -733,6 +762,12 @@
733762
to: "#cobalt",
734763
subdir: "cobalt",
735764
},
765+
{
766+
directory: "config-data",
767+
from: "parent",
768+
to: "#cobalt_system_metrics",
769+
subdir: "cobalt_system_metrics",
770+
},
736771
{
737772
protocol: [
738773
"fuchsia.device.Controller",
@@ -953,6 +988,7 @@
953988
protocol: "fuchsia.cobalt.LoggerFactory",
954989
from: "#cobalt",
955990
to: [
991+
"#cobalt_system_metrics",
956992
"#pkg-resolver",
957993
"#sampler",
958994

@@ -987,12 +1023,18 @@
9871023
"fuchsia.sysinfo.SysInfo",
9881024
],
9891025
from: "parent",
990-
to: "#cobalt",
1026+
to: [
1027+
"#cobalt",
1028+
"#cobalt_system_metrics",
1029+
],
9911030
},
9921031
{
9931032
storage: "data",
9941033
from: "self",
995-
to: "#cobalt",
1034+
to: [
1035+
"#cobalt",
1036+
"#cobalt_system_metrics",
1037+
],
9961038
},
9971039
{
9981040
protocol: [

src/sys/sysmgr/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ template("cfg") {
8383
}
8484
}
8585

86-
cfg("cobalt_system_metrics_config") {
87-
name = "cobalt_system_metrics.config"
88-
}
89-
9086
cfg("services_config") {
9187
name = "services.config"
9288
}

src/sys/sysmgr/config/cobalt_system_metrics.config

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)