-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmodule.river
95 lines (77 loc) · 2.2 KB
/
module.river
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
/********************************************
* ARGUMENTS
********************************************/
argument "stack_name" { }
argument "token" {}
/********************************************
* EXPORTS
********************************************/
export "metrics_receiver" {
value = prometheus.remote_write.default.receiver
}
export "logs_receiver" {
value = loki.write.default.receiver
}
export "traces_receiver" {
value = otelcol.exporter.otlp.default.input
}
export "profiles_receiver" {
value = pyroscope.write.default.receiver
}
export "stack_information" {
value = json_decode(remote.http.config_file.content)
}
/********************************************
* External information
********************************************/
remote.http "config_file" {
url = "https://grafana.com/api/instances/" + argument.stack_name.value
client {
bearer_token = argument.token.value
}
poll_frequency = "24h"
}
/********************************************
* Endpoints
********************************************/
// Metrics
prometheus.remote_write "default" {
endpoint {
url = json_decode(remote.http.config_file.content)["hmInstancePromUrl"] + "/api/prom/push"
basic_auth {
username = json_decode(remote.http.config_file.content)["hmInstancePromId"]
password = argument.token.value
}
}
}
// Logs
loki.write "default" {
endpoint {
url = json_decode(remote.http.config_file.content)["hlInstanceUrl"] + "/loki/api/v1/push"
basic_auth {
username = json_decode(remote.http.config_file.content)["hlInstanceId"]
password = argument.token.value
}
}
}
// Traces
otelcol.auth.basic "default" {
username = json_decode(remote.http.config_file.content)["htInstanceId"]
password = argument.token.value
}
otelcol.exporter.otlp "default" {
client {
endpoint = json_decode(remote.http.config_file.content)["htInstanceUrl"] + ":443"
auth = otelcol.auth.basic.default.handler
}
}
// Profiles
pyroscope.write "default" {
endpoint {
url = json_decode(remote.http.config_file.content)["hpInstanceUrl"]
basic_auth {
username = json_decode(remote.http.config_file.content)["hpInstanceId"]
password = argument.token.value
}
}
}