blob: 45aee3c54e3a3873a92f6dd9e983b42085207d98 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.legacymetrics;
using zx;
/// A single metric event to be recorded and sent to the UMA backend.
type Event = strict union {
1: user_action_event UserActionEvent;
2: histogram Histogram;
3: impl_defined_event ImplementationDefinedEvent;
};
/// Event that occurs in response to a user action. See
/// https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/actions/README.md
type UserActionEvent = table {
1: name string:MAX;
/// Required timestamp of the event occurrence. See TimeTicks in
/// https://cs.chromium.org/chromium/src/base/time/time.h
2: time zx.Time;
};
type Histogram = table {
/// Required histogram identifier. See these guidelines for more info:
/// https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#naming-your-histogram
1: name string:MAX;
2: buckets vector<HistogramBucket>:MAX;
// The sum of all the sample values.
// Together with the total count of the sample values, this allows us to
// compute the average value. The count of all sample values is just the sum
// of the counts of all the buckets.
3: sum int64;
};
type HistogramBucket = struct {
// Each bucket's range is bounded by min <= x < max.
min int64;
max int64;
// The number of entries in this bucket.
count int64;
};
/// A custom event defined by the MetricsRecorder service. Refer to your
/// MetricsRecorder implementation for more details on the payload structure.
type ImplementationDefinedEvent = table {
/// Custom binary payload whose structure is defined by the MetricsRecorder
/// implementation. For example, it can represent a custom event protocol
/// buffer serialized to its wire format.
1: data vector<uint8>:MAX;
/// Event identifier required if it's not already included in binary `data`.
/// This field takes precedence over any equivalent name included in binary
/// `data`, if both are provided.
2: name string:MAX;
};