Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
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
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ COPYRIGHT_YEARS := 2021-2022
LICENSE_IGNORE := -e /testdata/
GO_TEST_FLAGS ?= -v -race -cover

GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
IMAGE_PLATFORM = linux/amd64
BUILDX_ARGS =
GOPRIVATE=github.com/grafana/frostdb
Expand Down Expand Up @@ -88,8 +90,8 @@ go/deps:

.PHONY: go/bin
go/bin:
CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/phlare
CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/profilecli
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/phlare
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/profilecli

.PHONY: go/lint
go/lint: $(BIN)/golangci-lint
Expand Down Expand Up @@ -152,10 +154,12 @@ define deploy
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) $(IMAGE_PREFIX)phlare:$(IMAGE_TAG)
kubectl get pods
$(BIN)/helm upgrade --install $(1) ./operations/phlare/helm/phlare $(2) \
--set phlare.image.tag=$(IMAGE_TAG) --set phlare.image.repository=$(IMAGE_PREFIX)phlare --set phlare.service.port_name=http-metrics
--set phlare.image.tag=$(IMAGE_TAG) --set phlare.image.repository=$(IMAGE_PREFIX)phlare --set phlare.service.port_name=http-metrics \
--set phlare.components.querier.resources=null --set phlare.components.distributor.resources=null --set phlare.components.ingester.resources=null
endef

.PHONY: docker-image/phlare/build
docker-image/phlare/build: GOOS=linux GOARCH=amd64
docker-image/phlare/build: go/bin
$(call docker_buildx,--load)

Expand Down Expand Up @@ -322,6 +326,12 @@ tools/monitoring/environments/default/spec.json: $(BIN)/tk $(BIN)/kind
echo "import 'monitoring.libsonnet'" > tools/monitoring/environments/default/main.jsonnet
$(BIN)/tk env set tools/monitoring/environments/default --server=$(shell $(BIN)/kind get kubeconfig --name phlare-dev | grep server: | sed 's/server://g' | xargs) --namespace=monitoring

.PHONY: deploy-demo
deploy-demo: $(BIN)/kind
docker build -t cp-java-simple:0.1.0 ./tools/docker-compose/java/simple
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) cp-java-simple:0.1.0
kubectl --context="kind-$(KIND_CLUSTER)" apply -f ./tools/kubernetes/java-simple-deployment.yaml

.PHONY: docs/%
docs/%:
$(MAKE) -C docs $*
26 changes: 26 additions & 0 deletions tools/kubernetes/java-simple-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: java-simple-deployment
labels:
app: java-simple
spec:
replicas: 3
selector:
matchLabels:
app: java-simple
template:
metadata:
labels:
app: java-simple
spec:
containers:
- name: java-simple
imagePullPolicy: Never
securityContext:
capabilities:
add:
- CAP_PERFMON
image: cp-java-simple:0.1.0
ports:
- containerPort: 8080
2 changes: 1 addition & 1 deletion tools/monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ By default it install:
- Grafana with plugin, datasources and dashboards.
- An nginx proxy to access all applications.

To access the proxy you just need to port forward using `kubeclt port-forward deployments.apps/nginx -n monitoring 3100:80`.
To access the proxy you just need to port forward using `kubectl port-forward deployments.apps/nginx -n monitoring 3100:80`.

> You can replace 3100 with the local port of your choice
21 changes: 13 additions & 8 deletions tools/monitoring/environments/default/monitoring.libsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local phlare = import './../../../../deploy/jsonnet/phlare-mixin/mixin.libsonnet';
local phlare = import './../../../../operations/phlare/jsonnet/phlare-mixin/phlare-mixin/mixin.libsonnet';
local grafana = import 'grafana/grafana.libsonnet';
local k = import 'ksonnet-util/kausal.libsonnet';
local prom_k_grafana = import 'prometheus-ksonnet/grafana/grafana.libsonnet';
Expand All @@ -10,9 +10,16 @@ prometheus {
_config+:: {
cluster_name: cluster_name,
namespace: 'monitoring',
grafana_ini+: {
sections+: {
feature_toggles+: {
enable: 'flameGraph',
},
},
},
},
_images+:: {
grafana: 'ctovena/grafana:hackathon-1',
grafana: 'grafana/grafana:main',
},
prometheus+::
prometheus.withMixinsConfigmaps($.mixins) + {
Expand All @@ -33,20 +40,18 @@ prometheus {
},
},
mixins+:: {
phlare: phlare {
grafanaPlugins: ['pyroscope-datasource', 'pyroscope-panel'],
},
phlare: phlare {},
},
grafana_datasource_config_map+: k.core.v1.configMap.withDataMixin({
'phlare-datasource.yml': k.util.manifestYaml({
apiVersion: 1,
datasources: [
prom_k_grafana.grafana_datasource(
'phlare',
'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/pyroscope/',
type='pyroscope-datasource'
'http://phlare-micro-services-querier.default.svc.cluster.local.:4100',
type='phlare'
) + grafana.datasource.withJsonData({
path: 'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/pyroscope/',
path: 'http://phlare-micro-services-querier.default.svc.cluster.local.:4100/',
},),
],
}),
Expand Down