@@ -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
@@ -394,15 +399,17 @@ $(BIN)/helm-docs: Makefile go.mod
394399
395400.PHONY : cve/check
396401cve/check :
397- 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
402+ 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
398403
399404.PHONY : helm/lint
400405helm/lint : $(BIN ) /helm
401- $(BIN ) /helm lint ./operations/pyroscope/helm/pyroscope/
406+ $(BIN ) /helm lint ./operations/pyroscope/helm/pyroscope
407+ $(BIN ) /helm lint ./operations/pyroscope/helm/pyroscope-monitoring
402408
403409.PHONY : helm/docs
404410helm/docs : $(BIN ) /helm-docs
405411 $(BIN ) /helm-docs -c operations/pyroscope/helm/pyroscope
412+ $(BIN ) /helm-docs -c operations/pyroscope/helm/pyroscope-monitoring
406413
407414.PHONY : goreleaser/lint
408415goreleaser/lint : $(BIN ) /goreleaser
@@ -442,6 +449,9 @@ helm/check: $(BIN)/kubeconform $(BIN)/helm
442449 cat operations/pyroscope/helm/pyroscope/values.yaml \
443450 | go run ./tools/yaml-to-json \
444451 > ./operations/pyroscope/jsonnet/values.json
452+ # Generate dashboards and rules
453+ $(BIN ) /helm template pyroscope-monitoring --show-only templates/dashboards.yaml --show-only templates/rules.yaml operations/pyroscope/helm/pyroscope-monitoring \
454+ | go run ./tools/monitoring-chart-extractor
445455
446456.PHONY : deploy
447457deploy : $(BIN ) /kind $(BIN ) /helm docker-image/pyroscope/build
@@ -460,16 +470,9 @@ deploy-micro-services-v1: $(BIN)/kind $(BIN)/helm docker-image/pyroscope/build
460470 $(call deploy,pyroscope-micro-services,$(HELM_FLAGS_V1_MICROSERVICES ) )
461471
462472.PHONY : deploy-monitoring
463- deploy-monitoring : $(BIN ) /tk $(BIN ) /kind tools/monitoring/environments/default/spec.json
464- kubectl --context=" kind-$( KIND_CLUSTER) " create namespace monitoring --dry-run=client -o yaml | kubectl --context=" kind-$( KIND_CLUSTER) " apply -f -
465- $(BIN ) /tk apply tools/monitoring/environments/default/main.jsonnet
466-
467- .PHONY : tools/monitoring/environments/default/spec.json # This is a phony target for now as the cluster might be not already created.
468- tools/monitoring/environments/default/spec.json : $(BIN ) /tk $(BIN ) /kind
473+ deploy-monitoring : $(BIN ) /kind $(BIN ) /helm
469474 $(BIN ) /kind export kubeconfig --name $(KIND_CLUSTER ) || $(BIN ) /kind create cluster --name $(KIND_CLUSTER )
470- pushd tools/monitoring/ && rm -Rf vendor/ lib/ environments/default/spec.json && PATH=$(BIN ) :$(PATH ) $(BIN ) /tk init -f
471- echo " import 'monitoring.libsonnet'" > tools/monitoring/environments/default/main.jsonnet
472- $(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
475+ $(BIN ) /helm upgrade --install pyroscope-monitoring ./operations/pyroscope/helm/pyroscope-monitoring
473476
474477include Makefile.examples
475478
0 commit comments