blob: 998c2a3f7ab47152509841b1f90688632a035466 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package metrics;
// One structured metrics event, containing several hashed and unhashed metrics
// related to a single event type, tied to a single pseudonymous user.
// Next tag: 4
message StructuredEventProto {
// A per-profile, per-client, per-event ID that is used only for structured
// metrics.
optional fixed64 profile_event_id = 1;
// The first 8 bytes of the MD5 hash of the event's name as a string. Each
// name is defined in src/tools/metrics/structured/structured.xml, and this
// will be the hash of one of those.
optional fixed64 event_name_hash = 2;
// All metric values for this event. Each metric has two properties defined in
// structured.xml that determine what is recorded.
// 1. Metric name. This is a string, and the first 8 bytes of its MD5 hash is
// recorded as name_hash.
// 2. Kind. Each metric can store two kinds of values.
// - int64. The client supplies an int64 value for the metric, and that
// value is recorded as-is in value_raw.
// - hashed-string. The client supplies an arbitrary string for the metric.
// The string itself is not recorded, instead, value_hmac records the
// first 8 bytes of:
// HMAC_SHA256(concat(string, metric_name), event_key)
// The event_key is a per-profile, per-client, per-event secret 32-byte
// key used only for signing hashed values for this event. Keys should
// never leave the device, and are rotated at most every 90 days.
message Metric {
optional fixed64 name_hash = 1;
oneof value {
fixed64 value_hmac = 2;
int64 value_int64 = 3;
repeated Metric metrics = 3;