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