Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base docker-compose #2

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ k6

# Dependency directories (remove the comment below to include it)
vendor/

.golangci.yml
50 changes: 50 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: '3.8'

networks:
k6:

services:
prometheus:
image: prom/prometheus:v2.52.0
command:
- --web.enable-remote-write-receiver
- --enable-feature=native-histograms
- --config.file=/etc/prometheus/prometheus.yml
networks:
- k6
ports:
- "9090:9090"

alloy:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a specific reason for using it over the OTLP receiver built-in in Prometheus then it would be good to comment about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really! I also wanted to try alloy, but I could investigate the following PRs using Prometheus. I will merge as is and open the follow-up task.

image: grafana/alloy:v1.0.0
networks:
- k6
volumes:
- ./grafana/alloy:/etc/alloy
environment:
REMOTE_WRITE_HOST: prometheus:9090
depends_on:
- prometheus
command:
- run
- /etc/alloy/config.alloy
- --storage.path=/var/lib/alloy/data
- --server.http.listen-addr=0.0.0.0:12345
- --stability.level=experimental # Enable all functionality
ports:
- "12345:12345" # Alloy UI
- "4317:4317" # gRPC receiver
- "4318:4318" # HTTP receiver

grafana:
image: grafana/grafana:10.1.2
networks:
- k6
ports:
- "3000:3000"
environment:
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_BASIC_ENABLED=false
volumes:
- ./grafana:/etc/grafana/provisioning/
44 changes: 44 additions & 0 deletions grafana/alloy/config.alloy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// expose OTEL receivers
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/
otelcol.receiver.otlp "default" {
// configures the default gRPC receiver endpoint "0.0.0.0:4317"
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/#grpc-block
grpc {}

// configures the default HTTP receiver endpoint "0.0.0.0:4318"
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/#http-block
http {}

output {
metrics = [otelcol.processor.batch.default.input]
}
}

otelcol.processor.batch "default" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.batch/
output {
metrics = [otelcol.exporter.prometheus.default.input]
}
}

otelcol.exporter.prometheus "default" {
add_metric_suffixes = false
forward_to = [prometheus.remote_write.default.receiver]
}

// Collect metrics from the local running Alloy instance and forward to
// Prometheus.
prometheus.exporter.self "alloy" {}
prometheus.scrape "alloy" {
targets = prometheus.exporter.self.alloy.targets
forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write "default" {
endpoint {
url = format(
"http://%s/api/v1/write",
coalesce(env("REMOTE_WRITE_HOST"), "localhost:9090"),
)
}
}
14 changes: 14 additions & 0 deletions grafana/dashboards/dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# For configuration options, see
# https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards

apiVersion: 1

providers:
# We're defining a directory from which to load file-based dashboards
- name: 'prometheus'
type: file
disableDeletion: false
updateIntervalSeconds: 10
editable: true
options:
path: /etc/grafana/provisioning/dashboards
Loading
Loading