Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: metrics #41

Merged
merged 4 commits into from
Aug 21, 2024
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
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions helm/promtail-aggregator/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: promtail
repository: https://grafana.github.io/helm-charts
version: 6.16.4
digest: sha256:3e3b0f2a90cda3d817319d7f3fa5918e1f44a3caefec5e4c5d2efae9a5327b50
generated: "2024-08-21T11:44:32.689749951-07:00"
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: v2
name: promtail
description: Helm chart for Grafana Promtail
type: application
appVersion: 0.1.0
version: 0.1.0
appVersion: 0.2.0
version: 0.2.0
dependencies:
- name: promtail
alias: promtail
version: 6.7.2
version: 6.16.4
repository: https://grafana.github.io/helm-charts
44 changes: 44 additions & 0 deletions helm/promtail-aggregator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
SHELL := /usr/bin/env bash
NAMESPACE=""
NAME=sso-promtail-aggregator

ifndef NAMESPACE
$(error NAMESPACE is not set)
endif

define arguments
"${NAME}" . -n "${NAMESPACE}" -f values.yaml -f "values-${NAMESPACE}.yaml"
endef

.PHONY: helm-dep
helm-dep:
helm dependency update

.PHONY: install
install: helm-dep
install:
@helm install $(call arguments)

.PHONY: upgrade
upgrade: helm-dep
upgrade:
@helm upgrade --install $(call arguments)

.PHONY: lint
lint: helm-dep
lint:
@helm upgrade --dry-run --install $(call arguments)

.PHONY: uninstall
uninstall: helm-dep
uninstall:
@helm uninstall ${NAME} -n ${NAMESPACE}

.PHONY: template
template: helm-dep
template:
@helm template $(call arguments) > template.yaml

.PHONY: force-install
force-install: uninstall
force-install: install
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sso-promtail
# sso-promtail (aggregator)

A Helm chart for deploying [Grafana Promtail](https://github.com/grafana/helm-charts/tree/main/charts/promtail).
A Helm chart for deploying [Grafana Promtail](https://github.com/grafana/helm-charts/tree/main/charts/promtail) for our [aggregator server](../aggregator). This instance is separated from our loki promtail deployment in order to use additional labels for easier metric aggregation, which would negatively impact Loki performance.

## Local deployment via Helm chart

Expand Down
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-e4ca1d-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: dev

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.e4ca1d-prod.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-e4ca1d-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: prod

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.e4ca1d-prod.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-e4ca1d-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: test

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.e4ca1d-prod.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-eb75ad-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: dev

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.eb75ad-tools.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-eb75ad-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: prod

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.eb75ad-tools.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
17 changes: 17 additions & 0 deletions helm/promtail-aggregator/values-eb75ad-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
promtail:
environment: test

deployment:
replicaCount: 1

# see https://grafana.com/docs/loki/latest/clients/promtail/configuration/#supported-contents-and-default-values-of-configyaml
config:
logLevel: info
clients:
- url: http://sso-aggregator.eb75ad-tools.svc.cluster.local:8080/api/promtail/push
snippets:
scrapeConfigs: |
{{- tpl .Values.ssoScrapeConfigs . }}

persistentVolume:
size: 100Mi
102 changes: 102 additions & 0 deletions helm/promtail-aggregator/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# see https://github.com/grafana/helm-charts/blob/main/charts/promtail/values.yaml
promtail:
nameOverride: sso-promtail-agregator
fullnameOverride: sso-promtail-aggregator

daemonset:
enabled: false

deployment:
enabled: true
replicaCount: 1
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage:

image:
registry: docker.io
repository: grafana/promtail
tag: ""
pullPolicy: IfNotPresent

imagePullSecrets: []

resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi

podSecurityContext:
containerSecurityContext:

rbac:
create: false
pspEnabled: false

serviceAccount:
create: false

podSecurityPolicy:

defaultVolumes:
- name: positions
persistentVolumeClaim:
claimName: sso-promtail-positions

defaultVolumeMounts:
- name: positions
mountPath: /run/promtail

extraVolumes:
- name: logs-volume
persistentVolumeClaim:
claimName: sso-keycloak-logs

extraVolumeMounts:
- mountPath: /keycloak/logs
name: logs-volume

ssoScrapeConfigs: |
- job_name: local
static_configs:
- targets:
- localhost
labels:
job: keycloak
environment: {{ .Values.environment }}
__path__: /keycloak/logs/*.log
pipeline_stages:
- match:
selector: '{job="keycloak"}'
stages:
- json:
expressions:
timestamp: '"@timestamp"'
level: level
- labels:
level:
- timestamp:
format: RFC3339Nano
source: timestamp
- match:
selector: '{job="keycloak"}'
stages:
- regex:
expression: "type=(?P<type>\\S+),.*realmId=(?P<realm_id>\\S+),.*clientId=(?P<client_id>\\S+),"
- labels:
event_type: type
realm_id:
client_id:

persistentVolume:
size: 100Mi
storageClass: netapp-file-standard
annotations: {}
accessModes:
- ReadWriteMany
2 changes: 2 additions & 0 deletions helm/promtail-loki/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
template.yaml
32 changes: 32 additions & 0 deletions helm/promtail-loki/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/

# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~

# Various IDEs
.project
.idea/
*.tmproj
.vscode/

# Other
doc.yaml
README.tpl
README.md.gotmpl
ci
CHANGELOG.md
6 changes: 6 additions & 0 deletions helm/promtail-loki/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: promtail
repository: https://grafana.github.io/helm-charts
version: 6.16.4
digest: sha256:3e3b0f2a90cda3d817319d7f3fa5918e1f44a3caefec5e4c5d2efae9a5327b50
generated: "2024-08-20T21:49:02.396706497-07:00"
11 changes: 11 additions & 0 deletions helm/promtail-loki/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: promtail
description: Helm chart for Grafana Promtail
type: application
appVersion: 0.2.0
version: 0.2.0
dependencies:
- name: promtail
alias: promtail
version: 6.16.4
repository: https://grafana.github.io/helm-charts
2 changes: 1 addition & 1 deletion helm/promtail/Makefile → helm/promtail-loki/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /usr/bin/env bash
NAMESPACE=""
NAME=sso-promtail
NAME=sso-promtail-loki

ifndef NAMESPACE
$(error NAMESPACE is not set)
Expand Down
29 changes: 29 additions & 0 deletions helm/promtail-loki/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# sso-promtail

A Helm chart for deploying [Grafana Promtail](https://github.com/grafana/helm-charts/tree/main/charts/promtail) for our loki instance.

## Labelling

For grafana loki we have found that keeping a minimal label set is ideal for performance, more information can be found in the following resources:

- [Cardinality](https://grafana.com/docs/loki/latest/get-started/labels/#cardinality)
- [Labels and Chunks](https://grafana.com/blog/2023/12/20/the-concise-guide-to-grafana-loki-everything-you-need-to-know-about-labels/)
- [Guide to label configuration](https://grafana.com/blog/2020/08/27/the-concise-guide-to-labels-in-loki/)

## Local deployment via Helm chart

### Installing/Upgrading the Chart

```sh
make upgrade NAMESPACE=<namespace>
```

### Uninstalling the Chart

```sh
make uninstall NAMESPACE=<namespace>
```

## Configuration

please find the full list of `Promtail Helm values` configuration in [Promtail Helm values](https://github.com/grafana/helm-charts/blob/main/charts/promtail/values.yaml)
Loading
Loading