Skip to content

Commit

Permalink
changes following tests
Browse files Browse the repository at this point in the history
  • Loading branch information
8naama committed Dec 10, 2024
1 parent 589dd8d commit 6796009
Show file tree
Hide file tree
Showing 14 changed files with 276 additions and 98 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/logzio-apm-collector-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,29 @@ jobs:
- name: Deploy Helm Chart
run: |
cd charts/logzio-telemetry
cd charts/logzio-apm-collector
helm upgrade --install \
--set enabled=true \ \
--set enabled=true \
--set spm.enabled=true \
--set serviceGraph.enabled=true \
--set secrets.logzioTracesToken=${{ secrets.LOGZIO_TRACES_TOKEN }} \
--set secrets.logzioSpmToken=${{ secrets.LOGZIO_METRICS_TOKEN }} \
--set secrets.logzioRegion="us" \
--set secrets.env_id=${{ env.ENV_ID }} \
--set global.logzioTracesToken=${{ secrets.LOGZIO_TRACES_TOKEN }} \
--set global.logzioSpmToken=${{ secrets.LOGZIO_METRICS_TOKEN }} \
--set global.logzioRegion="us" \
--set global.env_id=${{ env.ENV_ID }} \
logzio-apm-collector .
kubectl rollout status deployment/logzio-apm-collector --timeout=300s
kubectl rollout status deployment/logzio-apm-collector-spm --timeout=300s
- name: Run trace generator
run: |
kubectl apply -f tests/resources/tracegen.yaml
kubectl apply -f tests/resources/tracegen-apm.yaml
kubectl rollout status deployment/trace-gen --timeout=300s
- name: Run otel demo for service graph
run: |
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
helm install otel-demo -f tests/resources/otel-demo.yaml open-telemetry/opentelemetry-demo --version 0.32.5
helm install otel-demo -f tests/resources/otel-demo-apm.yaml open-telemetry/opentelemetry-demo --version 0.32.5
kubectl rollout status deployment/otel-demo-loadgenerator --timeout=300s
- name: sleep for 3 minutes
Expand All @@ -82,7 +82,7 @@ jobs:
run: |
go get go.uber.org/zap
go test -v ./tests/traces_e2e_test.go ./tests/common.go
go test -v ./tests/metrics_e2e_test.go ./tests/common.go
go test -v ./tests/apm_metrics_e2e_test.go ./tests/common.go
- name: Cleanup Environment
run: |
Expand Down
1 change: 1 addition & 0 deletions charts/logzio-apm-collector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version: 1.0.0
description: Kubernetes APM agent for Logz.io based on OpenTelemetry Collector
type: application
home: https://logz.io/
icon: https://logzbucket.s3.eu-west-1.amazonaws.com/logz-io-img/logo400x400.png
maintainers:
- name: Naama Bendalak
email: [email protected]
Expand Down
12 changes: 4 additions & 8 deletions charts/logzio-apm-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ helm install -n monitoring --create-namespace \
--set enabled=true \
--set spm.enabled=true \
--set serviceGraph.enabled=true \
--set secrets.logzioTracesToken="<<LOGZIO_TRACES_TOKEN>>" \
--set secrets.logzioSpmToken="<<LOGZIO_SPM_TOKEN>>" \
--set secrets.logzioRegion="<<LOGZIO_REGION_CODE>>" \
--set secrets.env_id="<<ENV_ID>>" \
--set global.logzioTracesToken="<<LOGZIO_TRACES_TOKEN>>" \
--set global.logzioSpmToken="<<LOGZIO_SPM_TOKEN>>" \
--set global.logzioRegion="<<LOGZIO_REGION_CODE>>" \
--set global.env_id="<<ENV_ID>>" \
logzio-apm-collector logzio-helm/logzio-apm-collector
```

Expand Down Expand Up @@ -66,10 +66,6 @@ logzio-apm-collector.monitoring.svc.cluster.local:<<PORT>>
>
> For a complete list, see `values.yaml` >> `traceConfig` >> `receivers`.
> [!WARNING]
> If you're deploying the chart as a sub chart of the `logzio-monitoring` chart, replace:
> `logzio-apm-collector` >> `logzio-monitoring-otel-collector`

## Custom trace sampling rules
To customize the Traces Sampling rules in the OpenTelemetry Collector, you can follow the below steps:
Expand Down
2 changes: 1 addition & 1 deletion charts/logzio-apm-collector/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{ fail "[ERROR] The logzio-apm-collector Chart's `otelLogLevel` must be one of 'info', 'warn', 'error' or 'debug'." }}
{{- end }}

{{- $region := lower .Values.secrets.logzioRegion }}
{{- $region := lower .Values.global.logzioRegion }}
{{- if not (or (eq $region "us") (eq $region "eu") (eq $region "uk") (eq $region "ca") (eq $region "au")) }}
{{ print "[WARN] The `logzioRegion` expected value should be one of 'us', 'eu', 'uk', 'ca', 'au'." }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/logzio-apm-collector/templates/_helpers-spm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ component: spm-collector
Create Logz.io listener address based on region
*/}}
{{- define "spm-collector.listenerAddress" -}}
{{- $region := .Values.secrets.logzioRegion -}}
{{- $region := .Values.global.logzioRegion -}}
{{- if or (eq $region "us") (not $region) -}}
https://listener.logz.io:8053
{{- else }}
Expand Down
14 changes: 0 additions & 14 deletions charts/logzio-apm-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,3 @@ The APM service address
{{- $serviceName := include "apm-collector.fullname" .}}
{{- printf "http://%s.%s.svc.cluster.local" $serviceName .Release.Namespace }}
{{- end }}

{{/*
Get secret value either from the global section (parent chart is running) or the default sub chart section
*/}}
{{- define "getGlobalOrDefaultValue" -}}
{{- $ctx := index . 0 -}}
{{- $key := index . 1 -}}
{{- $fallback := index . 2 -}}
{{- if hasKey $ctx.Values "global" -}}
{{- $ctx.Values.global | default dict | get $key | default $fallback -}}
{{- else -}}
{{- $fallback -}}
{{- end -}}
{{- end -}}
8 changes: 4 additions & 4 deletions charts/logzio-apm-collector/templates/_pod-spm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ containers:
- name: ENV_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: env-id
- name: SPM_ENDPOINT
{{- if .Values.secrets.customSpmEndpoint }}
{{- if .Values.global.customSpmEndpoint }}
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: custom-spm-endpoint
{{- else }}
value: {{ include "spm-collector.listenerAddress" . | quote }}
{{- end }}
- name: LOGZIO_SPM_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: logzio-spm-token
- name: LOG_LEVEL
value: {{ .Values.otelLogLevel | default "info" | quote }}
Expand Down
10 changes: 5 additions & 5 deletions charts/logzio-apm-collector/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ containers:
- name: ENV_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: env-id
- name: LOGZIO_REGION
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: logzio-listener-region
- name: LOGZIO_TRACES_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: logzio-traces-token
{{- if .Values.secrets.customTracesEndpoint }}
{{- if .Values.global.customTracesEndpoint }}
- name: CUSTOM_TRACES_ENDPOINT
valueFrom:
secretKeyRef:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
key: custom-traces-endpoint
{{- end }}
- name: LOG_LEVEL
Expand Down
8 changes: 2 additions & 6 deletions charts/logzio-apm-collector/templates/_validations.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ Verify tracing token was provided if the chart is enabled
*/}}
{{- define "check-tracing-token" -}}
{{- if .Values.enabled }}
{{- $hasGlobalToken := and (hasKey .Values "global") .Values.global.logzioTracesToken -}}
{{- $hasSecretsToken := .Values.secrets.logzioTracesToken -}}
{{- if not (or $hasGlobalToken $hasSecretsToken) }}
{{- if not .Values.global.logzioTracesToken }}
{{- fail "Missing Tracing Token" }}
{{- end }}
{{- end }}
Expand All @@ -16,9 +14,7 @@ Verify SPM token was provided if SPM is enabled
*/}}
{{- define "check-spm-token" -}}
{{- if and (.Values.enabled) (.Values.spm.enabled) }}
{{- $hasGlobalToken := and (hasKey .Values "global") .Values.global.logzioSpmToken -}}
{{- $hasSecretsToken := .Values.secrets.logzioSpmToken -}}
{{- if not (or $hasGlobalToken $hasSecretsToken) }}
{{- if not .Values.global.logzioSpmToken }}
{{- fail "Missing SPM Token" }}
{{- end }}
{{- end }}
Expand Down
20 changes: 10 additions & 10 deletions charts/logzio-apm-collector/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{{ if .Values.enabled}}
{{- if .Values.secrets.enabled }}
{{- if .Values.secret.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secrets.name }}
name: {{ .Values.secret.name }}
namespace: {{ .Release.Namespace }}
type: Opaque
stringData:
env-id: {{ include "getGlobalOrDefaultValue" (list . "env_id" .Values.secrets.env_id) | quote }}
logzio-listener-region: {{ include "getGlobalOrDefaultValue" (list . "logzioRegion" .Values.secrets.logzioRegion) }}
env-id: {{ .Values.global.env_id | quote}}
logzio-listener-region: {{ .Values.global.logzioRegion | quote}}
{{- template "check-tracing-token" . }}
logzio-traces-token: {{ include "getGlobalOrDefaultValue" (list . "logzioTracesToken" .Values.secrets.logzioTracesToken) }}
logzio-traces-token: {{ .Values.global.logzioTracesToken }}
{{- template "check-spm-token" . }}
logzio-spm-token: {{ include "getGlobalOrDefaultValue" (list . "logzioSpmToken" .Values.secrets.logzioSpmToken) }}
{{- if .Values.secrets.customTracesEndpoint }}
custom-traces-endpoint: {{ .Values.secrets.customTracesEndpoint }}
logzio-spm-token: {{ .Values.global.logzioSpmToken }}
{{- if .Values.global.customTracesEndpoint }}
custom-traces-endpoint: {{ .Values.global.customTracesEndpoint }}
{{- end }}
{{- if .Values.secrets.customSpmEndpoint}}
custom-spm-endpoint: {{ .Values.secrets.customSpmEndpoint }}
{{- if .Values.global.customSpmEndpoint}}
custom-spm-endpoint: {{ .Values.global.customSpmEndpoint }}
{{- end }}
{{- end }}
{{ end }}
Loading

0 comments on commit 6796009

Please sign in to comment.