1*14675a02SAndroid Build Coastguard Worker// Copyright 2020 Google LLC 2*14675a02SAndroid Build Coastguard Worker// 3*14675a02SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*14675a02SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*14675a02SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*14675a02SAndroid Build Coastguard Worker// 7*14675a02SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*14675a02SAndroid Build Coastguard Worker// 9*14675a02SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*14675a02SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*14675a02SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*14675a02SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*14675a02SAndroid Build Coastguard Worker// limitations under the License. 14*14675a02SAndroid Build Coastguard Worker 15*14675a02SAndroid Build Coastguard Workerinclude "fcp/tracing/tracing_schema_common.fbs"; 16*14675a02SAndroid Build Coastguard Worker 17*14675a02SAndroid Build Coastguard Workerenum SecAggServerTraceState : short { 18*14675a02SAndroid Build Coastguard Worker UnknownState, 19*14675a02SAndroid Build Coastguard Worker R0AdvertiseKeys, 20*14675a02SAndroid Build Coastguard Worker R1ShareKeys, 21*14675a02SAndroid Build Coastguard Worker R2MaskedInputCollection, 22*14675a02SAndroid Build Coastguard Worker R3Unmasking, 23*14675a02SAndroid Build Coastguard Worker PrngRunning, 24*14675a02SAndroid Build Coastguard Worker Completed, 25*14675a02SAndroid Build Coastguard Worker Aborted, 26*14675a02SAndroid Build Coastguard Worker} 27*14675a02SAndroid Build Coastguard Worker 28*14675a02SAndroid Build Coastguard Workerenum ServerToClientMessageType : short { 29*14675a02SAndroid Build Coastguard Worker Abort, 30*14675a02SAndroid Build Coastguard Worker ShareKeysRequest, 31*14675a02SAndroid Build Coastguard Worker MaskedInputRequest, 32*14675a02SAndroid Build Coastguard Worker UnmaskingRequest, 33*14675a02SAndroid Build Coastguard Worker MessageContentNotSet, 34*14675a02SAndroid Build Coastguard Worker} 35*14675a02SAndroid Build Coastguard Worker 36*14675a02SAndroid Build Coastguard Workerenum ClientToServerMessageType: short { 37*14675a02SAndroid Build Coastguard Worker Abort, 38*14675a02SAndroid Build Coastguard Worker AdvertiseKeys, 39*14675a02SAndroid Build Coastguard Worker ShareKeysResponse, 40*14675a02SAndroid Build Coastguard Worker MaskedInputResponse, 41*14675a02SAndroid Build Coastguard Worker UnmaskingResponse, 42*14675a02SAndroid Build Coastguard Worker MessageContentNotSet, 43*14675a02SAndroid Build Coastguard Worker } 44*14675a02SAndroid Build Coastguard Worker 45*14675a02SAndroid Build Coastguard Workerenum TracingClientStatus : short { 46*14675a02SAndroid Build Coastguard Worker ReadyToStart, 47*14675a02SAndroid Build Coastguard Worker DeadBeforeSendingAnything, 48*14675a02SAndroid Build Coastguard Worker AdvertiseKeysReceived, 49*14675a02SAndroid Build Coastguard Worker DeadAfterAdvertiseKeysReceived, 50*14675a02SAndroid Build Coastguard Worker ShareKeysReceived, 51*14675a02SAndroid Build Coastguard Worker DeadAfterShareKeysReceived, 52*14675a02SAndroid Build Coastguard Worker MaskedInputResponseReceived, 53*14675a02SAndroid Build Coastguard Worker DeadAfterMaskedInputResponseReceived, 54*14675a02SAndroid Build Coastguard Worker UnmaskingResponseReceived, 55*14675a02SAndroid Build Coastguard Worker DeadAfterUnmaskingResponseReceived, 56*14675a02SAndroid Build Coastguard Worker Unknown, 57*14675a02SAndroid Build Coastguard Worker} 58*14675a02SAndroid Build Coastguard Worker 59*14675a02SAndroid Build Coastguard Workerenum TracingClientDropReason : short { 60*14675a02SAndroid Build Coastguard Worker SentAbortMessage, 61*14675a02SAndroid Build Coastguard Worker UnexpectedMessageType, 62*14675a02SAndroid Build Coastguard Worker UnknownMessageType, 63*14675a02SAndroid Build Coastguard Worker AdvertiseKeysUnexpected, 64*14675a02SAndroid Build Coastguard Worker EmptyPublicKey, 65*14675a02SAndroid Build Coastguard Worker NoAdvertiseKeys, 66*14675a02SAndroid Build Coastguard Worker ShareKeysUnexpected, 67*14675a02SAndroid Build Coastguard Worker WrongNumberOfKeyShares, 68*14675a02SAndroid Build Coastguard Worker MissingKeyShare, 69*14675a02SAndroid Build Coastguard Worker ExtraKeyShare, 70*14675a02SAndroid Build Coastguard Worker NoShareKeys, 71*14675a02SAndroid Build Coastguard Worker MaskedInputUnexpected, 72*14675a02SAndroid Build Coastguard Worker InvalidMaskedInput, 73*14675a02SAndroid Build Coastguard Worker NoMaskedInput, 74*14675a02SAndroid Build Coastguard Worker UnmaskingResponseUnexpected, 75*14675a02SAndroid Build Coastguard Worker InvalidUnmaskingResponse, 76*14675a02SAndroid Build Coastguard Worker NoUnmaskingResponse, 77*14675a02SAndroid Build Coastguard Worker InvalidPublicKey, 78*14675a02SAndroid Build Coastguard Worker ServerProtocolAbortClient, 79*14675a02SAndroid Build Coastguard Worker EarlySuccess, 80*14675a02SAndroid Build Coastguard Worker ConnectionClosed, 81*14675a02SAndroid Build Coastguard Worker InvalidShareKeys, 82*14675a02SAndroid Build Coastguard Worker Unknown, 83*14675a02SAndroid Build Coastguard Worker} 84*14675a02SAndroid Build Coastguard Worker 85*14675a02SAndroid Build Coastguard Workerenum TracingSecAggServerOutcome : short { 86*14675a02SAndroid Build Coastguard Worker ExternalRequest, 87*14675a02SAndroid Build Coastguard Worker NotEnoughClientsRemaining, 88*14675a02SAndroid Build Coastguard Worker UnhandledError, 89*14675a02SAndroid Build Coastguard Worker Success, 90*14675a02SAndroid Build Coastguard Worker Unknown, 91*14675a02SAndroid Build Coastguard Worker} 92*14675a02SAndroid Build Coastguard Worker 93*14675a02SAndroid Build Coastguard Worker// Spans 94*14675a02SAndroid Build Coastguard Worker// Span that records the lifetime of SecAggServer i.e from starting the SecAgg 95*14675a02SAndroid Build Coastguard Worker// protocol to its termination. 96*14675a02SAndroid Build Coastguard Workertable SecureAggServerSession(tag: "SASS", span) {} 97*14675a02SAndroid Build Coastguard Worker 98*14675a02SAndroid Build Coastguard Worker// Span that records the lifetime of each state within SecAggServer. 99*14675a02SAndroid Build Coastguard Workertable SecureAggServerState(tag: "SAST", span) { 100*14675a02SAndroid Build Coastguard Worker // Name of the current SecAggServerState. 101*14675a02SAndroid Build Coastguard Worker name: SecAggServerTraceState; 102*14675a02SAndroid Build Coastguard Worker} 103*14675a02SAndroid Build Coastguard Worker 104*14675a02SAndroid Build Coastguard Worker// Span that records the duration of SecAggServer::Create method. 105*14675a02SAndroid Build Coastguard Workertable CreateSecAggServer(tag: "CSAS", span) {} 106*14675a02SAndroid Build Coastguard Worker 107*14675a02SAndroid Build Coastguard Worker// Metric that records the parameters of the complete graph SecAggServer 108*14675a02SAndroid Build Coastguard Worker// instance. 109*14675a02SAndroid Build Coastguard Workertable FullGraphServerParameters(tag: "FGSP") { 110*14675a02SAndroid Build Coastguard Worker number_of_clients: uint64; 111*14675a02SAndroid Build Coastguard Worker minimum_number_of_clients_to_proceed: uint64; 112*14675a02SAndroid Build Coastguard Worker is_r2_async_aggregation_enabled: bool; 113*14675a02SAndroid Build Coastguard Worker} 114*14675a02SAndroid Build Coastguard Worker 115*14675a02SAndroid Build Coastguard Worker// Metric that records the parameters of the SubGraph SecAggServer instance. 116*14675a02SAndroid Build Coastguard Workertable SubGraphServerParameters(tag: "SGSP") { 117*14675a02SAndroid Build Coastguard Worker number_of_clients: uint64; 118*14675a02SAndroid Build Coastguard Worker degree: uint64; 119*14675a02SAndroid Build Coastguard Worker threshold: uint64; 120*14675a02SAndroid Build Coastguard Worker minimum_number_of_clients_to_proceed: uint64; 121*14675a02SAndroid Build Coastguard Worker is_r2_async_aggregation_enabled: bool; 122*14675a02SAndroid Build Coastguard Worker} 123*14675a02SAndroid Build Coastguard Worker 124*14675a02SAndroid Build Coastguard Worker// Span that records the duration of an external abort call to the SecAggServer. 125*14675a02SAndroid Build Coastguard Workertable AbortSecAggServer(tag: "ABSR", span) { 126*14675a02SAndroid Build Coastguard Worker // Reason why the server is being aborted. 127*14675a02SAndroid Build Coastguard Worker reason: string; 128*14675a02SAndroid Build Coastguard Worker} 129*14675a02SAndroid Build Coastguard Worker 130*14675a02SAndroid Build Coastguard Worker// Span that records the duration of an external abort client call. 131*14675a02SAndroid Build Coastguard Workertable AbortSecAggClient(tag: "ABCL", span) { 132*14675a02SAndroid Build Coastguard Worker // Client id that needs to be aborted. 133*14675a02SAndroid Build Coastguard Worker client_id: uint32; 134*14675a02SAndroid Build Coastguard Worker // Reason why the client is being aborted. 135*14675a02SAndroid Build Coastguard Worker reason: string; 136*14675a02SAndroid Build Coastguard Worker} 137*14675a02SAndroid Build Coastguard Worker 138*14675a02SAndroid Build Coastguard Worker// Span that records the duration of an external ProceedToNextRound call. 139*14675a02SAndroid Build Coastguard Workertable ProceedToNextSecAggRound(tag: "PTNR", span) {} 140*14675a02SAndroid Build Coastguard Worker 141*14675a02SAndroid Build Coastguard Worker// Span that records the duration of an external ReceiveMessage call. 142*14675a02SAndroid Build Coastguard Workertable ReceiveSecAggMessage(tag: "RCMS", span) { 143*14675a02SAndroid Build Coastguard Worker // Client id that sent the message. 144*14675a02SAndroid Build Coastguard Worker client_id: uint32; 145*14675a02SAndroid Build Coastguard Worker} 146*14675a02SAndroid Build Coastguard Worker 147*14675a02SAndroid Build Coastguard Worker// Span that records the duration of an external StartPrng call. 148*14675a02SAndroid Build Coastguard Workertable StartPrngForSecAgg(tag: "STPR", span) {} 149*14675a02SAndroid Build Coastguard Worker 150*14675a02SAndroid Build Coastguard Worker// Metrics 151*14675a02SAndroid Build Coastguard Worker// Metric that records the message sent by the SecAgg server to an individual 152*14675a02SAndroid Build Coastguard Worker// user. 153*14675a02SAndroid Build Coastguard Workertable IndividualMessageSent(tag: "IMSG") { 154*14675a02SAndroid Build Coastguard Worker // Client id of the client receiving this message. 155*14675a02SAndroid Build Coastguard Worker client_id: uint32; 156*14675a02SAndroid Build Coastguard Worker // Type of message such as abort etc. 157*14675a02SAndroid Build Coastguard Worker message_type: ServerToClientMessageType; 158*14675a02SAndroid Build Coastguard Worker // Size of the message in bytes. 159*14675a02SAndroid Build Coastguard Worker size: uint64; 160*14675a02SAndroid Build Coastguard Worker} 161*14675a02SAndroid Build Coastguard Worker 162*14675a02SAndroid Build Coastguard Worker// Metric that records the message broadcasted by the SecAgg server. 163*14675a02SAndroid Build Coastguard Workertable BroadcastMessageSent(tag: "BMSG") { 164*14675a02SAndroid Build Coastguard Worker // Type of message such as abort etc. 165*14675a02SAndroid Build Coastguard Worker message_type: ServerToClientMessageType; 166*14675a02SAndroid Build Coastguard Worker // Size of the message in bytes. 167*14675a02SAndroid Build Coastguard Worker size: uint64; 168*14675a02SAndroid Build Coastguard Worker} 169*14675a02SAndroid Build Coastguard Worker 170*14675a02SAndroid Build Coastguard Worker// Metric that records the message received by the SecAgg server from a user. 171*14675a02SAndroid Build Coastguard Workertable ClientMessageReceived(tag: "CMSG") { 172*14675a02SAndroid Build Coastguard Worker // Type of message such as abort etc. 173*14675a02SAndroid Build Coastguard Worker message_type: ClientToServerMessageType; 174*14675a02SAndroid Build Coastguard Worker // Size of the message in bytes. 175*14675a02SAndroid Build Coastguard Worker size: uint64; 176*14675a02SAndroid Build Coastguard Worker // True, if message was expected from the client, false otherwise. 177*14675a02SAndroid Build Coastguard Worker expected: bool; 178*14675a02SAndroid Build Coastguard Worker // Elapsed time since the round started. 0, if the message was not expected. 179*14675a02SAndroid Build Coastguard Worker elapsed_millis: uint64; 180*14675a02SAndroid Build Coastguard Worker} 181*14675a02SAndroid Build Coastguard Worker 182*14675a02SAndroid Build Coastguard Workertable Round2AsyncWorkScheduled(tag: "R2WS") {} 183*14675a02SAndroid Build Coastguard Worker 184*14675a02SAndroid Build Coastguard Worker// Metric that records the event of a queue of round 2 client messages being 185*14675a02SAndroid Build Coastguard Worker// taken by an asynchronous task. 186*14675a02SAndroid Build Coastguard Workertable Round2MessageQueueTaken(tag: "R2MT") { 187*14675a02SAndroid Build Coastguard Worker // Queue length 188*14675a02SAndroid Build Coastguard Worker queue_length: uint64; 189*14675a02SAndroid Build Coastguard Worker} 190*14675a02SAndroid Build Coastguard Worker 191*14675a02SAndroid Build Coastguard Worker// Metric that records the time taken to execute the PRF expansion step. 192*14675a02SAndroid Build Coastguard Workertable PrngExpansion(tag: "PRNG") { 193*14675a02SAndroid Build Coastguard Worker // Time taken to complete the step (in milliseconds). 194*14675a02SAndroid Build Coastguard Worker elapsed_millis: uint64; 195*14675a02SAndroid Build Coastguard Worker} 196*14675a02SAndroid Build Coastguard Worker 197*14675a02SAndroid Build Coastguard Worker// Metric that records the time taken to reconstruct all users' keys from their 198*14675a02SAndroid Build Coastguard Worker// Shamir secret shares. 199*14675a02SAndroid Build Coastguard Workertable ShamirReconstruction(tag: "SHRC") { 200*14675a02SAndroid Build Coastguard Worker // Time taken to complete the step (in milliseconds). 201*14675a02SAndroid Build Coastguard Worker elapsed_millis: uint64; 202*14675a02SAndroid Build Coastguard Worker} 203*14675a02SAndroid Build Coastguard Worker 204*14675a02SAndroid Build Coastguard Worker// Metric that records details about client drops during an execution of the 205*14675a02SAndroid Build Coastguard Worker// SecAgg protocol. 206*14675a02SAndroid Build Coastguard Workertable ClientsDropped(tag: "CLDR") { 207*14675a02SAndroid Build Coastguard Worker // Status of the client when it was aborted. 208*14675a02SAndroid Build Coastguard Worker client_status: TracingClientStatus; 209*14675a02SAndroid Build Coastguard Worker // Reason for abort. 210*14675a02SAndroid Build Coastguard Worker reason: TracingClientDropReason; 211*14675a02SAndroid Build Coastguard Worker // Elapsed time since the round started. 212*14675a02SAndroid Build Coastguard Worker elapsed_millis: uint64; 213*14675a02SAndroid Build Coastguard Worker // Optional error message for the client to be aborted. 214*14675a02SAndroid Build Coastguard Worker message: string; 215*14675a02SAndroid Build Coastguard Worker} 216*14675a02SAndroid Build Coastguard Worker 217*14675a02SAndroid Build Coastguard Worker// Metric that records the outcome of the SecAgg protocol 218*14675a02SAndroid Build Coastguard Workertable SecAggProtocolOutcome(tag: "SAPO") { 219*14675a02SAndroid Build Coastguard Worker // Outcome of the protocol e.g SUCCESS means the protocol ran through all 220*14675a02SAndroid Build Coastguard Worker // phases and completed. 221*14675a02SAndroid Build Coastguard Worker outcome: TracingSecAggServerOutcome; 222*14675a02SAndroid Build Coastguard Worker} 223*14675a02SAndroid Build Coastguard Worker 224*14675a02SAndroid Build Coastguard Worker// Metric that records details about each state of the SecAgg protocol. 225*14675a02SAndroid Build Coastguard Workertable StateCompletion(tag: "ROCP") { 226*14675a02SAndroid Build Coastguard Worker // Current SecAggServerState that the protocol was running within. 227*14675a02SAndroid Build Coastguard Worker state: SecAggServerTraceState; 228*14675a02SAndroid Build Coastguard Worker // True if current state successfully transitioned to the next state, false 229*14675a02SAndroid Build Coastguard Worker // otherwise. 230*14675a02SAndroid Build Coastguard Worker is_success: bool; 231*14675a02SAndroid Build Coastguard Worker // E2E time (in milliseconds) spent in current state, starting from 232*14675a02SAndroid Build Coastguard Worker // transitioning to that state and including waiting for the client messages 233*14675a02SAndroid Build Coastguard Worker // necessary to transition to a next state. 234*14675a02SAndroid Build Coastguard Worker elapsed_millis: uint64; 235*14675a02SAndroid Build Coastguard Worker // Number of clients at the end of current state. 236*14675a02SAndroid Build Coastguard Worker number_of_surviving_clients: uint64; 237*14675a02SAndroid Build Coastguard Worker} 238*14675a02SAndroid Build Coastguard Worker 239*14675a02SAndroid Build Coastguard Workertable ClientCountsPerState(tag: "CLPS") { 240*14675a02SAndroid Build Coastguard Worker // Current SecAggServerState that the protocol was running within. 241*14675a02SAndroid Build Coastguard Worker state: SecAggServerTraceState; 242*14675a02SAndroid Build Coastguard Worker // Client status. 243*14675a02SAndroid Build Coastguard Worker client_status: TracingClientStatus; 244*14675a02SAndroid Build Coastguard Worker // Number of clients corresponding to the status above. 245*14675a02SAndroid Build Coastguard Worker count: uint64; 246*14675a02SAndroid Build Coastguard Worker // Fraction of clients corresponding to client_status above. 247*14675a02SAndroid Build Coastguard Worker fraction: double; 248*14675a02SAndroid Build Coastguard Worker} 249