-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector.toml
More file actions
187 lines (160 loc) · 5.99 KB
/
vector.toml
File metadata and controls
187 lines (160 loc) · 5.99 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# you should protect this endpoint with
# a http server that can do authentication
# so only your SDK keys are allowed
# we can attach the authorization header to the event
# and use that for routing to the appopriate sink
# this example assumes you are routing only one SDK key to vector and only event schema 4
# other events should be directly proxied to LD
[sources.incoming_ld_events]
type = "http_server"
address = "0.0.0.0:8080"
decoding.codec = "json"
headers = ["authorization", "X-LaunchDarkly-Event-Schema", "X-LaunchDarkly-Payload-ID", "user-agent"]
query_parameters=["d"]
method = "POST"
path="/"
strict_path = false
[transforms.ld_sdk_event_parse]
type = "remap"
inputs = ["incoming_ld_events"]
file="vrl/ld-parse.vrl"
[transforms.ld_sdk_event_route]
type = "route"
inputs = ["ld_sdk_event_parse"]
route.client_side_forward = '.sdkKind == "client-side" && (.kind != "feature" || .inExperiment == true)'
route.mobile_forward = '.sdkKind == "mobile" && (.kind != "feature" || .inExperiment == true)'
route.server_side_forward = '.sdkKind == "server-side" && (.kind != "feature" || .inExperiment == true)'
route.export_from_ld = '.kind != "summary"'
[transforms.ld_sdk_server_side_clean]
type = "remap"
inputs = ["ld_sdk_event_route.server_side_forward"]
file="vrl/ld-clean.vrl"
[transforms.ld_sdk_client_side_clean]
type = "remap"
inputs = ["ld_sdk_event_route.client_side_forward"]
file="vrl/ld-clean.vrl"
[transforms.ld_sdk_mobile_clean]
type = "remap"
inputs = ["ld_sdk_event_route.mobile_forward"]
file="vrl/ld-clean.vrl"
[transforms.ld_sdk_server_side_forward_route]
type = "route"
inputs = ["ld_sdk_server_side_clean"]
route.bulk = '.kind != "diagnostic" && .kind != "diagnostic-init"'
route.diagnostic = '.kind == "diagnostic" || .kind == "diagnostic-init"'
[transforms.ld_sdk_mobile_forward_route]
type = "route"
inputs = ["ld_sdk_mobile_clean"]
route.bulk = '.kind != "diagnostic" && .kind != "diagnostic-init"'
route.diagnostic = '.kind == "diagnostic" || .kind == "diagnostic-init"'
[transforms.ld_sdk_client_side_forward_route]
type = "route"
inputs = ["ld_sdk_client_side_clean"]
route.bulk = '.kind != "diagnostic" && .kind != "diagnostic-init"'
route.diagnostic = '.kind == "diagnostic" || .kind == "diagnostic-init"'
[sinks.ld_server_side_sdk_bulk]
type = "http"
inputs = ["ld_sdk_server_side_forward_route.bulk"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/bulk"
request.headers.authorization = "${LD_SDK_KEY:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 1000
batch.timeout_secs = 5
[sinks.ld_server_side_sdk_diagnostic]
type = "http"
inputs = ["ld_sdk_server_side_forward_route.diagnostic"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/diagnostic"
request.headers.authorization = "${LD_SDK_KEY:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 100
batch.timeout_secs = 5
[sinks.ld_client_side_sdk_bulk]
type = "http"
inputs = ["ld_sdk_client_side_forward_route.bulk"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/bulk/${LD_CLIENT_SIDE_ID:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 1000
batch.timeout_secs = 5
[sinks.ld_client_side_sdk_diagnostic]
type = "http"
inputs = ["ld_sdk_client_side_forward_route.diagnostic"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/diagnostic/${LD_CLIENT_SIDE_ID:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 100
batch.timeout_secs = 5
[sinks.ld_mobile_sdk_bulk]
type = "http"
inputs = ["ld_sdk_mobile_forward_route.bulk"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/bulk"
request.headers.authorization = "${LD_MOBILE_KEY:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 1000
batch.timeout_secs = 5
[sinks.ld_mobile_diagnostic]
type = "http"
inputs = ["ld_sdk_mobile_forward_route.diagnostic"]
encoding.codec = "json"
method = "post"
uri = "https://events.launchdarkly.com/mobile/diagnostic"
request.headers.authorization = "${LD_MOBILE_KEY:?err}"
request.headers.x-launchdarkly-event-schema = "4"
batch.max_events = 100
batch.timeout_secs = 5
[transforms.ld_sdk_events_export]
type = "remap"
inputs = ["ld_sdk_event_route.export_from_ld"]
file="vrl/ld-export.vrl"
[transforms.ld_diagnostic_metric_route]
type = "route"
inputs = ["ld_sdk_events_export"]
route.stream_init = '.kind == "diagnostic" && .isStreamInit == true'
route.diagnostic = '.kind == "diagnostic" && !exists(.isStreamInit)'
[transforms.ld_diagnostic_metrics]
type = "log_to_metric"
inputs = [ "ld_diagnostic_metric_route.diagnostic" ]
[[transforms.ld_diagnostic_metrics.metrics]]
type = "gauge"
field = "deduplicatedUsers"
namespace = "launchdarkly"
[[transforms.ld_diagnostic_metrics.metrics]]
type = "gauge"
field = "droppedEvents"
namespace = "launchdarkly"
[[transforms.ld_diagnostic_metrics.metrics]]
type = "gauge"
field = "eventsInLastBatch"
namespace = "launchdarkly"
[transforms.ld_diagnostic_metrics.metrics.tags]
ldCredential = "{{.ldCredential}}"
ldEventSchema = '{{.ldEventSchema}}'
kind = 'diagnostic'
sdkKind = '{{.sdkKind}}'
[transforms.ld_stream_init_metrics]
type = "log_to_metric"
inputs = [ "ld_diagnostic_metric_route.stream_init" ]
[[transforms.ld_stream_init_metrics.metrics]]
type = "gauge"
field = "durationMillis"
name = "initDurationMs"
namespace = "launchdarkly"
[transforms.ld_stream_init_metrics.metrics.tags]
ldCredential = "{{.ldCredential}}"
failed = "{{.failed}}"
ldEventSchema = '{{.ldEventSchema}}'
sdkKind = '{{.sdkKind}}'
kind = 'diagnostic'
# These are the events we want to send to a data destination
[sinks.out]
inputs = ["ld_diagnostic_metrics","ld_stream_init_metrics", "ld_sdk_events_export"]
type = "console"
encoding.codec = "json"