Skip to content

Commit 3ef0549

Browse files
feat: Add otel instrumentation to internal gateway (#126)
1 parent 689feed commit 3ef0549

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

charts/internal-gateway/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: v0.0.0
33
description: A Helm chart for Codefresh Internal Gateway
44
name: internal-gateway
5-
version: 0.11.0
5+
version: 0.12.0
66
home: https://github.com/codefresh-io/helm-charts
77
keywords:
88
- codefresh

charts/internal-gateway/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# internal-gateway
22

3-
![Version: 0.11.0](https://img.shields.io/badge/Version-0.11.0-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)
3+
![Version: 0.12.0](https://img.shields.io/badge/Version-0.12.0-informational?style=flat-square) ![AppVersion: v0.0.0](https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square)
44

55
A Helm chart for Codefresh Internal Gateway
66

@@ -55,6 +55,11 @@ A Helm chart for Codefresh Internal Gateway
5555
| nginx.config.workerRlimitNofile | string | `"1047552"` | Changes the limit on the largest size of a core file (RLIMIT_CORE) for worker processes. Used to increase the limit without restarting the main process. |
5656
| nginx.extraConfigsPatterns | list | `[]` | |
5757
| nginx.scriptFilesPatterns | list | `[]` | Path to NJS scripts |
58+
| otel.config.endpoint | string | `"localhost:4317"` | |
59+
| otel.config.service_name | string | `"codefresh-internal-gateway"` | |
60+
| otel.enabled | bool | `false` | |
61+
| otel.httpSnippet | string | `"otel_trace on;\notel_service_name {{ default \"codefresh-internal-gateway\" .Values.otel.config.service_name }};\notel_trace_context \"inject\";\notel_exporter {\n endpoint {{ .Values.otel.config.endpoint}};\n}\n"` | Snippet to be included in the http block of nginx.conf for OTEL configs. See here for available directives https://nginx.org/en/docs/ngx_otel_module.html |
62+
| otel.modulePath | string | `"modules/ngx_otel_module.so"` | Path to the OpenTelemetry NGINX module - should be present in the NGINX image, images with -otel tags include it |
5863
| pdb | object | See below | PDB parameters |
5964
| podAnnotations | object | See below | Pod annotations |
6065
| podSecurityContext | object | See below | Pod Security Context parameters |

charts/internal-gateway/templates/_components/_configmap.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ metadata:
1414
{{- include "internal-gateway.labels" . | nindent 4 }}
1515
data:
1616
nginx.conf: |
17+
{{- if .Values.otel.enabled }}
18+
load_module modules/ngx_otel_module.so;
19+
{{- end }}
1720
worker_processes {{ $nginxConfig.workerProcesses }};
1821
error_log /dev/stderr {{ $nginxConfig.errorLogLevel }};
1922
pid /tmp/nginx.pid;
@@ -68,6 +71,10 @@ data:
6871
resolver {{ .Values.global.dnsService }}.{{ .Values.global.dnsNamespace }}.svc.{{ .Values.global.clusterDomain }};
6972
{{- end }}
7073

74+
{{- if .Values.otel.enabled }}
75+
{{- tpl .Values.otel.httpSnippet . | nindent 6 }}
76+
{{- end }}
77+
7178
{{- with $nginxConfig.httpSnippet }}
7279
{{ . | nindent 6 }}
7380
{{- end }}

charts/internal-gateway/values.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ container:
195195
image:
196196
registry: docker.io
197197
repository: nginxinc/nginx-unprivileged
198-
tag: 1.29-alpine
198+
tag: 1.29-alpine-otel
199199

200200
env: {}
201201
envFrom: []
@@ -329,3 +329,19 @@ rbac:
329329

330330
keda:
331331
enabled: false
332+
333+
otel:
334+
enabled: false
335+
# -- Path to the OpenTelemetry NGINX module - should be present in the NGINX image, images with -otel tags include it
336+
modulePath: "modules/ngx_otel_module.so"
337+
config:
338+
service_name: "codefresh-internal-gateway"
339+
endpoint: "localhost:4317"
340+
# -- Snippet to be included in the http block of nginx.conf for OTEL configs. See here for available directives https://nginx.org/en/docs/ngx_otel_module.html
341+
httpSnippet: |
342+
otel_trace on;
343+
otel_service_name {{ default "codefresh-internal-gateway" .Values.otel.config.service_name }};
344+
otel_trace_context "inject";
345+
otel_exporter {
346+
endpoint {{ .Values.otel.config.endpoint}};
347+
}

0 commit comments

Comments
 (0)