-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathalloy-config.river
More file actions
186 lines (154 loc) · 4.16 KB
/
Copy pathalloy-config.river
File metadata and controls
186 lines (154 loc) · 4.16 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
// Grafana Alloy Configuration (River format)
// Unified collector for Logs, Metrics, Traces, and Profiles
// ============================================
// OTLP Receivers (gRPC and HTTP)
// ============================================
otelcol.receiver.otlp "default" {
// gRPC receiver
grpc {
endpoint = "0.0.0.0:4317"
}
// HTTP receiver
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.batch.default.input]
logs = [otelcol.processor.batch.default.input]
traces = [otelcol.processor.batch.default.input]
}
}
// ============================================
// Batch Processor (for performance)
// ============================================
otelcol.processor.batch "default" {
timeout = "5s"
send_batch_size = 1024
output {
metrics = [otelcol.exporter.debug.metrics.input]
logs = [otelcol.exporter.loki.default.input]
traces = [otelcol.exporter.otlp.tempo.input]
}
}
// ============================================
// Resource Processor (add common attributes)
// ============================================
// Removed invalid component otelcol.processor.resource
// ============================================
// Exporters
// ============================================
// Export Logs to Loki
otelcol.exporter.loki "default" {
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://loki:3100/loki/api/v1/push"
}
external_labels = {
cluster = "validatorinfo",
}
}
// Export Metrics to Debug (console output)
otelcol.exporter.debug "metrics" {
verbosity = "detailed"
sampling_initial = 5
sampling_thereafter = 200
}
// Export Traces to Tempo
otelcol.exporter.otlp "tempo" {
client {
endpoint = "tempo:4317"
tls {
insecure = true
}
}
}
// ============================================
// Docker Logs Discovery and Collection
// ============================================
discovery.docker "containers" {
host = "unix:///var/run/docker.sock"
}
loki.source.docker "containers" {
host = "unix:///var/run/docker.sock"
targets = discovery.docker.containers.targets
forward_to = [loki.process.add_labels.receiver]
}
// ============================================
// File-based Logs Collection (for Worker threads)
// ============================================
local.file_match "worker_logs" {
path_targets = [{
__address__ = "localhost",
__path__ = "/app/logs/*.log",
job = "worker-logs",
}]
}
loki.source.file "worker_logs" {
targets = local.file_match.worker_logs.targets
forward_to = [loki.process.worker_json.receiver]
}
// Process worker logs (already in JSON format)
loki.process "worker_json" {
forward_to = [loki.write.default.receiver]
stage.json {
expressions = {
level = "level",
label = "label",
message = "message",
trace_id = "trace_id",
span_id = "span_id",
timestamp = "timestamp",
}
}
stage.labels {
values = {
level = "",
label = "",
trace_id = "",
span_id = "",
}
}
stage.timestamp {
source = "timestamp"
format = "2006-01-02 15:04:05"
}
}
// Process and add labels to Docker logs
loki.process "add_labels" {
forward_to = [loki.write.default.receiver]
stage.json {
expressions = {
level = "level",
service = "service",
trace_id = "trace_id",
span_id = "span_id",
message = "message",
}
}
stage.labels {
values = {
level = "",
service = "",
trace_id = "",
span_id = "",
}
}
}
// ============================================
// Pyroscope Integration
// ============================================
// Profiling data is sent directly from apps to Pyroscope
// No need for Alloy to proxy it
// ============================================
// Metrics Scraping (Self-monitoring)
// ============================================
// Disabled: metrics go to debug exporter instead
// ============================================
// Logging
// ============================================
logging {
level = "info"
format = "json"
}