-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Robbie Lankford <[email protected]>
- Loading branch information
Showing
21 changed files
with
465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies: | ||
- name: grafana-agent | ||
repository: https://grafana.github.io/helm-charts | ||
version: 0.30.0 | ||
- name: grafana-agent | ||
repository: https://grafana.github.io/helm-charts | ||
version: 0.30.0 | ||
digest: sha256:2c08fa0d15062cc1d32e70998835208314f0a15bef4f90cd82235c9f89163813 | ||
generated: "2024-01-05T15:38:15.160358-08:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v2 | ||
name: sampling | ||
description: A Helm chart for Kubernetes | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "v0.38.1" | ||
|
||
dependencies: | ||
- name: grafana-agent | ||
version: 0.30.0 | ||
repository: https://grafana.github.io/helm-charts | ||
alias: grafana-agent-deployment | ||
- name: grafana-agent | ||
version: 0.30.0 | ||
repository: https://grafana.github.io/helm-charts | ||
alias: grafana-agent-statefulset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{- define "agent.config.deployment" -}} | ||
{{- include "deployment.receiver.otlp" . }} | ||
{{- include "deployment.processor.batch" . }} | ||
{{- include "deployment.exporter.loadbalancing" . }} | ||
{{- end -}} |
15 changes: 15 additions & 0 deletions
15
charts/sampling/templates/_agent_config_statefulset.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- define "agent.config.statefulset" -}} | ||
{{- include "statefulset.receiver.otlp" . }} | ||
{{- include "statefulset.connector.spanmetrics" . }} | ||
{{- include "statefulset.processor.transform.use_grafana_metric_names" . }} | ||
{{- include "statefulset.processor.filter" . }} | ||
{{- include "statefulset.connector.servicegraph" . }} | ||
{{- if .Values.sampling.enabled -}} | ||
{{- include "statefulset.processor.tail_sampling" . }} | ||
{{- end -}} | ||
{{- include "statefulset.processor.batch" . }} | ||
{{- include "statefulset.exporter.prometheus" . }} | ||
{{- include "statefulset.prometheus.remote_write" . }} | ||
{{- include "exporter.otlp" . }} | ||
{{- include "auth.basic" . }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{/* use the release name as the serviceAccount name for deployment and statefulset agents */}} | ||
{{- define "grafana-agent.serviceAccountName" -}} | ||
{{- default .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* Calculate name of image ID to use for "grafana-agent". */}} | ||
{{- define "grafana-agent.imageId" -}} | ||
{{- printf ":%s" .Chart.AppVersion }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{- define "auth.basic" -}} | ||
otelcol.auth.basic "grafana_cloud_tempo" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.auth.basic/ | ||
username = env("GRAFANA_CLOUD_TEMPO_USERNAME") | ||
password = env("GRAFANA_CLOUD_API_KEY") | ||
} | ||
|
||
{{ end }} |
20 changes: 20 additions & 0 deletions
20
charts/sampling/templates/_otelcol_connector_servicegraph.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- define "statefulset.connector.servicegraph" -}} | ||
otelcol.connector.servicegraph "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.connector.servicegraph/ | ||
dimensions = [ | ||
{{- range $.Values.metricsGeneration.dimensions }} | ||
{{ . | quote }}, | ||
{{- end }} | ||
] | ||
latency_histogram_buckets = ["0s", "0.005s", "0.01s", "0.025s", "0.05s", "0.075s", "0.1s", "0.25s", "0.5s", "0.75s", "1s", "2.5s", "5s", "7.5s", "10s"] | ||
|
||
store { | ||
ttl = "2s" | ||
} | ||
|
||
output { | ||
metrics = [otelcol.processor.batch.default.input] | ||
} | ||
} | ||
|
||
{{ end }} |
26 changes: 26 additions & 0 deletions
26
charts/sampling/templates/_otelcol_connector_spanmetrics.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- define "statefulset.connector.spanmetrics" -}} | ||
otelcol.connector.spanmetrics "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.connector.spanmetrics/ | ||
{{- range $.Values.metricsGeneration.dimensions }} | ||
dimension { | ||
name = {{ . | quote }} | ||
} | ||
{{- end }} | ||
|
||
namespace = "traces.spanmetrics" | ||
|
||
histogram { | ||
unit = "s" | ||
|
||
explicit { | ||
buckets = ["0s", "0.005s", "0.01s", "0.025s", "0.05s", "0.075s", "0.1s", "0.25s", "0.5s", "0.75s", "1s", "2.5s", "5s", "7.5s", "10s"] | ||
} | ||
} | ||
|
||
output { | ||
metrics = [otelcol.processor.transform.use_grafana_metric_names.input] | ||
} | ||
} | ||
|
||
|
||
{{ end }} |
21 changes: 21 additions & 0 deletions
21
charts/sampling/templates/_otelcol_exporter_loadbalancing.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- define "deployment.exporter.loadbalancing" -}} | ||
otelcol.exporter.loadbalancing "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.loadbalancing/ | ||
resolver { | ||
dns { | ||
hostname = "{{ .Release.Name }}-grafana-agent-statefulset.{{ .Release.Namespace }}.svc.cluster.local." | ||
} | ||
} | ||
|
||
protocol { | ||
otlp { | ||
client { | ||
tls { | ||
insecure = true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
{{ end }} |
10 changes: 10 additions & 0 deletions
10
charts/sampling/templates/_otelcol_exporter_otlp.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{- define "exporter.otlp" -}} | ||
otelcol.exporter.otlp "grafana_cloud_tempo" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.otlp/ | ||
client { | ||
endpoint = env("GRAFANA_CLOUD_TEMPO_ENDPOINT") | ||
auth = otelcol.auth.basic.grafana_cloud_tempo.handler | ||
} | ||
} | ||
|
||
{{ end }} |
8 changes: 8 additions & 0 deletions
8
charts/sampling/templates/_otelcol_exporter_prometheus.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{- define "statefulset.exporter.prometheus" -}} | ||
otelcol.exporter.prometheus "grafana_cloud_prometheus" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.prometheus/ | ||
add_metric_suffixes = false | ||
forward_to = [prometheus.remote_write.grafana_cloud_prometheus.receiver] | ||
} | ||
|
||
{{ end }} |
20 changes: 20 additions & 0 deletions
20
charts/sampling/templates/_otelcol_processor_batch.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- define "deployment.processor.batch" -}} | ||
otelcol.processor.batch "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.batch/ | ||
output { | ||
traces = [otelcol.exporter.loadbalancing.default.input] | ||
} | ||
} | ||
|
||
{{ end }} | ||
|
||
{{- define "statefulset.processor.batch" -}} | ||
otelcol.processor.batch "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.batch/ | ||
output { | ||
metrics = [otelcol.exporter.prometheus.grafana_cloud_prometheus.input] | ||
traces = [otelcol.exporter.otlp.grafana_cloud_tempo.input] | ||
} | ||
} | ||
|
||
{{ end }} |
17 changes: 17 additions & 0 deletions
17
charts/sampling/templates/_otelcol_processor_filter.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- define "statefulset.processor.filter" -}} | ||
otelcol.processor.filter "drop_unneeded_span_metrics" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.filter/ | ||
error_mode = "ignore" | ||
|
||
metrics { | ||
datapoint = [ | ||
"IsMatch(metric.name, \"traces.spanmetrics.calls|traces.spanmetrics.duration\") and IsMatch(attributes[\"span.kind\"], \"SPAN_KIND_INTERNAL|SPAN_KIND_CLIENT|SPAN_KIND_PRODUCER\")", | ||
] | ||
} | ||
|
||
output { | ||
metrics = [otelcol.processor.batch.default.input] | ||
} | ||
} | ||
|
||
{{ end }} |
12 changes: 12 additions & 0 deletions
12
charts/sampling/templates/_otelcol_processor_tail_sampling.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- define "statefulset.processor.tail_sampling" -}} | ||
otelcol.processor.tail_sampling "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.tail_sampling/ | ||
|
||
{{ .Values.sampling.strategies | indent 2 }} | ||
|
||
output { | ||
traces = [otelcol.processor.batch.default.input] | ||
} | ||
} | ||
|
||
{{ end }} |
19 changes: 19 additions & 0 deletions
19
charts/sampling/templates/_otelcol_processor_transform.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- define "statefulset.processor.transform.use_grafana_metric_names" -}} | ||
otelcol.processor.transform "use_grafana_metric_names" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.transform/ | ||
error_mode = "ignore" | ||
|
||
metric_statements { | ||
context = "metric" | ||
statements = [ | ||
"set(name, \"traces.spanmetrics.latency\") where name == \"traces.spanmetrics.duration\"", | ||
"set(name, \"traces.spanmetrics.calls.total\") where name == \"traces.spanmetrics.calls\"", | ||
] | ||
} | ||
|
||
output { | ||
metrics = [otelcol.processor.filter.drop_unneeded_span_metrics.input] | ||
} | ||
} | ||
|
||
{{ end }} |
33 changes: 33 additions & 0 deletions
33
charts/sampling/templates/_otelcol_receiver_otlp.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{- define "deployment.receiver.otlp" -}} | ||
otelcol.receiver.otlp "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.receiver.otlp/ | ||
|
||
// configures the default grpc endpoint "0.0.0.0:4317" | ||
grpc { } | ||
// configures the default http/protobuf endpoint "0.0.0.0:4318" | ||
http { } | ||
|
||
output { | ||
traces = [otelcol.processor.batch.default.input] | ||
} | ||
} | ||
|
||
{{ end }} | ||
|
||
{{- define "statefulset.receiver.otlp" -}} | ||
otelcol.receiver.otlp "default" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.receiver.otlp/ | ||
|
||
// configures the default grpc endpoint "0.0.0.0:4317" | ||
grpc { } | ||
|
||
output { | ||
traces = [ | ||
{{ if .Values.sampling.enabled }}otelcol.processor.tail_sampling.default.input,{{ end }} | ||
otelcol.connector.servicegraph.default.input, | ||
otelcol.connector.spanmetrics.default.input, | ||
] | ||
} | ||
} | ||
|
||
{{ end }} |
20 changes: 20 additions & 0 deletions
20
charts/sampling/templates/_prometheus_remote_write.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- define "statefulset.prometheus.remote_write" -}} | ||
prometheus.remote_write "grafana_cloud_prometheus" { | ||
// https://grafana.com/docs/agent/latest/flow/reference/components/prometheus.remote_write/ | ||
endpoint { | ||
url = env("GRAFANA_CLOUD_PROMETHEUS_URL") | ||
|
||
basic_auth { | ||
username = env("GRAFANA_CLOUD_PROMETHEUS_USERNAME") | ||
password = env("GRAFANA_CLOUD_API_KEY") | ||
} | ||
queue_config { | ||
retry_on_http_429 = false | ||
} | ||
} | ||
external_labels = { | ||
"__metrics_gen_instance" = env("POD_UID"), | ||
} | ||
} | ||
|
||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-grafana-agent-deployment | ||
labels: | ||
{{- include "grafana-agent.labels" . | nindent 4 }} | ||
data: | ||
config.river: |- {{- (include "agent.config.deployment" .) | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-grafana-agent-statefulset | ||
labels: | ||
{{- include "grafana-agent.labels" . | nindent 4 }} | ||
data: | ||
config.river: |- {{- (include "agent.config.statefulset" .) | nindent 4 }} |
Oops, something went wrong.