blob: 2ae2283e97f86602e7dc2b517d79b77ca62938ad [file] [log] [blame]
// Copyright 2018 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.
syntax = "proto3";
package cobalt;
import "observation2.proto";
// An Event is the unit of data logged in Cobalt.
//
// Events are associated with a specific Metric. There is a different Event
// type for each Metric type. Events are also tagged with a day index indicating
// the day on which the event occurred.
message Event {
// An Event has one of the following types. These types correspond to
// the various Metric types defined in config/metric_definitions.proto.
oneof type {
OccurrenceEvent occurrence_event = 1;
CountEvent count_event = 2;
ElapsedTimeEvent elapsed_time_event = 3;
FrameRateEvent frame_rate_event = 4;
MemoryUsageEvent memory_usage_event = 5;
IntHistogramEvent int_histogram_event = 6;
StringUsedEvent string_used_event = 7;
CustomEvent custom_event = 999;
}
// The three-part unique numerical identifier of the Metric that this
// Event is associated with.
uint32 customer_id = 1000;
uint32 project_id = 1001;
uint32 metric_id = 1002;
// The index of the day on which this Event occurred.
uint32 day_index = 1003;
}
// Records that an event has occurred.
message OccurrenceEvent {
// The event code for the event that occurred.
uint32 event_code = 1;
}
// Records that an event occurred a number of times.
message CountEvent {
// The event codes for the event that occurred. There must be one event code
// given for each dimension specified in the metric definition.
repeated uint32 event_code = 1;
// The associated system component
string component = 2;
// Time over which the count was taken, in microseconds.
int64 period_duration_micros = 3;
// The number of times the event occurred.
int32 count = 4;
}
// Records that an event occurred a number of times.
message ElapsedTimeEvent {
// The event codes for the event that occurred. There must be one event code
// given for each dimension specified in the metric definition.
repeated uint32 event_code = 1;
// The associated system component
string component = 2;
// The elapsed time in microseconds.
int64 elapsed_micros = 3;
}
// Records a frame-rate.
message FrameRateEvent {
// The event codes for the event that occurred. There must be one event code
// given for each dimension specified in the metric definition.
repeated uint32 event_code = 1;
// The associated system component
string component = 2;
// round(frames-per-second * 1000)
int64 frames_per_1000_seconds = 3;
}
// Records a memory-usage.
message MemoryUsageEvent {
// The event codes for the event that occurred. There must be one event code
// given for each dimension specified in the metric definition.
repeated uint32 event_code = 1;
// The associated system component
string component = 2;
// Memory usage in bytes.
int64 bytes = 3;
}
// Records a histogram over a set of integer buckets. The semantics of the
// Metric must be specified in comments near the Metric definition. The
// numerical values of the buckets is specified in the |int_buckets|
// field of the MetricDefinition.
message IntHistogramEvent {
// The event codes for the event that occurred. There must be one event code
// given for each dimension specified in the metric definition.
repeated uint32 event_code = 1;
// The associated system component
string component = 2;
// The set of bucket indices and their corresponding counts.
repeated HistogramBucket buckets = 3;
}
// Records that a given string was used in a specific context. The semantics
// of the Metric must be specified in comments near the MetricDefintion.
//
// See comments in metric_definion.proto for Metric type STRING_USED.
message StringUsedEvent {
string str = 1;
}
// Allows users of Cobalt to define custom Metrics with custom semantics. Each
// Custom event is a collection of CustomEventValues, each of which has a
// dimension name and a value associated with the event.
message CustomEvent {
// The keys are the names of the metric dimensions to which each ValuePart
// is associated.
map<string, CustomDimensionValue> values = 1;
}