Skip to content

Commit 155bb40

Browse files
authored
feat: Support custom clickhouse domain for otel collector (#12)
1 parent 180bc2d commit 155bb40

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

charts/hdx-oss-v2/templates/otel-collector-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ spec:
2828
- containerPort: {{ .Values.otel.httpPort }}
2929
- containerPort: {{ .Values.otel.healthPort }}
3030
env:
31-
- name: CLICKHOUSE_SERVER_ENDPOINT
32-
value: "{{ include "hdx-oss.fullname" . }}-clickhouse:{{ .Values.clickhouse.nativePort }}"
31+
- name: CLICKHOUSE_ENDPOINT
32+
value: "{{ .Values.otel.clickhouseEndpoint | default (printf "tcp://%s-clickhouse:%v?dial_timeout=10s" (include "hdx-oss.fullname" .) .Values.clickhouse.nativePort) }}"
3333
- name: HYPERDX_LOG_LEVEL
3434
value: {{ .Values.hyperdx.logLevel }}
3535
- name: CLICKHOUSE_USER

charts/hdx-oss-v2/tests/__snapshot__/otel-collector-disabled_test.yaml.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ should render OTEL collector with custom ports:
2727
spec:
2828
containers:
2929
- env:
30-
- name: CLICKHOUSE_SERVER_ENDPOINT
30+
- name: CLICKHOUSE_ENDPOINT
3131
value: RELEASE-NAME-hdx-oss-v2-clickhouse:9000
3232
- name: HYPERDX_LOG_LEVEL
3333
value: info
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
suite: test OTEL collector with custom clickhouse endpoint
2+
templates:
3+
- otel-collector-deployment.yaml
4+
tests:
5+
- it: should use default Clickhouse endpoint when not specified
6+
set:
7+
otel:
8+
enabled: true
9+
asserts:
10+
- documentIndex: 0
11+
isKind:
12+
of: Deployment
13+
- documentIndex: 0
14+
equal:
15+
path: spec.template.spec.containers[0].env[0].name
16+
value: CLICKHOUSE_ENDPOINT
17+
- documentIndex: 0
18+
matchRegex:
19+
path: spec.template.spec.containers[0].env[0].value
20+
pattern: "tcp://.*-clickhouse:[0-9]+\\?dial_timeout=10s"
21+
22+
- it: should use custom Clickhouse endpoint when specified
23+
set:
24+
otel:
25+
enabled: true
26+
clickhouseEndpoint: "my-custom-clickhouse:9000"
27+
asserts:
28+
- documentIndex: 0
29+
isKind:
30+
of: Deployment
31+
- documentIndex: 0
32+
equal:
33+
path: spec.template.spec.containers[0].env[0].name
34+
value: CLICKHOUSE_ENDPOINT
35+
- documentIndex: 0
36+
equal:
37+
path: spec.template.spec.containers[0].env[0].value
38+
value: "my-custom-clickhouse:9000"

charts/hdx-oss-v2/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ otel:
6060
httpPort: 4318
6161
healthPort: 8888
6262
enabled: true
63+
# Clickhouse endpoint - defaults to built-in Clickhouse service
64+
clickhouseEndpoint: ""
6365

6466
persistence:
6567
mongodb:

0 commit comments

Comments
 (0)