This commit is contained in:
Roni Dover 2024-04-23 22:23:04 -07:00
parent 1d316f0c1f
commit a6fbee38a6
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,51 @@
//Basic authentication
otelcol.auth.basic "grafana_auth" {
username = env("GRAFANA_CLOUD_INSTANCE_ID")
password = env("GRAFANA_CLOUD_API_TOKEN")
}
// Define the 'Receiver' ingesting the data sent out from our app
otelcol.receiver.otlp "default" {
// configures the default grpc endpoint "0.0.0.0:4317"
grpc { }
// configures the default http/protobuf endpoint "0.0.0.0:4318"
http { }
output {
traces = [otelcol.processor.batch.default.input]
}
}
//The 'processor' optimizes the network throughput by batching the output
otelcol.processor.batch "default" {
output {
traces = [otelcol.exporter.otlp.digma.input,otelcol.exporter.otlphttp.grafana_cloud.input]
}
}
//Our two exporters will send the data both to Digma (to analytize our code observability, and to our Grafana cloud instance
otelcol.exporter.otlp "digma" {
// Send traces to Digma without TLS enabled.
client {
endpoint = env("DIGMA_OTLP_ENDPOINT")
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "grafana_cloud" {
client {
endpoint = env("GRAFANA_CLOUD_OTLP_ENDPOINT")
auth = otelcol.auth.basic.grafana_auth.handler
}
}

View file

@ -0,0 +1,22 @@
version: "3.6"
services:
grafana-agent:
image: grafana/agent:latest
restart: always
command:
- run
- --server.http.listen-addr=0.0.0.0:12345
- /etc/agent/config.river
volumes:
- ./config.river:/etc/agent/config.river
ports:
- "12345:12345"
- "4317:4317"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- AGENT_MODE=flow
- DIGMA_OTLP_ENDPOINT=host.docker.internal:5050
- GRAFANA_CLOUD_OTLP_ENDPOINT=--REPLACE_WITH_ENDPOINT--
- GRAFANA_CLOUD_API_TOKEN=${GRAFANA_CLOUD_API_TOKEN}
- GRAFANA_CLOUD_INSTANCE_ID=--REPLACE_WITH_INSTANCE_ID--