-
Notifications
You must be signed in to change notification settings - Fork 6
/
all-in-one.alloy
100 lines (84 loc) · 3.25 KB
/
all-in-one.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
logging {
level = coalesce(sys.env("ALLOY_LOG_LEVEL"), "warn")
format = "logfmt"
}
/********************************************
* Grafana LGTMP Stack Receiver Provider
********************************************/
// import.git "provider" {
// repository = "https://github.com/qclaogui/codelab-monitoring.git"
// revision = "main"
// path = "alloy-modules/provider"
// pull_frequency = "24h"
// }
// local file
import.file "provider" {
filename = coalesce(sys.env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider"
}
provider.self_hosted_stack "compose" {
metrics_endpoint_url = coalesce(sys.env("SELF_HOSTED_METRICS_ENDPOINT_URL"), "http://gateway:8080/api/v1/push")
logs_endpoint_url = coalesce(sys.env("SELF_HOSTED_LOGS_ENDPOINT_URL"), "http://gateway:3100/loki/api/v1/push")
traces_endpoint_url = coalesce(sys.env("SELF_HOSTED_TRACES_ENDPOINT_URL"), "http://gateway:4318")
profiles_endpoint_url = coalesce(sys.env("SELF_HOSTED_PROFILES_ENDPOINT_URL"), "http://gateway:4040")
}
/********************************************
* Metrics
********************************************/
import.file "metrics" {
filename = coalesce(sys.env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics"
}
metrics.labels_scrape "compose" {
label_prefix = "metrics.grafana.com"
forward_to = [provider.self_hosted_stack.compose.metrics_receiver]
scrape_interval = "15s"
}
metrics.jobs_scrape "compose" {
forward_to = [provider.self_hosted_stack.compose.metrics_receiver]
scrape_interval = "15s"
}
metrics.integrations_scrape "compose" {
forward_to = [provider.self_hosted_stack.compose.metrics_receiver]
scrape_interval = "15s"
}
/********************************************
* Logs
********************************************/
import.file "logs" {
filename = coalesce(sys.env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/logs"
}
logs.labels_scrape "compose" {
label_prefix = "logs.grafana.com"
forward_to = [logs.keep_labels.compose.receiver]
}
// logs Processing And Transformation
logs.keep_labels "compose" {
forward_to = [provider.self_hosted_stack.compose.logs_receiver]
}
/********************************************
* Traces
********************************************/
import.file "traces" {
filename = coalesce(sys.env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/traces"
}
// traces Processing And Transformation process_and_transform
traces.process_and_transform "compose" {
metrics_forward_to = [provider.self_hosted_stack.compose.metrics_receiver]
logs_forward_to = [provider.self_hosted_stack.compose.logs_receiver]
traces_forward_to = [provider.self_hosted_stack.compose.traces_receiver]
}
tracing {
// Write all spans. Don't do this in production!
sampling_fraction = 1
// Forward Alloy internal spans to traces process.
write_to = [traces.process_and_transform.compose.alloy_traces_input]
}
/********************************************
* Profiles
********************************************/
import.file "profiles" {
filename = coalesce(sys.env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/profiles"
}
profiles.labels_scrape "compose" {
label_prefix = "profiles.grafana.com"
forward_to = [provider.self_hosted_stack.compose.profiles_receiver]
}