forked from pflooky/data-caterer
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathkafka-streaming.yaml
More file actions
71 lines (68 loc) · 1.94 KB
/
Copy pathkafka-streaming.yaml
File metadata and controls
71 lines (68 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# yaml-language-server: $schema=../unified-config-schema.json
# Kafka streaming example with load patterns
version: "1.0"
name: "kafka_streaming"
description: "Generate streaming data to Kafka with ramp-up pattern"
config:
flags:
enableGenerateData: true
enableSaveReports: true
runtime:
master: "local[4]"
sparkConfig:
"spark.sql.shuffle.partitions": "4"
dataSources:
- name: "events_kafka"
connection:
type: "kafka"
options:
bootstrapServers: "${KAFKA_BROKERS:-localhost:9092}"
schemaRegistryUrl: "http://localhost:8081"
steps:
- name: "user_events"
options:
topic: "user-events"
count:
duration: "1m"
rate: 100
rateUnit: "second"
pattern:
type: "ramp"
startRate: 10
endRate: 200
rateIncrement: 10
incrementInterval: "10s"
fields:
- name: "event_id"
options:
regex: "EVT[0-9]{16}"
- name: "user_id"
options:
regex: "USR[0-9]{8}"
- name: "event_type"
options:
oneOf:
- "page_view"
- "click"
- "scroll"
- "form_submit"
- name: "timestamp"
type: "timestamp"
- name: "metadata"
type: "struct"
fields:
- name: "user_agent"
options:
expression: "#{Internet.userAgentAny}"
- name: "ip_address"
options:
expression: "#{Internet.ipV4Address}"
- name: "referrer"
options:
expression: "#{Internet.url}"
validations:
- expr: "event_id IS NOT NULL"
- field: "event_type"
validation:
- type: "in"
values: ["page_view", "click", "scroll", "form_submit"]