Skip to content

Commit 3dc6519

Browse files
committed
test some advanced routing
1 parent aaab877 commit 3dc6519

File tree

3 files changed

+288
-24
lines changed

3 files changed

+288
-24
lines changed

test/local/destinations.tf

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
resource "bindplane_destination" "loki" {
2+
rollout = true
3+
name = "example-loki"
4+
type = "loki"
5+
parameters_json = jsonencode(
6+
[
7+
{
8+
"name" : "endpoint",
9+
"value" : "https://loki.corp.net:3100/loki/api/v1/push"
10+
},
11+
{
12+
"name" : "headers",
13+
"value" : {
14+
"token" : "xxx-xxx-xxx"
15+
}
16+
},
17+
{
18+
"name" : "configure_tls",
19+
"value" : true
20+
},
21+
{
22+
"name" : "insecure_skip_verify",
23+
"value" : false
24+
},
25+
{
26+
"name" : "ca_file",
27+
"value" : "/opt/tls/ca.crt"
28+
},
29+
{
30+
"name" : "mutual_tls",
31+
"value" : true
32+
},
33+
{
34+
"name" : "cert_file",
35+
"value" : "/opt/tls/client.crt"
36+
},
37+
{
38+
"name" : "key_file",
39+
"value" : "/opt/tls/client.key"
40+
},
41+
{
42+
"name" : "retry_on_failure_enabled",
43+
"value" : true
44+
},
45+
{
46+
"name" : "retry_on_failure_initial_interval",
47+
"value" : 5
48+
},
49+
{
50+
"name" : "retry_on_failure_max_interval",
51+
"value" : 30
52+
},
53+
{
54+
"name" : "retry_on_failure_max_elapsed_time",
55+
"value" : 300
56+
},
57+
{
58+
"name" : "sending_queue_enabled",
59+
"value" : true
60+
},
61+
{
62+
"name" : "sending_queue_num_consumers",
63+
"value" : 10
64+
},
65+
{
66+
"name" : "sending_queue_queue_size",
67+
"value" : 5000
68+
},
69+
{
70+
"name" : "persistent_queue_enabled",
71+
"value" : true
72+
},
73+
{
74+
"name" : "persistent_queue_directory",
75+
"value" : "$OIQ_OTEL_COLLECTOR_HOME/storage"
76+
}
77+
]
78+
)
79+
}
80+
81+
resource "bindplane_destination" "google" {
82+
rollout = true
83+
name = "example-google"
84+
type = "googlecloud"
85+
parameters_json = jsonencode(
86+
[
87+
{
88+
"name" : "project",
89+
"value" : "my-project"
90+
},
91+
{
92+
"name" : "auth_type",
93+
"value" : "json"
94+
},
95+
{
96+
"name" : "credentials",
97+
"value" : <<EOT
98+
{
99+
"type": "service_account",
100+
"project_id": "redacted",
101+
"private_key_id": "redacted",
102+
"private_key": "redacted",
103+
"client_email": "redacted",
104+
"client_id": "redacted",
105+
"auth_uri": "redacted",
106+
"token_uri": "redacted",
107+
"auth_provider_x509_cert_url": "redacted",
108+
"client_x509_cert_url": "redacted"
109+
}
110+
EOT
111+
},
112+
{
113+
"name" : "credentials_file",
114+
"value" : ""
115+
},
116+
{
117+
"name" : "retry_on_failure_enabled",
118+
"value" : true
119+
},
120+
{
121+
"name" : "retry_on_failure_initial_interval",
122+
"value" : 5
123+
},
124+
{
125+
"name" : "retry_on_failure_max_interval",
126+
"value" : 30
127+
},
128+
{
129+
"name" : "retry_on_failure_max_elapsed_time",
130+
"value" : 300
131+
},
132+
{
133+
"name" : "sending_queue_enabled",
134+
"value" : true
135+
},
136+
{
137+
"name" : "sending_queue_num_consumers",
138+
"value" : 10
139+
},
140+
{
141+
"name" : "sending_queue_queue_size",
142+
"value" : 5000
143+
},
144+
{
145+
"name" : "persistent_queue_enabled",
146+
"value" : true
147+
},
148+
{
149+
"name" : "persistent_queue_directory",
150+
"value" : "$OIQ_OTEL_COLLECTOR_HOME/storage"
151+
},
152+
{
153+
"name" : "enable_compression",
154+
"value" : true
155+
},
156+
{
157+
"name" : "enable_wal",
158+
"value" : true
159+
},
160+
{
161+
"name" : "wal_max_backoff",
162+
"value" : 60
163+
}
164+
]
165+
)
166+
}
167+
168+
resource "bindplane_destination" "datadog" {
169+
rollout = true
170+
name = "example-datadog"
171+
type = "datadog"
172+
parameters_json = jsonencode(
173+
[
174+
{
175+
"name" : "site",
176+
"value" : "US1"
177+
},
178+
{
179+
"name" : "api_key",
180+
"value" : "xxxx-xxxx-xxxx",
181+
},
182+
{
183+
"name" : "retry_on_failure_enabled",
184+
"value" : true
185+
},
186+
{
187+
"name" : "retry_on_failure_initial_interval",
188+
"value" : 5
189+
},
190+
{
191+
"name" : "retry_on_failure_max_interval",
192+
"value" : 30
193+
},
194+
{
195+
"name" : "retry_on_failure_max_elapsed_time",
196+
"value" : 300
197+
},
198+
{
199+
"name" : "sending_queue_enabled",
200+
"value" : true
201+
},
202+
{
203+
"name" : "sending_queue_num_consumers",
204+
"value" : 10
205+
},
206+
{
207+
"name" : "sending_queue_queue_size",
208+
"value" : 5000
209+
},
210+
{
211+
"name" : "persistent_queue_enabled",
212+
"value" : true
213+
},
214+
{
215+
"name" : "persistent_queue_directory",
216+
"value" : "$OIQ_OTEL_COLLECTOR_HOME/storage"
217+
}
218+
]
219+
)
220+
}

test/local/main.tf

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -286,48 +286,72 @@ resource "bindplane_configuration_v2" "configuration" {
286286
create_before_destroy = true
287287
}
288288

289-
measurement_interval = "1m"
290-
291289
rollout = true
292290

293-
rollout_options {
294-
type = "progressive"
295-
parameters {
296-
name = "stages"
297-
value {
298-
labels = {
299-
env = "stage"
300-
}
301-
name = "stage"
302-
}
303-
value {
304-
labels = {
305-
env = "production"
306-
}
307-
name = "production"
308-
}
309-
}
310-
}
311-
312291
name = "my-config-v2"
313292
platform = "linux"
314-
labels = {
315-
environment = "production"
316-
managed-by = "terraform"
293+
294+
source {
295+
name = bindplane_source.otlp.name
296+
route {
297+
id = "0"
298+
telemetry_type = "logs"
299+
components = [
300+
"destinations/${bindplane_destination.datadog.id}"
301+
]
302+
}
303+
route {
304+
id = "1"
305+
telemetry_type = "metrics"
306+
components = [
307+
"destinations/${bindplane_destination.datadog.id}"
308+
]
309+
}
310+
route {
311+
id = "2"
312+
telemetry_type = "traces"
313+
components = [
314+
"destinations/${bindplane_destination.datadog.id}"
315+
]
316+
}
317+
route {
318+
id = "3"
319+
telemetry_type = "logs"
320+
components = [
321+
"destinations/${bindplane_destination.loki.id}"
322+
]
323+
}
317324
}
318325

319326
source {
320327
name = bindplane_source.journald.name
321328
processors = [
322329
bindplane_processor_bundle.bundle.name,
323330
]
331+
324332
route {
325333
id = "0"
326334
telemetry_type = "logs"
327335
components = [
328336
"destinations/${bindplane_destination.custom.id}"
329337
]
330338
}
339+
340+
route {
341+
id = "1"
342+
telemetry_type = "logs"
343+
components = [
344+
"destinations/${bindplane_destination.google.id}"
345+
]
346+
}
347+
348+
route {
349+
id = "2"
350+
telemetry_type = "logs"
351+
components = [
352+
"destinations/${bindplane_destination.loki.id}"
353+
]
354+
}
331355
}
332356

333357
destination {
@@ -341,6 +365,21 @@ resource "bindplane_configuration_v2" "configuration" {
341365
]
342366
}
343367

368+
destination {
369+
route_id = bindplane_destination.google.id
370+
name = bindplane_destination.google.name
371+
}
372+
373+
destination {
374+
route_id = bindplane_destination.loki.id
375+
name = bindplane_destination.loki.name
376+
}
377+
378+
destination {
379+
route_id = bindplane_destination.datadog.id
380+
name = bindplane_destination.datadog.name
381+
}
382+
344383
extensions = [
345384
bindplane_extension.pprof.name
346385
]

test/local/sources.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "bindplane_source" "otlp" {
2+
rollout = true
3+
name = "example-otlp-default"
4+
type = "otlp"
5+
}

0 commit comments

Comments
 (0)