Fix metricsd to conform to the lastest server schema
The new server push enabled component/trait validation rules. This allows us to use the new schema that does not require vendor commands, parameters and state to start with underscore ("_"). Also fixed a few minor errors in schema definition. Change-Id: I184dd8e4c69c05e0dd1b0dddb1f9a7b0aef78841
This commit is contained in:
parent
57134adecb
commit
33c5935852
2 changed files with 10 additions and 8 deletions
|
@ -1,15 +1,17 @@
|
|||
{
|
||||
"_metrics": {
|
||||
"commands": {
|
||||
"_enableAnalyticsReporting": {
|
||||
"minimalRole": "manager"
|
||||
"enableAnalyticsReporting": {
|
||||
"minimalRole": "manager",
|
||||
"parameters": {}
|
||||
},
|
||||
"_disableAnalyticsReporting": {
|
||||
"minimalRole": "manager"
|
||||
"disableAnalyticsReporting": {
|
||||
"minimalRole": "manager",
|
||||
"parameters": {}
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"_AnalyticsReportingState": {
|
||||
"analyticsReportingState": {
|
||||
"type": "string",
|
||||
"enum": [ "enabled", "disabled" ]
|
||||
}
|
||||
|
|
|
@ -229,11 +229,11 @@ int MetricsCollector::OnInit() {
|
|||
device_->AddComponent(kWeaveComponent, {"_metrics"});
|
||||
device_->AddCommandHandler(
|
||||
kWeaveComponent,
|
||||
"_metrics._enableAnalyticsReporting",
|
||||
"_metrics.enableAnalyticsReporting",
|
||||
base::Bind(&MetricsCollector::OnEnableMetrics, base::Unretained(this)));
|
||||
device_->AddCommandHandler(
|
||||
kWeaveComponent,
|
||||
"_metrics._disableAnalyticsReporting",
|
||||
"_metrics.disableAnalyticsReporting",
|
||||
base::Bind(&MetricsCollector::OnDisableMetrics, base::Unretained(this)));
|
||||
|
||||
latest_cpu_use_microseconds_ = cpu_usage_collector_->GetCumulativeCpuUse();
|
||||
|
@ -294,7 +294,7 @@ void MetricsCollector::UpdateWeaveState() {
|
|||
metrics_lib_->AreMetricsEnabled() ? "enabled" : "disabled";
|
||||
|
||||
if (!device_->SetStateProperty(kWeaveComponent,
|
||||
"_metrics._AnalyticsReportingState",
|
||||
"_metrics.analyticsReportingState",
|
||||
enabled,
|
||||
nullptr)) {
|
||||
LOG(ERROR) << "failed to update weave's state";
|
||||
|
|
Loading…
Reference in a new issue