-
Notifications
You must be signed in to change notification settings - Fork 15
/
agent-cloud.river
79 lines (71 loc) · 1.59 KB
/
agent-cloud.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
// Receive traces
otelcol.receiver.otlp "default" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
traces = [otelcol.processor.batch.default.input]
}
}
otelcol.processor.batch "default" {
output {
metrics = []
logs = []
traces = [
module.git.grafana_cloud.exports.traces_receiver,
]
}
}
// Scrape Metrics
prometheus.scrape "default" {
forward_to = [
module.git.grafana_cloud.exports.metrics_receiver,
]
targets = [
{
"__address__" = env("QUICKPIZZA_HOST"),
"job" = "quickpizza",
"instance" = "local",
},
]
}
discovery.docker "all_containers" {
host = "unix:///var/run/docker.sock"
}
discovery.relabel "quickpizza" {
rule {
target_label = "instance"
source_labels = [
"__meta_docker_container_name",
]
regex ="/(.*)"
action = "replace"
}
rule {
target_label = "job"
source_labels = [
"__meta_docker_container_label_com_docker_compose_project",
]
regex = ".*quickpizza.*"
action = "keep"
}
targets = discovery.docker.all_containers.targets
}
loki.source.docker "default" {
host = "unix:///var/run/docker.sock"
targets = discovery.relabel.quickpizza.output
forward_to = [module.git.grafana_cloud.exports.logs_receiver]
}
module.git "grafana_cloud" {
repository = "https://github.com/grafana/agent-modules.git"
path = "modules/grafana-cloud/autoconfigure/module.river"
revision = "main"
pull_frequency = "0s"
arguments {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
}
}