Skip to content

Commit

Permalink
chore: load in the big dashboard during metrics install (#11007)
Browse files Browse the repository at this point in the history
We now have a `values.tmp.yaml` in the metrics chart. This gets filled
in with the full dashboard json when running an install of the metrics
stack.
  • Loading branch information
just-mitch authored Jan 3, 2025
1 parent 6e94c1a commit f6f2c12
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 332 deletions.
1 change: 1 addition & 0 deletions spartan/metrics/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
values.yaml
4 changes: 4 additions & 0 deletions spartan/metrics/install-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ if helm ls --namespace metrics | grep -q metrics; then
exit 0
fi

# Inject the Aztec Networks dashboard into values.yaml
DASHBOARD_JSON=$(jq -c '.' grafana_dashboards/aztec-dashboard-all-in-one.json)
DASHBOARD_JSON=$DASHBOARD_JSON yq e '.grafana.dashboards.default."aztec-networks".json = strenv(DASHBOARD_JSON)' values.tmp.yaml > values.yaml

helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
Expand Down
3 changes: 3 additions & 0 deletions spartan/metrics/install-prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ set -eu

cd "$(dirname "${BASH_SOURCE[0]}")"

DASHBOARD_JSON=$(jq -c '.' grafana_dashboards/aztec-dashboard-all-in-one.json)
DASHBOARD_JSON=$DASHBOARD_JSON yq e '.grafana.dashboards.default."aztec-networks".json = strenv(DASHBOARD_JSON)' values.tmp.yaml > values.yaml

helm upgrade metrics . -n metrics --values "./values/prod.yaml" --install --create-namespace $@
166 changes: 166 additions & 0 deletions spartan/metrics/values.tmp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
opentelemetry-collector:
mode: deployment

service:
enabled: true

image:
repository: "otel/opentelemetry-collector-contrib"

ports:
otlp-http:
enabled: true
containerPort: 4318
servicePort: 4318
hostPort: 4318
protocol: TCP
otel-metrics:
enabled: true
containerPort: 8888
servicePort: 8888
hostPort: 8888
protocol: TCP
aztec-metrics:
enabled: true
containerPort: 8889
servicePort: 8889
hostPort: 8889
protocol: TCP

presets:
kubernetesAttributes:
enabled: true
config:
extensions:
health_check:
endpoint: ${env:MY_POD_IP}:13133
processors:
resource:
attributes:
- action: preserve
key: k8s.namespace.name
batch: {}
receivers:
otlp:
protocols:
http:
endpoint: ${env:MY_POD_IP}:4318
grpc:
endpoint: ${env:MY_POD_IP}:4317
service:
extensions: [health_check]
telemetry:
metrics:
address: ${env:MY_POD_IP}:8888
pipelines:
logs:
receivers:
- otlp
processors:
- batch
exporters:
- otlphttp/logs
traces:
receivers:
- otlp
processors:
- batch
exporters:
- otlp/tempo
metrics:
receivers:
- otlp
processors:
- batch
exporters:
- prometheus
# - debug

# Enable and configure the Loki subchart
# https://artifacthub.io/packages/helm/grafana/loki
# loki:
# Nothing set here, because we need to use values from the values directory;
# otherwise, things don't get overridden correctly.

# Enable and configure the Tempo subchart
# https://artifacthub.io/packages/helm/grafana/tempo
tempo:
minio:
enabled: true
mode: standalone
rootUser: grafana-tempo
rootPassword: supersecret
buckets:
# Default Tempo storage bucket
- name: tempo-traces
policy: none
purge: false
traces:
otlp:
grpc:
enabled: true
http:
enabled: true
zipkin:
enabled: false
jaeger:
thriftHttp:
enabled: false
opencensus:
enabled: false

prometheus:
server:
global:
evaluation_interval: 15s
scrape_interval: 15s
serverFiles:
prometheus.yml:
scrape_configs:
- job_name: otel-collector
static_configs:
- targets: ["metrics-opentelemetry-collector.metrics:8888"]
- job_name: aztec
static_configs:
- targets: ["metrics-opentelemetry-collector.metrics:8889"]
- job_name: "kube-state-metrics"
static_configs:
- targets:
["metrics-kube-state-metrics.metrics.svc.cluster.local:8080"]

# Enable and configure Grafana
# https://artifacthub.io/packages/helm/grafana/grafana
grafana:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Loki
type: loki
url: http://metrics-loki.metrics:3100
- name: Tempo
type: tempo
url: http://metrics-tempo.metrics:3100
- name: Prometheus
type: prometheus
uid: spartan-metrics-prometheus
isDefault: true
url: http://metrics-prometheus-server.metrics:80
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: "default"
orgId: 1
folder: ""
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
# unfortunately, we can't use the `file` helper here, so we have to inline the dashboard
# json. This is a limitation of Helm.
# See the install scripts: we inject the dashboard json into a copy of this file, which is the
# version that actually gets helm installed.
Loading

0 comments on commit f6f2c12

Please sign in to comment.