Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6b96d6d authored by Bertrand SIMONNET's avatar Bertrand SIMONNET
Browse files

metricsd: Report the model manifest id.

When the model manifest id is defined in weave, report it.

Bug: 25386505
Test: the model manifest id is uploaded when defined.
Test: If weaved.conf is not defined, metricsd uploads the default value.

Change-Id: Ic895671621fda9ce5cdeacdbdba58aa73a6887fc
parent 25322eed
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ static const char kDefaultVersion[] = "0.0.0.0";
// Build time properties name.
static const char kProductId[] = "product_id";
static const char kProductVersion[] = "product_version";

// Weave configuration.
static const char kWeaveConfigurationFile[] = "/system/etc/weaved/weaved.conf";
static const char kModelManifestId[] = "model_id";
}  // namespace metrics

#endif  // METRICS_CONSTANTS_H_
+13 −2
Original line number Diff line number Diff line
@@ -108,7 +108,18 @@ bool SystemProfileCache::Initialize() {
  profile_.client_id = testing_ ?
      "client_id_test" :
      GetPersistentGUID(guid_path);
  profile_.hardware_class = "unknown";
  profile_.model_manifest_id = "unknown";
  if (!testing_) {
    brillo::KeyValueStore weave_config;
    if (!weave_config.Load(base::FilePath(metrics::kWeaveConfigurationFile))) {
      LOG(ERROR) << "Failed to load the weave configuration file.";
    } else if (!weave_config.GetString(metrics::kModelManifestId,
                                       &profile_.model_manifest_id)) {
      LOG(ERROR) << "The model manifest id (model_id) is undefined in "
                 << metrics::kWeaveConfigurationFile;
    }
  }

  profile_.channel = ProtoChannelFromString(channel);

  // Increment the session_id everytime we initialize this. If metrics_daemon
@@ -143,7 +154,7 @@ bool SystemProfileCache::Populate(
  metrics::SystemProfileProto* profile_proto =
      metrics_proto->mutable_system_profile();
  profile_proto->mutable_hardware()->set_hardware_class(
      profile_.hardware_class);
      profile_.model_manifest_id);
  profile_proto->set_app_version(profile_.version);
  profile_proto->set_channel(profile_.channel);
  metrics::SystemProfileProto_BrilloDeviceData* device_data =
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class ChromeUserMetricsExtension;

struct SystemProfile {
  std::string version;
  std::string hardware_class;
  std::string model_manifest_id;
  std::string client_id;
  int session_id;
  metrics::SystemProfileProto::Channel channel;
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ class SystemProfileSetter;
//
// The two states are the presence or not of a staged log.
// A staged log is a compressed protobuffer containing both the aggregated
// metrics and event and information about the client. (product, hardware id,
// etc...).
// metrics and event and information about the client. (product,
// model_manifest_id, etc...).
//
// At regular intervals, the upload event will be triggered and the following
// will happen: