Skip to content

Commit 992c341

Browse files
maksymlumenclaude
andcommitted
Add OTLP_DSN default env, make otel optional in SDK (0.1.70)
Chart now sets OTLP_DSN=http://token@tinysystems-otel-collector:2345 by default so modules connect to otel-collector out of the box. SDK: skip otel setup when OTLP_DSN is empty instead of os.Exit(1). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 47679e5 commit 992c341

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

charts/tinysystems-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: 0.1.69
16+
version: 0.1.70
1717
# This is the version number of the application being deployed. This version number should be
1818
# incremented each time you make changes to the application. Versions are not expected to
1919
# follow Semantic Versioning. They should reflect the version the application is using.

charts/tinysystems-operator/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ controllerManager:
99
- pre-delete
1010
installArgs:
1111
- pre-install
12-
extraEnv: []
12+
extraEnv:
13+
- name: OTLP_DSN
14+
value: "http://token@tinysystems-otel-collector:2345"
1315
containerSecurityContext:
1416
allowPrivilegeEscalation: false
1517
capabilities:

cli/run.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,22 @@ var runCmd = &cobra.Command{
9191

9292
// re-use zerolog
9393
l := zerologr.New(&log.Logger)
94-
err := metrics.ConfigureOpenTelemetry(
95-
metrics.WithDSN(os.Getenv("OTLP_DSN")),
96-
metrics.WithBatchSpanProcessorOption(func(o *sdktrace.BatchSpanProcessorOptions) {
97-
o.BatchTimeout = 500 * time.Millisecond // Very responsive
98-
// Optional: also reduce batch size for faster sends
99-
o.MaxExportBatchSize = 10
100-
}),
101-
)
102-
if err != nil {
103-
l.Error(err, "configure opentelemetry error")
104-
os.Exit(1)
94+
otlpDSN := os.Getenv("OTLP_DSN")
95+
if otlpDSN != "" {
96+
err := metrics.ConfigureOpenTelemetry(
97+
metrics.WithDSN(otlpDSN),
98+
metrics.WithBatchSpanProcessorOption(func(o *sdktrace.BatchSpanProcessorOptions) {
99+
o.BatchTimeout = 500 * time.Millisecond // Very responsive
100+
// Optional: also reduce batch size for faster sends
101+
o.MaxExportBatchSize = 10
102+
}),
103+
)
104+
if err != nil {
105+
l.Error(err, "configure opentelemetry error")
106+
os.Exit(1)
107+
}
108+
} else {
109+
l.Info("OTLP_DSN not set, telemetry disabled")
105110
}
106111

107112
// Send buffered spans and free resources.

0 commit comments

Comments
 (0)