Skip to content

Commit 66f06cd

Browse files
authored
feat: Add pyroscope-monitoring helm chart (#4525)
* feat: Add pyroscope-monitoring helm This contains a fully fledged observability deployment for Pyroscope OSS monitoring Over time I would like to consolidate our internal dashboards and alerts into this helm chart. This also allows us to test/debug Pyroscope OSS in a local kind deployment. * Update README.md as proposed by reviews
1 parent 977396b commit 66f06cd

File tree

911 files changed

+37894
-115059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

911 files changed

+37894
-115059
lines changed

Makefile

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fmt: $(BIN)/golangci-lint $(BIN)/buf $(BIN)/tk ## Automatically fix some lint er
209209
$(BIN)/golangci-lint run --fix
210210
cd api/ && $(BIN)/buf format -w .
211211
cd pkg && $(BIN)/buf format -w .
212-
$(BIN)/tk fmt ./operations/pyroscope/jsonnet/ tools/monitoring/
212+
$(BIN)/tk fmt ./operations/pyroscope/jsonnet/
213213

214214
.PHONY: check/unstaged-changes
215215
check/unstaged-changes:
@@ -236,10 +236,15 @@ define deploy
236236
--set pyroscope.image.repository=$(IMAGE_PREFIX)pyroscope \
237237
--set pyroscope.podAnnotations.image-digest=$(shell cat .docker-image-digest-pyroscope) \
238238
--set pyroscope.service.port_name=http-metrics \
239-
--set pyroscope.podAnnotations."profiles\.grafana\.com\/memory\.port_name"=http-metrics \
240-
--set pyroscope.podAnnotations."profiles\.grafana\.com\/cpu\.port_name"=http-metrics \
241-
--set pyroscope.podAnnotations."profiles\.grafana\.com\/goroutine\.port_name"=http-metrics \
242-
--set pyroscope.extraEnvVars.JAEGER_AGENT_HOST=jaeger.monitoring.svc.cluster.local. \
239+
--set-string pyroscope.podAnnotations."profiles\.grafana\.com/memory\.port_name"=http-metrics \
240+
--set-string pyroscope.podAnnotations."profiles\.grafana\.com/cpu\.port_name"=http-metrics \
241+
--set-string pyroscope.podAnnotations."profiles\.grafana\.com/goroutine\.port_name"=http-metrics \
242+
--set-string pyroscope.podAnnotations."k8s\.grafana\.com/scrape"=true \
243+
--set-string pyroscope.podAnnotations."k8s\.grafana\.com/metrics\.portName"=http-metrics \
244+
--set-string pyroscope.podAnnotations."k8s\.grafana\.com/metrics\.scrapeInterval"=15s \
245+
--set-string pyroscope.extraEnvVars.JAEGER_AGENT_HOST=pyroscope-monitoring-alloy-receiver \
246+
--set pyroscope.extraEnvVars.JAEGER_SAMPLER_TYPE=const \
247+
--set pyroscope.extraEnvVars.JAEGER_SAMPLER_PARAM=1 \
243248
--set pyroscope.extraArgs."pyroscopedb\.max-block-duration"=5m
244249
endef
245250

@@ -398,15 +403,17 @@ $(BIN)/helm-docs: Makefile go.mod
398403

399404
.PHONY: cve/check
400405
cve/check:
401-
docker run -t -i --rm --volume "$(CURDIR)/:/repo" -u "$(shell id -u)" aquasec/trivy:0.45.1 filesystem --cache-dir /repo/.cache/trivy --scanners vuln --skip-dirs .tmp/ --skip-dirs node_modules/ --skip-dirs tools/monitoring/vendor/ /repo
406+
docker run -t -i --rm --volume "$(CURDIR)/:/repo" -u "$(shell id -u)" aquasec/trivy:0.45.1 filesystem --cache-dir /repo/.cache/trivy --scanners vuln --skip-dirs .tmp/ --skip-dirs node_modules/ /repo
402407

403408
.PHONY: helm/lint
404409
helm/lint: $(BIN)/helm
405-
$(BIN)/helm lint ./operations/pyroscope/helm/pyroscope/
410+
$(BIN)/helm lint ./operations/pyroscope/helm/pyroscope
411+
$(BIN)/helm lint ./operations/pyroscope/helm/pyroscope-monitoring
406412

407413
.PHONY: helm/docs
408414
helm/docs: $(BIN)/helm-docs
409415
$(BIN)/helm-docs -c operations/pyroscope/helm/pyroscope
416+
$(BIN)/helm-docs -c operations/pyroscope/helm/pyroscope-monitoring
410417

411418
.PHONY: goreleaser/lint
412419
goreleaser/lint: $(BIN)/goreleaser
@@ -446,6 +453,9 @@ helm/check: $(BIN)/kubeconform $(BIN)/helm
446453
cat operations/pyroscope/helm/pyroscope/values.yaml \
447454
| go run ./tools/yaml-to-json \
448455
> ./operations/pyroscope/jsonnet/values.json
456+
# Generate dashboards and rules
457+
$(BIN)/helm template pyroscope-monitoring --show-only templates/dashboards.yaml --show-only templates/rules.yaml operations/pyroscope/helm/pyroscope-monitoring \
458+
| go run ./tools/monitoring-chart-extractor
449459

450460
.PHONY: deploy
451461
deploy: $(BIN)/kind $(BIN)/helm docker-image/pyroscope/build
@@ -464,16 +474,9 @@ deploy-micro-services-v1: $(BIN)/kind $(BIN)/helm docker-image/pyroscope/build
464474
$(call deploy,pyroscope-micro-services,$(HELM_FLAGS_V1_MICROSERVICES))
465475

466476
.PHONY: deploy-monitoring
467-
deploy-monitoring: $(BIN)/tk $(BIN)/kind tools/monitoring/environments/default/spec.json
468-
kubectl --context="kind-$(KIND_CLUSTER)" create namespace monitoring --dry-run=client -o yaml | kubectl --context="kind-$(KIND_CLUSTER)" apply -f -
469-
$(BIN)/tk apply tools/monitoring/environments/default/main.jsonnet
470-
471-
.PHONY: tools/monitoring/environments/default/spec.json # This is a phony target for now as the cluster might be not already created.
472-
tools/monitoring/environments/default/spec.json: $(BIN)/tk $(BIN)/kind
477+
deploy-monitoring: $(BIN)/kind $(BIN)/helm
473478
$(BIN)/kind export kubeconfig --name $(KIND_CLUSTER) || $(BIN)/kind create cluster --name $(KIND_CLUSTER)
474-
pushd tools/monitoring/ && rm -Rf vendor/ lib/ environments/default/spec.json && PATH=$(BIN):$(PATH) $(BIN)/tk init -f
475-
echo "import 'monitoring.libsonnet'" > tools/monitoring/environments/default/main.jsonnet
476-
$(BIN)/tk env set tools/monitoring/environments/default --server=$(shell $(BIN)/kind get kubeconfig --name pyroscope-dev | grep server: | sed 's/server://g' | xargs) --namespace=monitoring
479+
$(BIN)/helm upgrade --install pyroscope-monitoring ./operations/pyroscope/helm/pyroscope-monitoring
477480

478481
include Makefile.examples
479482

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ require (
8686
go.uber.org/atomic v1.11.0
8787
go.uber.org/automaxprocs v1.6.0
8888
go.uber.org/goleak v1.3.0
89+
go.yaml.in/yaml/v3 v3.0.4
8990
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8
9091
golang.org/x/mod v0.28.0
9192
golang.org/x/net v0.46.0
@@ -106,7 +107,6 @@ require (
106107
require (
107108
github.com/Masterminds/semver/v3 v3.4.0 // indirect
108109
go.yaml.in/yaml/v2 v2.4.2 // indirect
109-
go.yaml.in/yaml/v3 v3.0.4 // indirect
110110
)
111111

112112
require (

0 commit comments

Comments
 (0)