@@ -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
215215check/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
244249endef
245250
@@ -398,15 +403,17 @@ $(BIN)/helm-docs: Makefile go.mod
398403
399404.PHONY : cve/check
400405cve/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
404409helm/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
408414helm/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
412419goreleaser/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
451461deploy : $(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
478481include Makefile.examples
479482
0 commit comments