diff --git a/grafana_agent/config/config.river b/grafana_agent/config/config.river new file mode 100644 index 0000000..8c47cb5 --- /dev/null +++ b/grafana_agent/config/config.river @@ -0,0 +1,36 @@ +logging { + level = "info" + format = "logfmt" +} + +otelcol.receiver.otlp "default" { + http { + endpoint = "0.0.0.0:4318" + metrics_url_path = "/v1/metrics" + } + + output { + metrics = [otelcol.exporter.prometheus.metric.input] + traces = [otelcol.exporter.otlphttp.trace.input] + } +} + +otelcol.exporter.prometheus "metric" { + forward_to = [prometheus.remote_write.metric.receiver] +} + +otelcol.exporter.otlphttp "trace" { + client { + endpoint = "https://grafana.codedang.com/tempo" + tls { + insecure = true + insecure_skip_verify = true + } + } +} + +prometheus.remote_write "metric" { + endpoint { + url = "https://grafana.codedang.com/prometheus/api/v1/write" + } +} diff --git a/grafana_agent/docker-compose.yml b/grafana_agent/docker-compose.yml new file mode 100644 index 0000000..adfb841 --- /dev/null +++ b/grafana_agent/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3' + +services: + # prometheus: + # image: prom/prometheus + # container_name: prometheus + # volumes: + # - ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + # command: + # - '--config.file=/etc/prometheus/prometheus.yml' + # - '--storage.tsdb.path=/prometheus' + # - --web.enable-remote-write-receiver + # ports: + # - 9090:9090 + + agent: + image: grafana/agent:latest + container_name: agent + environment: + - AGENT_MODE=flow + - HOSTNAME=agent + volumes: + - ./config/config.river:/etc/agent/config.river + ports: + - 12345:12345 + - 4318:4318 # OTLP over HTTP receiver + command: run --server.http.listen-addr=0.0.0.0:12345 /etc/agent/config.river + + + # otel-collector: + # image: otel/opentelemetry-collector-contrib:0.67.0 + # container_name: otel-collector + # command: [ "--config=/etc/otelcol/otelcol-config.yml" ] + # volumes: + # - ./config/otelcol/otelcol-config.yml:/etc/otelcol/otelcol-config.yml + # ports: + # - "4317:4317" # OTLP over gRPC receiver + # - "4318:4318" # OTLP over HTTP receiver + # - "8888:8888" # Prometheus metrics exposed by the collector + # - "8889:8889" # Prometheus exporter metrics + + + + # grafana: + # image: grafana/grafana + # container_name: grafana + # ports: + # - 3000:3000 + + + \ No newline at end of file