chromium/components/metrics/structured/mojom/event.mojom

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module metrics.structured.mojom;

import "mojo/public/mojom/base/time.mojom";

/*
 * Events to be recorded by StructuredMetrics. All values will be unhashed to be
 * validated once received by the service.
 *
 * Next version: 2
 */
[Stable]
struct Event {
  string project_name@0;

  string event_name@1;

  // Map containing metric name to its value. These should be consistent with
  // definitions in structured.xml.
  map<string, MetricValue> metrics@2;

  // Time passed (in microseconds) since boot time.  This is a timestamp
  // that gets converted to system uptime before upload when the Event
  // is passed from a WebUI Renderer process.
  [MinVersion=1] mojo_base.mojom.TimeDelta? system_uptime@3;

  // Whether this event is part of a sequence.
  [MinVersion=1] bool is_event_sequence@4;
};

[Stable]
union MetricValue {
  string hmac_value;
  int64 long_value;
  int32 int_value;
  double double_value;
  string raw_str_value;
  bool bool_value;
};