Debian Codegraph @

tests/integration/schema_registry/data/proto/metadata_proto.proto

raw
1 syntax = "proto3";
2
3 package Criteo.Glup;
4 option java_package = "com.criteo.glup";
5
6 /**
7 * GLUP messages SHALL:
8 * - Have an Origin field with id 1.
9 * - Have an Partition field with id 2.
10 * - Not use id 3 and 4.
11 * - Have an ControlMessage field with id 2097151.
12 * You can create a new one by copying BaseGlupMessage and adding your
13 * own fields.
14 */
15
16 import "google/protobuf/descriptor.proto";
17
18 // It holds the kafka topic name
19 message KafkaMessageOptions {
20 repeated string topic = 1;
21 }
22
23
24 // It describes the currently supported partitioning scheme
25 enum PartitionScheme {
26 UNSUPPORTED_PARTITION_SCHEME = 0;
27 DAILY = 2; /* Deprecated, use PLATFORM_HOURLY instead */
28 HOURLY = 3;
29 PLATFORM_HOURLY = 4;
30 EVENTTYPE_PLATFORM_HOURLY = 5;
31 }
32
33 enum MessageFormat {
34 UNSUPPORTED_FORMAT = 0;
35 JSON = 1;
36 PROTOBUF = 2;
37 }
38
39 // It describes the currently supported data on HDFS, usually partitioned in PAIL files
40 enum HDFSDataFormat {
41 UNSUPPORTED_DATA_FORMAT = 0;
42 JSON_PAIL = 2;
43 PROTOBUF_SEQ = 3;
44 PROTOBUF_PARQUET = 4;
45 }
46
47 enum DataSetKind {
48 UNSUPPORTED_KIND = 0;
49 TIMESERIES = 1;
50 }
51
52 enum MonitoringLevel {
53 DEFAULT = 0;
54 REMOVE_MONITORING = 1; // consensus and last_run monitoring will be skipped
55 INFORMATIVE_MONITORING = 2; // No page for consensus or last_run monitoring
56 CONSENSUS_IGNORED = 3; // consensus monitoring will be skip but last_run will be monitored (can page)
57 CONSENSUS_IGNORED_AND_INFORMATIVE_MONITORING = 4; // consensus monitoring will be skip and last_run will be monitored as informative (no page)
58 }
59
60 // Defines a data set with its underlying available formats
61 message DataSet {
62 // A uniq identifier for this dataset.
63 // This string must be lowercase and only contain alphanumerical characters
64 // or underscores.
65 string id = 1;
66 // A set of formats available for this dataset.
67 repeated DataSetFormat format = 2;
68 // Partition scheme used to store data inside the path.
69 PartitionScheme partition_scheme = 3;
70 // (Mandatory) This should be java class which will represent the dataset's schema.
71 string java_class = 4;
72 // is this dataset a unit test dataset
73 bool for_tests = 5;
74 // owner of this dataset
75 string owner = 6;
76 // is this dataset private
77 bool private = 7;
78 // kind of dataset
79 DataSetKind kind = 8;
80 // retention period (in days)
81 int32 retention_days = 9;
82 }
83
84 // Defines a set of dataset partitions
85 message DataSetChunk {
86 repeated Partition partition = 1;
87 DataSetFormat format = 2;
88 string datasetId = 3;
89 }
90
91 // Defines a dataset format.
92 message DataSetFormat {
93 reserved 6; // used to be the flag 'prefered_format'
94
95 // Location of the data.
96 string path = 1;
97 // File format used to store records.
98 HDFSDataFormat file_format = 2;
99 // Partition scheme used to store data inside the path.
100 PartitionScheme partition_scheme = 3;
101 // The minimum defined partition for this format inclusive.
102 HDFSPartition start_partition = 4;
103 // The maximum defined partition for this format exclusive.
104 HDFSPartition end_partition = 5;
105 // Retention in days
106 int32 retention_days = 7;
107 // Priority, bigger number means higher priority, 0 as the lowest, used to decide which format to use when several are available.
108 int32 priority = 8;
109 // Label, should be unique across all formats in a same dataset.
110 string label = 9;
111 //Monitoring level, if not set DEFAULT will be applied
112 MonitoringLevel monitoring_level = 10;
113 }
114
115
116 message HDFSOptions {
117 message ImportOptions {
118 message View {
119 // Defines a table view of a surrounding hdfs import into hive.
120 // All other settings (owner, namespace, name) are already
121 // in the surrounding block.
122 message HiveOptions {
123 /*
124 The database will be glup
125 The table name will be:
126 - PROD:
127 glup_${name} prod data
128 - PREPROD:
129 - sync: glup_${name} copy of [sampled] prod data
130 - others: glup_${name}_preprod preprod data
131 */
132 // if not provided it will default to the glup partition_scheme
133 PartitionScheme partitioning = 3;
134 }
135
136 // define table mapping in hive
137 HiveOptions hive = 10;
138
139 // Add here new view of data in HDFS
140 }
141 message Generator {
142 message DedupOptions {
143 // Name of input dataset to deduplicate
144 string input_dataset_id = 1;
145 // Label of input format
146 string input_format_label = 2;
147 // Name of output dataset to deduplicate
148 string output_dataset_id = 3;
149 // Label of output format
150 string output_format_label = 4;
151 // Generate the conf for the cuttle job and not for the legacy lobster job
152 // Check RIVERS-3614 for details
153 // TODO : remove this property when lobster job will be fully decomissioned
154 bool use_hippo_cuttle_job = 5;
155 }
156
157 message Kafka2HdfsOptions {
158 reserved 2; // deprecated: enable per-datacenter import:
159 // settings specific to kafka2hdfs
160 string topic = 1;
161 // should the output be deduplicated
162 bool deduplicate = 3;
163 // Name of the dataset import will produce
164 string output_dataset_id = 4;
165 // Label of output format
166 string output_format_label = 5;
167 }
168
169 message KacohaConfig {
170 // How many partitions per task
171 int32 partitions_per_task = 1;
172 // The size of the poll buffer used in KaCoHa
173 int32 poll_buffer_size_bytes = 2;
174 }
175
176 message KacohaConfigPerDc {
177 // The Data center to which this config applies
178 DataCenter dc = 1;
179 // The configuration for this data center
180 KacohaConfig config = 2;
181 }
182
183 message KaCoHaOptions {
184 // settings specific to KaCoHa
185 string topic = 1;
186 // Name of the dataset import will produce
187 string output_dataset_id = 2;
188 // Deduplicate dataset in the consolidation
189 bool deduplicate = 3;
190 // Common configs for all data centers
191 KacohaConfig config = 4;
192 // Label of output format
193 string output_format_label = 5;
194 // Override specific configs for each data center
195 repeated KacohaConfigPerDc config_per_dc = 6;
196 }
197
198 message DataloaderOptions {
199 // settings specific to dataloader
200 // If no platform is defined, it will default to all platforms
201 repeated Platform platform = 1;
202 }
203
204 message SyncOptions {
205 // defines the source of the sync
206 Location from = 1;
207 // The default is glup
208 string source_namespace = 3;
209 // string start_date = 4; // REMOVED because duplicates generator.start_date
210 // string stop_date = 5; // REMOVED because duplicates generator.stop_date
211 // default is all platforms.
212 repeated Platform platforms = 6;
213 // define if sync is a backfilling (from now to oldest partitions
214 bool is_backfilling = 8;
215 // define where data will be sync'ed, based on dataset_id and label
216 string to_label = 9;
217 // define where data will be sync'ed, based on dataset_id and label
218 string to_dataset_id = 10;
219 // define backfilling in addition to sync at the same time
220 bool with_backfilling = 11;
221 // defines whether should we schedule generator on to or from location
222 bool is_scheduled_on_source = 12;
223 }
224
225 message BackupOptions {
226 // defines the source of the sync
227 Location from = 1;
228 // The default is glup
229 string source_namespace = 2;
230 // default is all platforms.
231 repeated Platform platforms = 3;
232 }
233
234 // Defines how to transcode data from one format to an other
235 message TranscodingOptions {
236 // id of the source data set
237 string input_dataset_id = 1;
238 // id of the target data set, it can be the same as the source
239 string output_dataset_id = 2;
240 // format of the source data set
241 HDFSDataFormat input_format = 3;
242 // format of the target data set
243 HDFSDataFormat output_format = 4;
244 // input format label
245 string input_dataset_label = 5;
246 // output format label
247 string output_dataset_label = 6;
248 // transcoding job should work by platform
249 bool is_by_platform = 7;
250 }
251
252 message SamplerOptions {
253 // Name of input dataset to sample
254 string input_dataset_id = 1;
255 // Label of input format
256 string input_format_label = 2;
257 // Name of output dataset to sample
258 string output_dataset_id = 3;
259 // Label of output format
260 string output_format_label = 4;
261 // Sampling rate between 0 and 1
262 float sampling_rate = 5;
263 }
264
265 // Used by the DataComparator
266 // NB: comparision is symmetric, left and right are just name and
267 // do not refer to join strategy
268 message ComparatorOptions {
269 // The first data set to compare
270 string left_dataset_id = 1;
271 // The specific format of the first data set
272 string left_format_label = 2;
273 // The second data set to compare
274 string right_dataset_id = 3;
275 // The specific format of the second data set
276 string right_format_label = 4;
277 // If set, filtering left and right dataset to a specific hostname.
278 // Please note hostname must be resolvable to be able to get the ip (example : web-rtb254-par.par.ad.criteo.prod)
279 string hostname = 5;
280 // If set, fields ignored in the comparison separated by ','
281 string ignored_fields = 6;
282 }
283
284 message ExternalOptions {
285 }
286
287 // oneof is not currently supporte by protonet
288 DataloaderOptions dataloader = 1;
289 Kafka2HdfsOptions kafka2hdfs = 2;
290 SyncOptions sync = 3;
291 ExternalOptions external = 4;
292 BackupOptions backup = 5;
293 TranscodingOptions transcoding = 6;
294 KaCoHaOptions kacoha = 7;
295 DedupOptions deduplicate = 8;
296 SamplerOptions sampler = 9;
297 ComparatorOptions comparator = 10;
298 // Add here any new hdfs producer
299
300 // defines where it will run and push data
301 repeated Location to = 250;
302 string namespace = 251;
303
304 // define beginning date inclusive
305 string start_date = 253;
306 // define stop date exclusive
307 string stop_date = 254;
308
309 // TODO : remove this property when RIVERS-3723 (remove CN platform) is over
310 bool ignore_cn = 255;
311 }
312
313
314 // location on hdfs
315 string owner = 1;
316 string name = 2;
317 PartitionScheme partitioning = 4;
318 HDFSDataFormat format = 5;
319 // if set to true, imported data won't be readable from other users
320 // (permission o-rwx)
321 bool private = 6;
322
323 repeated Generator generator = 11;
324 repeated View view = 12;
325 }
326
327 repeated ImportOptions import = 3;
328 }
329
330 /* Describes the producers to use when emitting a Glup
331 * If the producer is not set or is set to false, then the producer is not used
332 */
333 message ProducerTransportOptions {
334 // send glup through syslog. Deprecated, do not use for new glup
335 bool syslog = 1;
336 // send glup through kafka
337 bool kafka = 2;
338 }
339
340 /* Describes additional glup properties
341 * It is used to help selecting the most appropriate pipeline configuration when sending a glup
342 */
343 message PropertyOptions {
344 // can be used to provide a different QoS for important glups
345 bool valuable = 1;
346 // can be used to select suitable instances capable of handling a high volume of glups
347 bool high_volume = 2;
348 }
349
350 message GlupOptions {
351 // kafka settings
352 KafkaMessageOptions kafka = 1;
353 // hdfs import settings
354 HDFSOptions hdfs = 2;
355 // field samplimg rate
356 uint32 sampling_pct = 3;
357 // preprod message sampling rate
358 uint32 preprod_sampling_pct = 4;
359 // dataset definition
360 repeated DataSet dataset = 5;
361 // message sampling rate
362 uint32 message_sampling_pct = 6;
363 // producer(s) to use
364 ProducerTransportOptions producers = 7;
365 // additional glup properties
366 PropertyOptions properties = 8;
367 }
368
369 // Internal extensions uses 50000 to 99999
370 // https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L267
371 extend google.protobuf.MessageOptions {
372 GlupOptions glup = 50000;
373 // Does message contains nullable field. This will be subject to special generation that will allow
374 // to know if a specific field in the corresponding message or sub-message has been set or not.
375 bool contains_nullable_fields = 50001;
376 }
377
378 /* It describes glup fields options:
379 disabled_platform => list of platform where the field will never be sent
380 */
381 message GlupFieldOptions {
382 bool sampled = 1;
383 bool sampling_key = 2;
384 repeated Platform disabled_platform = 3;
385 bool should_clean_pii = 4;
386
387 // The next fields are part of the Try&Wipe hackathon 2018 project:
388 // When true, this field can not be used by GLUP consumers anymore
389 bool pending_deletion = 5;
390 // Date at which the field has been added to the schema.
391 string added_at = 6;
392 }
393
394 // Internal extensions uses 50000 to 99999
395 // https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L267
396 extend google.protobuf.FieldOptions {
397 GlupFieldOptions glupfield = 50000;
398 }
399
400
401 // This option is used when exposing a message to hive
402 message JsonMapping {
403 string name = 1; // alias to use for json serialization
404 bool skip = 2; // do we have to skip this field from json serialization
405 }
406
407 // This option is used by the transcoder
408 // Note that both options could be merged, see RIVERS-1894
409 message JsonAlias {
410 // alias for json serialization
411 string name = 1;
412 // When the field type is an enum in protobuf, the value of this field in
413 // json is the id of the field of the enum (an integer value) rather
414 // than its name.
415 bool use_enum_field_id = 3;
416 }
417
418
419 // Internal extensions uses 50000 to 99999
420 // https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L267
421 extend google.protobuf.FieldOptions {
422 JsonMapping json_mapping = 50001; // add JsonProxy extension
423 JsonAlias json = 50002; // add JsonAlias extension
424 }
425
426
427
428
429 /* It is safe to read any GLUP message as a BaseGlupMessage */
430 message BaseGlupMessage {
431 option (contains_nullable_fields) = true;
432 Origin glup_origin = 1;
433 Partition partition = 2;
434 // ID 3 is reserved, ask rivers-team@ first.
435 // ID 4 is reserved, ask rivers-team@ first.
436 map<int32, bool> set_fields = 50010; // nullable tracking special field
437 repeated ControlMessage.Watermark control_message = 2097151 [ (json).name = "__metadata" ]; // standard glup field
438 }
439
440 /* Message to be used for forward watermarks in KaCoHa */
441 message ForwardedWatermarkMessage {
442 int64 original_kafka_offset = 5; //Where it was taken
443 int64 timestamp = 6; //When message was created
444 bool consolidation_enabled = 7; //True to update consensus in consolidation folder, false for consensus in dataset folder
445 string dataset_id = 10; //DatasetId that we should process
446 string dataset_format_label = 11; // Exact format that we're processing (when overriding the default format)
447 repeated ControlMessage.Watermark control_message = 2097151 [ (json).name = "__metadata" ]; // original watermark
448 }
449
450
451
452 /* Describes the emitter of a message. */
453 enum DataCenter {
454 // If a MARS datacenter gets added, code built before that will see
455 // UNSUPPORTED_DATACENTER as the value.
456 // Never emit the actual value of UNSUPPORTED_DATACENTER.
457 UNSUPPORTED_DATACENTER = 0;
458 AM5 = 2;
459 HK5 = 3;
460 NY8 = 4;
461 PAR = 5;
462 PA4 = 6;
463 SH5 = 7;
464 SV6 = 8;
465 TY5 = 9;
466 VA1 = 10;
467 AM6 = 11;
468 DA1 = 12;
469 }
470
471 enum Environment {
472 UNSUPPORTED_ENVIRONMENT = 0;
473 PREPROD = 1;
474 PROD = 2;
475 }
476
477 message Location {
478 Environment env = 1;
479 DataCenter dc = 2;
480 // label, associated with dataset_id (both required) is used to override source path of data
481 string label = 3;
482 // label, associated with dataset_id (both required) is used to override source path of data
483 string dataset_id = 4;
484 }
485
486
487 /* Identifies the emitter of a message. */
488 message Origin {
489 // DataCenter of the emitting server.
490 DataCenter datacenter = 1;
491 // Mandatory for TLAs and chef-deployed producers.
492 // IP v4 adresses in netork byte order
493 fixed32 ip4 = 2 [ (json_mapping).name = "host_ip" ];
494 // Mandatory for TLAs and chef-deployed producers.
495 string hostname = 3;
496 // Mandatory on container environment.
497 string container_task = 4 [ (json_mapping).skip = true ];
498 string container_app = 5 [ (json_mapping).skip = true ];
499 }
500
501
502 /* For use by infrastructure teams. */
503 message ControlMessage {
504 enum Cluster {
505 UNSUPPORTED_CLUSTER = 0;
506 LOCAL = 2;
507 CENTRAL = 3;
508 STREAM = 4;
509 }
510 message WatermarkOrigin {
511 string kafka_topic = 1;
512 DataCenter datacenter = 2;
513 Cluster cluster = 3;
514 }
515 message Watermark {
516 option (contains_nullable_fields) = true;
517 string type = 1; // backward compatibility watermark type
518 string hostname = 2; // hostname of sender
519 string kafka_topic = 3; // topic concerned
520 int32 partition = 4; // partition id
521 int32 partition_count = 5; // partition count
522 bytes process_uuid = 6; // process uuid of sender
523 string region = 7; // region of sender
524 int32 timestamp_seconds = 8 [ (json).name = "timestamp" ]; // timestamp in second
525 string cluster = 9; // cluster
526 string environment = 10; // prod or preprod
527 map<int32, bool> set_fields = 50010; // nullable map to track set fields
528 }
529 Watermark watermark = 1;
530 }
531
532
533 /* Used in HourlyPlatformPartition to describe where should the message go on HDFS. */
534 enum Platform {
535 // If a MARS platform gets added, code built before that will see
536 // UNSUPPORTED_PLATFORM as the value.
537 // Never emit the actual value of UNSUPPORTED_PLATFORM.
538 UNSUPPORTED_PLATFORM = 0;
539 EU = 2;
540 US = 3;
541 AS = 4;
542 CN = 5;
543 }
544
545 enum EventType {
546 UNSUPPORTED_EVENT_TYPE = 0;
547 ItemPageView = 2;
548 Sales = 3;
549 Basket = 4;
550 Other = 5;
551 }
552
553 /* Describes where messages should go on HDFS.
554 * This information is carried by all glup message.
555 */
556 message Partition {
557 // Unix timestamp in seconds
558 uint64 timestamp_seconds = 1 [ (json_mapping).name = "timestamp" ];
559 Platform host_platform = 2;
560 EventType event_type = 3 [ (json_mapping).skip = true ];
561 /* Other partition keys... */
562 }
563
564 /* Internaly used by datadiscovery framework to handlde
565 * datadiscovery path and datadisco filesystem
566 */
567 message HDFSPartition {
568 // Unix timestamp in seconds
569 uint64 timestamp_seconds = 1;
570 Platform host_platform = 2;
571 EventType event_type = 3;
572 // Define the depth of a partition. This is used in order to distinguished partition
573 // membership within a parent partition:
574 // 2017-02-01/12/EU with depth 3 is a parent partition of 2017-02-01/12 with depth 2
575 int32 depth = 4;
576 }
577
578 /* Three-state boolean to use when willing to express the absence of
579 * information for a field. */
580 enum YesNo {
581 UNKNOWN = 0;
582 NO = 1;
583 YES = 2;
584 }
585
586 /* 128bit hash to pass publisher information through the request URL */
587 message Hash128 {
588 fixed64 most_sig_bits = 1; // most significant bits
589 fixed64 least_sig_bits = 2; // least significant bits
590 map<int32, bool> set_fields = 50010; // nullable map to track set fields
591 }