-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathself_hosted.alloy
110 lines (92 loc) · 3.5 KB
/
self_hosted.alloy
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
/*
Module Components: self_hosted_stack
Description: Self Hosted Receiver Provider
*/
declare "self_hosted_stack" {
/***************************************************
* ARGUMENTS
***************************************************/
argument "metrics_endpoint_url" {
comment = "Where to send collected metrics."
optional = true
default = coalesce(env("SELF_HOSTED_METRICS_ENDPOINT_URL"), "http://mimir:8080/api/v1/push")
}
argument "logs_endpoint_url" {
comment = "Where to send collected logs."
optional = true
default = coalesce(env("SELF_HOSTED_LOGS_ENDPOINT_URL"), "http://loki:3100/loki/api/v1/push")
}
argument "traces_endpoint_url" {
comment = "Where to send collected traces."
optional = true
default = coalesce(env("SELF_HOSTED_TRACES_ENDPOINT_URL"), "http://tempo:4318")
}
argument "profiles_endpoint_url" {
comment = "Where to send collected profiles."
optional = true
default = coalesce(env("SELF_HOSTED_PROFILES_ENDPOINT_URL"), "http://pyroscope:4040")
}
/***************************************************
* Setup Receivers
***************************************************/
prometheus.remote_write "self_hosted" {
endpoint {
url = argument.metrics_endpoint_url.value
send_native_histograms = true
basic_auth {
password_file = coalesce(env("SELF_HOSTED_METRICS_BASIC_AUTH_PASSWORD_FILE"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD_FILE"))
password = coalesce(env("SELF_HOSTED_METRICS_BASIC_AUTH_PASSWORD"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD"))
username = coalesce(env("SELF_HOSTED_METRICS_BASIC_AUTH_USERNAME"), env("SELF_HOSTED_BASIC_AUTH_USERNAME"))
}
}
}
loki.write "self_hosted" {
endpoint {
url = argument.logs_endpoint_url.value
basic_auth {
password_file = coalesce(env("SELF_HOSTED_LOGS_BASIC_AUTH_PASSWORD_FILE"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD_FILE"))
password = coalesce(env("SELF_HOSTED_LOGS_BASIC_AUTH_PASSWORD"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD"))
username = coalesce(env("SELF_HOSTED_LOGS_BASIC_AUTH_USERNAME"), env("SELF_HOSTED_BASIC_AUTH_USERNAME"))
}
}
}
otelcol.auth.basic "self_hosted" {
username = coalesce(env("SELF_HOSTED_TRACES_BASIC_AUTH_USERNAME"), env("SELF_HOSTED_BASIC_AUTH_USERNAME"))
password = coalesce(env("SELF_HOSTED_TRACES_BASIC_AUTH_PASSWORD"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD"))
}
otelcol.exporter.otlphttp "self_hosted" {
client {
endpoint = argument.traces_endpoint_url.value
auth = otelcol.auth.basic.self_hosted.handler
tls {
insecure = true
insecure_skip_verify = true
}
}
}
pyroscope.write "self_hosted" {
endpoint {
url = argument.profiles_endpoint_url.value
basic_auth {
password_file = coalesce(env("SELF_HOSTED_PROFILES_BASIC_AUTH_PASSWORD_FILE"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD_FILE"))
password = coalesce(env("SELF_HOSTED_PROFILES_BASIC_AUTH_PASSWORD"), env("SELF_HOSTED_BASIC_AUTH_PASSWORD"))
username = coalesce(env("SELF_HOSTED_PROFILES_BASIC_AUTH_USERNAME"), env("SELF_HOSTED_BASIC_AUTH_USERNAME"))
}
}
}
/***************************************************
* EXPORTS
***************************************************/
export "metrics_receiver" {
value = prometheus.remote_write.self_hosted.receiver
}
export "logs_receiver" {
value = loki.write.self_hosted.receiver
}
export "traces_receiver" {
value = otelcol.exporter.otlphttp.self_hosted.input
}
export "profiles_receiver" {
value = pyroscope.write.self_hosted.receiver
}
}