Adam Stone | fb679e3 | 2018-02-07 10:25:48 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | syntax = "proto2"; |
| 18 | |
| 19 | package android.drm_metrics; |
| 20 | |
| 21 | // The MetricsGroup is a collection of metric name/value pair instances |
| 22 | // that can be serialized and provided to a caller. |
| 23 | message MetricsGroup { |
| 24 | message Metric { |
| 25 | message MetricValue { |
| 26 | // Exactly one of the following values must be set. |
| 27 | optional int64 int_value = 1; |
| 28 | optional double double_value = 2; |
| 29 | optional string string_value = 3; |
| 30 | } |
| 31 | |
| 32 | // The name of the metric. Must be valid UTF-8. Required. |
| 33 | optional string name = 1; |
| 34 | |
| 35 | // The value of the metric. Required. |
| 36 | optional MetricValue value = 2; |
| 37 | } |
| 38 | |
| 39 | // The list of name/value pairs of metrics. |
| 40 | repeated Metric metric = 1; |
| 41 | |
| 42 | // Allow multiple sub groups of metrics. |
| 43 | repeated MetricsGroup metric_sub_group = 2; |
| 44 | |
| 45 | // Name of the application package associated with the metrics. |
| 46 | optional string app_package_name = 3; |
| 47 | } |
| 48 | |
| 49 | // This message contains the specific metrics captured by DrmMetrics. It is |
| 50 | // used for serializing and logging metrics. |
| 51 | // next id: 11. |
| 52 | message DrmFrameworkMetrics { |
| 53 | // TODO: Consider using extensions. |
| 54 | |
| 55 | // Attributes are associated with a recorded value. E.g. A counter may |
| 56 | // represent a count of an operation returning a specific error code. The |
| 57 | // error code will be an attribute. |
| 58 | message Attributes { |
| 59 | // Reserved for compatibility with logging proto. |
| 60 | reserved 2 to 13; |
| 61 | |
| 62 | // A general purpose error code where 0 means OK. |
| 63 | optional int32 error_code = 1; |
| 64 | |
| 65 | // Defined at ::android::hardware::drm::V1_0::KeyStatusType; |
| 66 | optional uint32 key_status_type = 14; |
| 67 | |
| 68 | // Defined at ::android::hardware::drm::V1_0::EventType; |
| 69 | optional uint32 event_type = 15; |
| 70 | } |
| 71 | |
| 72 | // The Counter message is used to store a count value with an associated |
| 73 | // Attribute. |
| 74 | message Counter { |
| 75 | optional int64 count = 1; |
| 76 | // Represents the attributes associated with this counter instance. |
| 77 | optional Attributes attributes = 2; |
| 78 | } |
| 79 | |
| 80 | // The DistributionMetric is meant to capture the moments of a normally |
| 81 | // distributed (or approximately normal) value. |
| 82 | message DistributionMetric { |
| 83 | optional double min = 1; |
| 84 | optional double max = 2; |
| 85 | optional double mean = 3; |
| 86 | optional double variance = 4; |
| 87 | optional double operation_count = 5; |
| 88 | |
| 89 | // Represents the attributes assocated with this distribution metric |
| 90 | // instance. |
| 91 | optional Attributes attributes = 6; |
| 92 | } |
| 93 | |
| 94 | message SessionLifetime { |
| 95 | // Start time of the session in milliseconds since epoch. |
| 96 | optional int64 start_time_ms = 1; |
| 97 | // End time of the session in milliseconds since epoch. |
| 98 | optional int64 end_time_ms = 2; |
| 99 | } |
| 100 | |
| 101 | // The count of open session operations. Each instance has a specific error |
| 102 | // code associated with it. |
| 103 | repeated Counter open_session_counter = 1; |
| 104 | |
| 105 | // The count of close session operations. Each instance has a specific error |
| 106 | // code associated with it. |
| 107 | repeated Counter close_session_counter = 2; |
| 108 | |
| 109 | // Count and execution time of getKeyRequest calls. |
| 110 | repeated DistributionMetric get_key_request_time_us = 3; |
| 111 | |
| 112 | // Count and execution time of provideKeyResponse calls. |
| 113 | repeated DistributionMetric provide_key_response_time_us = 4; |
| 114 | |
| 115 | // Count of getProvisionRequest calls. |
| 116 | repeated Counter get_provisioning_request_counter = 5; |
| 117 | |
| 118 | // Count of provideProvisionResponse calls. |
| 119 | repeated Counter provide_provisioning_response_counter = 6; |
| 120 | |
| 121 | // Count of key status events broken out by status type. |
| 122 | repeated Counter key_status_change_counter = 7; |
| 123 | |
| 124 | // Count of events broken out by event type |
| 125 | repeated Counter event_callback_counter = 8; |
| 126 | |
| 127 | // Count getPropertyByteArray calls to retrieve the device unique id. |
| 128 | repeated Counter get_device_unique_id_counter = 9; |
| 129 | |
| 130 | // Session ids to lifetime (start and end time) map. |
| 131 | // Session ids are strings of hex-encoded byte arrays. |
| 132 | map<string, SessionLifetime> session_lifetimes = 10; |
| 133 | } |
| 134 | |