Repository navigation
feat: opt-in OpenTelemetry tracing and metrics (experimental) - #2769
Conversation
…root span) Implements the first increment of docs/proposals/otel-tracing.md (#2767): - pkg/telemetry: SDK setup from standard OTEL_* env vars (autoexport for exporter selection, env-driven sampler/propagators, OTEL_SDK_DISABLED), command-span lifecycle, no-op-by-default accessors - --otel-tracing flag / HELMFILE_OTEL_TRACING env switch - root span "helmfile <command>" with file/environment/selectors/exit_code attributes; TRACEPARENT-based remote-parent extraction for CI correlation - shutdown flush on both normal-exit and signal paths (nil-safe, 5s bound) - app.New derives its context from telemetry.CommandContext() (Background-identical when tracing is disabled) - docs: otel.md user guide, experimental-features entry, design proposal - tests: hermetic unit tests, app context-contract pinning, flag registration Telemetry problems never fail a run: exporter misconfiguration and export errors degrade to disabled with a warning. When disabled, behavior and performance are identical to before (no-op tracer, no goroutines, no network). Refs: #2767, #2758 Signed-off-by: yxxhero <[email protected]>
… (PR 2) Implements the second increment of docs/proposals/otel-tracing.md (#2767): - pkg/helmexec/span.go: one span per external process started by helmfile (helm invocations, hooks, plugin execs) at the ShellRunner choke point — helm.exec (with helm.subcommand) vs os.exec, with redacted exec.args, exec.exit_code, and error status on failure - pkg/helmexec/redact.go: shared argument redaction with two profiles; legacy is byte-identical to the historical exit-error behavior (existing goldens unchanged), strict (spans) additionally covers --set=k=v and credential flags; exit_error.go now uses the shared helper - orphan-trace bridges with bit-identical cancellation semantics (context.WithoutCancel of the command context): both kubedog call sites (state.go) and hook execution (event.Bus gains an optional Ctx consumed by its default runner; state.go sets it, nil falls back to TODO as before) - OTLP end-to-end test (in-process httptest receiver, no external collector): span export, error status/exit code, redaction, and parent-linkage to the command span - docs/otel.md updated to the now-traced surface Verified end-to-end with the console exporter: helmfile template on a local chart yields the command span plus helm.exec spans for helm version/dependency/template, all nested under it. Refs: #2767 Signed-off-by: yxxhero <[email protected]>
Implements the third increment of docs/proposals/otel-tracing.md (#2767): - helmfile.discover_states around findDesiredStateFiles and helmfile.load around loadDesiredStateFromYamlWithBaseDir; both cover all callers (incl. nested helmfiles) with no signature changes - helmfile.render / helmfile.parse children per document part, parented through a traceCtx field on the unexported desiredStateLoader struct (set once at its single construction site) - helmfile.hook span per hook execution: Trigger's per-hook body extracted into runHook (readability win on its own), the hook's subprocess span nests under it via a per-hook ctx-swapped ShellRunner clone (cancellation unchanged — Bus.Ctx never carries cancellation by contract) - pkg/telemetry/otlptest: shared in-process OTLP/HTTP receiver harness, now used by helmexec, event, and app span tests - golden span-tree test at the app layer (root -> discover -> load -> render/parse, via the exectest fake helm) and a hook-span nesting test - nil-ctx guard for App literals built directly by tests (App.spanParentCtx) Verified end-to-end with the console exporter: a template run over a gotmpl state file with a prepare hook yields the full tree with the hook's os.exec nested under helmfile.hook. Refs: #2767 Signed-off-by: yxxhero <[email protected]>
Implements the per-release increment of docs/proposals/otel-tracing.md (#2767) — spans nest command -> load -> release -> helm exec: - helmexec.HelmContext gains an optional Ctx carrying the per-release span context; the execer's new execWithContext funnel consumes it via a per-call runner clone (runnerWithCtx) so the shared, cached execer is never mutated across concurrent workers. The seven Interface methods that take a HelmContext (Sync/Diff/ReleaseStatus/List/DecryptSecret/ Delete/Test) route through it; nil Ctx behaves exactly as before. exec() lost its always-nil override parameter on the way (unparam). - pkg/state/span.go: SetTraceContext + startReleaseSpan/endReleaseSpan helpers (release/namespace/chart/labels attributes, sorted for stable output); a typed-nil guard (releaseErrAsError) avoids the classic nil-pointer-in-interface trap on *ReleaseError. - release spans in the worker loops: SyncReleases, DiffReleases, DeleteReleasesForSync, PrepareCharts, and iterateOnReleases (status/ delete/test via a new verb parameter); their HelmContext is stamped with the release span context where one is built. - pkg/app sets st.SetTraceContext(loadCtx) right after loading a state file, rooting all per-release spans under helmfile.load. - bridged one more detached tracking call found on the way (trackReleaseIfEnabled's context.Background in the sync worker). - golden test: release span present, nested under load, correct attributes; unit test for the runnerWithCtx clone semantics. Verified with the console exporter: helmfile template yields release.prepare(demo) under load with full attributes. Refs: #2767 Signed-off-by: yxxhero <[email protected]>
Completes the per-release exec nesting for the iterateOnReleases-based
loops (docs/proposals/otel-tracing.md §4.4 phase 2): the do closures now
receive the release span context and stamp it into their HelmContext, so
helm status/delete/test subprocess spans nest under
helmfile.release.<verb> like sync/diff already did.
- scatterGatherReleases/iterateOnReleases/doWithReleaseSpan: do gains a
context parameter (the release span context)
- ReleaseStatuses/DeleteReleases/TestReleases closures stamp
HelmContext.Ctx from it
- integration test with a real execer (version-probe shim binary): the
release's status subprocess nests under helmfile.release.status, same
trace, with helm.subcommand=status
This also makes the otel.md claim ("upgrade, diff, delete, status, test
nested under the release span") fully accurate.
Refs: #2767
Signed-off-by: yxxhero <[email protected]>
…s (PR 4) Implements the metrics increment of docs/proposals/otel-tracing.md (#2767) on the same provider, switch, and resource as traces: - pkg/telemetry/metrics.go: helmfile.helm.exec.duration histogram (subcommand, success) and helmfile.release.count counter (verb, result). Instruments come from the otel global meter, so recording at call sites is branch-free no-op when telemetry is disabled. - Setup builds the resource once and installs both providers; reader selection delegates to autoexport (OTEL_METRICS_EXPORTER: otlp | console | prometheus | none), the OTLP reader's interval honors OTEL_METRIC_EXPORT_INTERVAL (read by the SDK). Shutdown flushes both providers (errors.Join). StartCommandSpan now carries the meter provider across state transitions (fixes a nil-shutdown panic). - helmexec: finishExecSpan records exec duration for helm binaries; state: endReleaseSpan counts release outcomes for sync/diff/delete/ status/test/prepare (diff counted as success when no hard error). - otlptest: recorder routes by OTLP path (/v1/traces vs /v1/metrics) and decodes metrics; new FindMetric helper. - tests: metrics recorded as no-op when disabled, provider enabled with the none exporter, degradation on an invalid metrics exporter, and an integration assertion (status exec duration datapoint + one successful release.count) in the shim-based state test. Verified with the console exporter: helmfile template emits helmfile.helm.exec.duration per subcommand (version/dependency/ template) and helmfile.release.count{verb=prepare,result=success}=1. Refs: #2767 Signed-off-by: yxxhero <[email protected]>
- docs/cli.md: --otel-tracing in the CLI reference help block (verbatim from the cobra output) - CHANGELOG.md: [Unreleased] Added entry for tracing + metrics - docs/index.md: Observability highlight linking docs/otel.md - docs/proposals/otel-tracing.md: add OTEL_METRICS_EXPORTER / OTEL_METRIC_EXPORT_INTERVAL rows to the env-var table and note the periodic reader + bounded metric cardinality in §7 Refs: #2767 Signed-off-by: yxxhero <[email protected]>
The id parameter was never used inside the span wrapper; the caller's id variable is still used for the render calls and error messages. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Cancellation regressions, inaccurate metrics, resource leakage, and multiple telemetry paths that can export sensitive data must be addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds experimental, opt-in OpenTelemetry tracing and metrics across command execution, state loading, releases, hooks, and Helm subprocesses.
Changes:
- Adds OTel lifecycle, exporters, propagation, metrics, and CLI configuration.
- Instruments app, state, hook, and subprocess execution paths with redaction.
- Adds tests and user/design documentation.
File summaries
| File | Description |
|---|---|
pkg/telemetry/telemetry.go |
Manages telemetry lifecycle and command spans. |
pkg/telemetry/telemetry_test.go |
Tests setup, shutdown, and metrics behavior. |
pkg/telemetry/otlptest/otlptest.go |
Provides an OTLP test receiver. |
pkg/telemetry/metrics.go |
Defines Helm execution and release metrics. |
pkg/telemetry/exporter.go |
Configures exporters, resources, and propagation. |
pkg/telemetry/exporter_test.go |
Tests exporter configuration helpers. |
pkg/telemetry/export_test.go |
Exposes telemetry reset for tests. |
pkg/state/state.go |
Adds release spans and context propagation. |
pkg/state/state_run.go |
Wraps release workers in spans. |
pkg/state/span.go |
Implements release-span helpers. |
pkg/state/span_test.go |
Tests release nesting and metrics. |
pkg/helmexec/span.go |
Instruments subprocess execution. |
pkg/helmexec/span_test.go |
Tests subprocess spans and contexts. |
pkg/helmexec/runner.go |
Wraps shell commands with spans. |
pkg/helmexec/redact.go |
Adds argument-redaction profiles. |
pkg/helmexec/redact_test.go |
Tests redaction and span attributes. |
pkg/helmexec/exit_error.go |
Reuses legacy redaction for errors. |
pkg/helmexec/exec.go |
Propagates per-call execution contexts. |
pkg/helmexec/exec_test.go |
Updates internal execution tests. |
pkg/helmexec/context.go |
Adds context to HelmContext. |
pkg/event/bus.go |
Adds hook spans and context-aware runners. |
pkg/event/bus_test.go |
Tests hook runner contexts. |
pkg/event/bus_span_test.go |
Tests hook span nesting. |
pkg/envvar/const.go |
Defines the telemetry environment variable. |
pkg/config/global.go |
Adds the global telemetry option. |
pkg/app/two_pass_renderer.go |
Instruments template rendering. |
pkg/app/desired_state_file_loader.go |
Instruments parsing and carries trace context. |
pkg/app/app.go |
Roots app and state-loading spans. |
pkg/app/app_new_context_test.go |
Tests app context integration. |
pkg/app/app_load_span_test.go |
Tests app-level span hierarchy. |
mkdocs.yml |
Adds telemetry documentation navigation. |
main.go |
Flushes telemetry during process exit. |
go.sum |
Updates dependency checksums. |
go.mod |
Promotes and adds OTel dependencies. |
docs/proposals/otel-tracing.md |
Documents the telemetry design. |
docs/otel.md |
Adds the user guide. |
docs/index.md |
Highlights observability support. |
docs/experimental-features.md |
Lists telemetry as experimental. |
docs/cli.md |
Documents the CLI flag. |
cmd/root.go |
Initializes telemetry and the root span. |
cmd/root_test.go |
Tests flag registration. |
CHANGELOG.md |
Records the feature. |
Review details
Suppressed comments (2)
pkg/helmexec/span.go:96
err.Error()is exported as the span status description. ForExitError, that string contains the command arguments plus stderr/combined output; legacy error redaction still exposes inline--set=...and credentials such as usernames, and subprocess output may contain secrets. This bypasses the strictexec.argsredaction. Use a non-sensitive status description and retain only safe structured attributes such as the exit code.
span.SetStatus(codes.Error, err.Error())
pkg/state/span.go:62
- The release status description exports the full wrapped error. A release error can contain
helmexec.ExitError, including command arguments and subprocess output, so sensitive data remains exposed on the release span even if the child process span uses a safe description. Use a generic description or a dedicated sanitized error representation.
- Files reviewed: 41/42 changed files
- Comments generated: 8
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if err != nil { | ||
| span.SetStatus(codes.Error, err.Error()) | ||
| } |
| redacted := RedactArgs(args, RedactionStrict) | ||
| attrs = append(attrs, attribute.StringSlice("exec.args", redacted)) |
| attrs := []attribute.KeyValue{ | ||
| attribute.String("helmfile.release", release.Name), | ||
| attribute.String("helmfile.namespace", release.Namespace), | ||
| attribute.String("helmfile.chart", release.Chart), |
| var relErr *ReleaseError | ||
| relCtx, relSpan := st.startReleaseSpan("sync", release) | ||
| context := st.createHelmContext(release, workerIndex) | ||
| context.Ctx = relCtx |
| s.cmdSpan.RecordError(runErr) | ||
| s.cmdSpan.SetStatus(codes.Error, runErr.Error()) |
| } | ||
| } | ||
|
|
||
| endReleaseSpan(relSpan, "diff", nil) |
| func(id int) { | ||
| for release := range releases { | ||
| err := do(release, id) | ||
| err := st.doWithReleaseSpan(verb, release, id, do) |
| meters, err := newMeterProvider(ctx, res) | ||
| if err != nil { | ||
| warnf(opts.Logger, "OpenTelemetry tracing unavailable: %v", err) | ||
| return |
…om metrics Addresses all Copilot review comments on #2769: Security (span payloads): - exec.args: positional arguments are additionally passed through helmexec.RedactedURL, so credentials embedded in chart/repository URLs (AddRepo, RegistryLogin, OCI refs) are masked exactly like log output - release spans sanitize helmfile.chart the same way - error statuses no longer embed raw errors (which contain rendered commands, arguments, and subprocess output): the command span, release spans, hook spans, and exec spans now use generic descriptions; the concrete exit code remains an attribute, and RecordError on the root span is dropped Correctness: - kubedog safety valve restored: execWithContext now attaches the per-release span into the runner's own context instead of replacing it, so trackHandle.Cancel() can interrupt a wedged helm again and app cancellation semantics stay exactly as before the PR - diff release spans/metrics: real failures are recorded (exit code 2 "changes detected" still counts as success); previously every diff was exported as successful - skipped releases no longer emit phantom spans and inflate helmfile.release.count: iterateOnReleases callers pass a skip predicate (skipUndesired for status/test; delete deletes undesired releases and passes nil) - Setup shuts down the already-constructed tracer provider (bounded) when the metrics provider fails, instead of abandoning its batch goroutine Tests: URL redaction cases (masked/untouched), spanAttachedContext preserves the runner cancellation chain while attaching the caller's span, skipUndesired, and a failing-hook span asserting the generic message. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
|
All 8 review comments addressed in 7451968:
New tests: URL redaction (masked + untouched), |
- the skipUndesired insertion had displaced the // nolint: unparam directive off iterateOnReleases (helm param is intentionally unused there); also fixes a skipDesired/skipUndesired comment typo - use a typed nil in TestSpanAttachedContext (staticcheck SA1012) Refs: #2769 Signed-off-by: yxxhero <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Telemetry currently risks exporting credentials and contains lifecycle, hierarchy, and exit-status correctness issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (6)
Previously missed (5) — in code that hasn't changed since the last review.
main.go:87
- For an ordinary non-
ExitCodererror,errors.HandleExitCoderexits with status 3, but this fallback records 1 on the root span. Telemetry will therefore report a different exit code from the actual process for common Cobra/application errors.
pkg/config/global.go:394 - This implements OR semantics, so with
HELMFILE_OTEL_TRACING=true, explicitly passing--otel-tracing=falsestill enables telemetry. That contradicts the new flag help and user guide, which state that the flag overrides the environment variable. Track whether the flag was explicitly set and honor its value, or update all documentation to describe OR semantics.
pkg/telemetry/exporter.go:110 strconv.ParseFloat("NaN", 64)succeeds, and comparisons with NaN are false, soOTEL_TRACES_SAMPLER_ARG=NaNbypasses this validation and is passed toTraceIDRatioBasedinstead of falling back to 1.0 as documented. Rejectmath.IsNaN(ratio)(and add a regression case) alongside the range checks.
pkg/telemetry/metrics.go:34- These package-level instruments are obtained from the initial global delegating meter. OpenTelemetry's global meter delegates previously created instruments only on the first
SetMeterProvider; afterShutdownfollowed by the supported re-Setup, these instruments remain attached to the first, already-shut-down provider, so subsequent runs silently export no metrics. Recreate/cache instruments from each active provider (or otherwise avoid reinitialization) rather than retaining the startup-global instruments forever.
pkg/telemetry/otlptest/otlptest.go:114 - This helper is not hermetic for metrics: it never sets
OTEL_METRICS_EXPORTER, and signal-specific variables such asOTEL_EXPORTER_OTLP_METRICS_ENDPOINT/...TRACES_ENDPOINToverride the common endpoint. A developer or CI environment usingnone,console, or a signal-specific endpoint will make the OTLP assertions fail or send test data externally. Explicitly set both exporters and clear/override all signal-specific endpoint, protocol, and compression variables here.
pkg/helmexec/span.go:47
exec.argsis also emitted for arbitrary hook and plugin commands, butRedactionStrictonly recognizes a fixed set of Helm flags. For example, the new hook test's--secret hunter2arguments are exported unchanged by the childos.execspan. Since arbitrary executables can carry credentials in any argument (includingsh -cpayloads), omit arguments foros.execspans or make their capture explicitly opt-in rather than treating Helm-specific redaction as sufficient.
redacted := RedactArgs(args, RedactionStrict)
for i, a := range redacted {
// Positional arguments can be chart/repository URLs with embedded
// credentials (AddRepo, RegistryLogin); sanitize userinfo like the
// log output does.
redacted[i] = RedactedURL(a)
}
attrs = append(attrs, attribute.StringSlice("exec.args", redacted))
- Files reviewed: 41/42 changed files
- Comments generated: 6
- Review effort level: Balanced
| attribute.String("helmfile.command", cmdName), | ||
| attribute.String("helmfile.file", g.FileOrDir()), | ||
| attribute.String("helmfile.environment", g.Env()), | ||
| attribute.StringSlice("helmfile.selectors", g.Selectors()), |
| _, span := telemetry.Tracer(telemetry.ScopeHelmfile).Start(a.spanParentCtx(), "helmfile.discover_states", | ||
| trace.WithAttributes(attribute.String("helmfile.path", specifiedPath)), | ||
| ) |
| func RedactedURL(ref string) string { | ||
| refURL, err := url.ParseRequestURI(ref) | ||
| if err != nil { | ||
| return chart | ||
| return ref | ||
| } | ||
| return chartURL.Redacted() | ||
| return refURL.Redacted() |
| if isHelmBinary(base) { | ||
| if sub := helmSubcommand(args); sub != "" { | ||
| attrs = append(attrs, attribute.String("helm.subcommand", sub)) | ||
| } | ||
| return "helm.exec", attrs |
| Env: st.Env, | ||
| Logger: st.logger, | ||
| Fs: st.fs, | ||
| Ctx: hookTraceContext(), |
|
|
||
| if s.cmdSpan != nil { | ||
| s.cmdSpan.SetAttributes(attribute.Int("helmfile.exit_code", exitCode)) | ||
| if runErr != nil { |
…r helm binaries, hook release attribution Addresses all 6 new review comments on #2769: Security (remote references): - new helmexec.RedactedRef sanitizes go-getter style references for telemetry: forced-form prefixes (git::, s3::) preserved, whole URL userinfo masked (usernames carry tokens too), credential-bearing query parameters masked using pkg/remote's heuristic (token/password/secret/ key/signature). Applied to helmfile.file (command span), helmfile.path (discover_states), helmfile.chart (release spans), and exec.args — log-time RedactedURL is untouched so log output is unchanged Correctness: - wrapper helm binaries (--helm-binary custom names) are now classified as helm operations by an explicit context marker stamped in the execer funnel, instead of the executable-basename heuristic; the same classification gates helmfile.helm.exec.duration, so the metric no longer misses wrapper invocations (classifyExec) - release-scoped hooks (presync/postsync/preuninstall/postuninstall/ cleanup in the sync/delete/diff workers) now attach their helmfile.hook spans to the active helmfile.release.* span via a variadic parent on the trigger functions; global hooks keep the command context and all 29 existing call sites compile unchanged; hook cancellation stays detached (WithoutCancel) as before - signal-terminated runs (Shutdown with exitCode 130/143 and nil error) now mark the command span with error status, consistent with their nonzero exit code Tests: RedactedRef table (forced forms, userinfo, s3/token query params, untouched cases), classifyExec marker case, hookTraceContext parent attribution + non-cancellability + fallback. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
|
All 6 review comments addressed in 2d869d6:
New tests: |
There was a problem hiding this comment.
🟡 Changes recommended
It currently has a compilation failure plus telemetry accuracy, reinitialization, and credential-redaction defects.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
main.go:87
- Ordinary errors are actually terminated with status 3 by
errors.HandleExitCoder, but this records 1 on the root span. That makeshelmfile.exit_codedisagree with the process exit status for every non-ExitCoderfailure.
pkg/telemetry/telemetry.go:145 - Reinitialization does not restore metrics. The package-level instruments were obtained from OTel's initial delegating global meter; OTel wires those instruments only on the first
SetMeterProvider(delegateMeterOnce). AfterShutdownand a secondSetup, they remain attached to the first, already-shutdown provider, soRecord*silently emits nothing despite the documented/tested reinitializable lifecycle. Recreate/store instruments with each active provider rather than caching the pre-registration globals.
- Files reviewed: 43/44 changed files
- Comments generated: 6
- Review effort level: Balanced
| } | ||
| // The legacy profile is byte-identical to the historical inline logic; | ||
| // the goldens in exit_error_test.go pin its exact output. | ||
| redacted := RedactArgs(args, RedactionLegacy) |
| for i := range out { | ||
| var prev string | ||
| if i > 0 { | ||
| prev = out[i-1] |
| u, err := url.Parse(rest) | ||
| if err != nil || u.Scheme == "" || u.Host == "" { | ||
| // Not a URL (e.g. "./charts/demo"); leave it alone. | ||
| return ref | ||
| } |
| if u.RawQuery != "" { | ||
| q, err := url.ParseQuery(u.RawQuery) | ||
| if err == nil { | ||
| for key, values := range q { | ||
| if sensitiveQueryKey(key) { | ||
| for i := range values { | ||
| values[i] = redactedRefValue | ||
| } | ||
| } | ||
| } | ||
| u.RawQuery = q.Encode() | ||
| } | ||
| } |
| if ctx != nil { | ||
| if shell, ok := runner.(*ShellRunner); ok { | ||
| clone := *shell | ||
| clone.Ctx = spanAttachedContext(shell.Ctx, ctx) | ||
| runner = &clone | ||
| } | ||
| } |
| if shell, ok := runner.(*ShellRunner); ok { | ||
| ctx := shell.Ctx | ||
| if ctx == nil { | ||
| ctx = context.Background() | ||
| } | ||
| clone := *shell | ||
| clone.Ctx = context.WithValue(ctx, helmExecMarker{}, true) | ||
| runner = &clone | ||
| } |
…e runners Addresses 5 of the 6 new review comments on #2769 (the sixth — an unused strings import in exit_error.go — is a false positive: Indent still uses strings.Split/Builder and the package compiles): - RedactArgs read the previous token from the progressively redacted output, so {--set, --set-string, secret} leaked the secret (the masked value hid the following flag). Read the previous token from the original input, restoring the legacy contract for adjacent secret flags - RedactedRef fails closed for malformed references: URL-like refs with invalid percent escapes export a fully redacted value, and an unparseable query is dropped entirely instead of exported verbatim - ShellRunner has value receivers, so a ShellRunner VALUE satisfies the Runner API; the helm marker stamping and the per-release span attachment now handle both value and pointer forms (matching WithContext), so value-runner callers keep release nesting and the helm.exec classification/metric Regression tests: adjacent secret flags (legacy + strict), malformed URL-like ref, malformed query, value-runner marker + span attachment. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
|
Round 3 addressed in df7fd76 — 5 of 6 fixed, 1 false positive:
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved security, lifecycle, configuration, and instrumentation issues can leak hook arguments or produce incorrect telemetry.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (7)
Previously missed (6) — in code that hasn't changed since the last review.
cmd/root.go:90
- An explicit
--otel-tracing=falsecannot overrideHELMFILE_OTEL_TRACING=true:OtelTracing()sees the parsed false value and falls back to the environment, despite the new help and user guide saying the flag wins when specified. Checkc.Flags().Changed("otel-tracing")and use the flag value directly in that case.
pkg/helmexec/span.go:33 classifyExecruns even when telemetry is disabled, so every subprocess still copies all arguments, parses each one as a URL, and allocates the attribute slice before starting a no-op span. This contradicts the advertised zero-cost/allocation-free disabled path; add a cheap enabled fast path before building span attributes (and apply the same pattern to release-label sorting).
pkg/telemetry/exporter.go:78- Standard OpenTelemetry enum environment values are case-insensitive, but this parser treats values such as
ALWAYS_OFFas unsupported and silently falls back to always-on sampling. Normalize the sampler name before switching so a valid configuration cannot unexpectedly increase exported trace volume.
pkg/telemetry/exporter.go:125 OTEL_PROPAGATORSvalues are standard case-insensitive enums. As written,TraceContext,Baggageis ignored, so an otherwise valid configuration stops extracting the CI parent and creates an unrelated trace. Normalize each entry before the switch.
pkg/telemetry/metrics.go:22- These package-global instruments are created from the initial delegating global meter and bind to the first provider installed. OpenTelemetry only delegates those preexisting meters once, so after the supported
Shutdown→Setupcycle they still target the shut-down first provider and the fresh provider exports no metrics. Create/store instruments from each activeMeterProviderduring setup (with no-op instruments in the disabled state) instead of retaining init-time handles.
pkg/telemetry/otlptest/otlptest.go:114 - This helper does not set
OTEL_METRICS_EXPORTERor override signal-specific OTLP endpoint/protocol variables. A developer or CI environment withOTEL_METRICS_EXPORTER=nonemakesassertMetricsfail, whileOTEL_EXPORTER_OTLP_METRICS_ENDPOINTcan redirect the test away from this recorder. Override both signals explicitly so these advertised hermetic tests are environment-independent.
pkg/helmexec/span.go:56
- This exports every hook/plugin argument, but
RedactArgsonly recognizes a fixed set of Helm flags. Arbitrary hook arguments can contain rendered secrets—for example,bus_span_test.goitself invokes a hook with--secret hunter2, which is exported unchanged in the childos.execspan. Since generic commands have no knowable secret-flag vocabulary, omitexec.argsforos.execspans or switch to an explicit safe allowlist.
- Files reviewed: 43/44 changed files
- Comments generated: 1
- Review effort level: Balanced
| func (helm *execer) execWithRunner(runner Runner, args []string, env map[string]string, overrideEnableLiveOutput *bool) ([]byte, error) { | ||
| // Everything reaching this funnel is a helm invocation, even when the | ||
| // binary is a wrapper with a non-"helm" name (--helm-binary override); | ||
| // stamp the context so span classification does not rely on the | ||
| // executable basename. ShellRunner has value receivers, so a value |
execStdIn (registry login, repo add) called the runner directly, so wrapper --helm-binary names were misclassified as os.exec and omitted from helmfile.helm.exec.duration on that path. The marking now goes through a shared markHelmRunner helper (value and pointer ShellRunner forms) used by both execution funnels. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
|
Addressed in the pushed commit: the marking is factored into |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues affect secret redaction, cancellation behavior, metric lifecycle, and telemetry accuracy.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (5)
Previously missed (5) — in code that hasn't changed since the last review.
pkg/config/global.go:394
- This cannot implement the documented “flag overrides environment” behavior because a bool field cannot distinguish an omitted flag from explicit
--otel-tracing=false. WithHELMFILE_OTEL_TRACING=true, passing--otel-tracing=falsestill returns true, so users cannot disable inherited CI telemetry from the CLI. Track whether the pflag was explicitly set (or use a tri-state option) before falling back to the environment.
pkg/event/bus.go:223 - An explicitly supplied
ShellRunnerloses its existing context here:hookCtxis derived fromBus.Ctx(orBackground), so replacingr.Ctxdrops the runner's cancellation/deadline even when telemetry is disabled. This changes the pre-existing behavior for callers that inject a cancellable runner. Preserve the runner context and attach only the span fromhookCtx, asexecWithContextdoes.
pkg/helmexec/span.go:75 - Prefix matching classifies unrelated executables such as
helmfile,helmet, andhelmsmanas Helm. Hooks invoking those commands therefore emithelm.execspans and incrementhelmfile.helm.exec.durationwith misleading subcommands. Since execer calls are already authoritatively marked, restrict this fallback heuristic tohelm, numeric names such ashelm3, and the documentedhelm-*custom-build form.
pkg/helmexec/span.go:115 - Helm-diff exit code 2 means “changes detected” and is explicitly treated as an expected result in
pkg/state/state.go:3333-3351, but this function recordssuccess=falseand marks thehelm.execspan as an error for that same result. This makes the new metric and child span report failures on every changed release under--detailed-exitcode.
pkg/telemetry/telemetry.go:145 - The package-level instruments in
metrics.goare created from the initial global delegating meter, but OpenTelemetry Go v1.44 binds that delegate only on the firstSetMeterProvider. After the documentedShutdown→Setupreinitialization, those instruments still target the first, already-shut-down provider, so subsequent runs silently export no metrics. Store/recreate the instruments with each active provider instead of relying on repeated replacement of the global provider.
- Files reviewed: 43/44 changed files
- Comments generated: 1
- Review effort level: Balanced
Helm's global --kube-token carries a bearer token; both the two-argument and inline forms are now masked in span exec.args (legacy exit-error output is untouched, matching its historical behavior). Refs: #2769 Signed-off-by: yxxhero <[email protected]>
|
Addressed: |
- helmfile.helm.exec.duration now declares explicit bucket boundaries
tuned for seconds-scale helm invocations (5ms…600s); the SDK defaults
are millisecond-oriented and lumped every sub-5s invocation — the
common case — into the first bucket, defeating the histogram
- instruments are re-created under the installed provider with the
instrumentation scope version stamped (Setup-time, race-free)
- helmfile.release.count declares the {release} curly-annotation unit
per the metrics naming conventions
Tested end-to-end via the OTLP integration test: exported bounds are
the tuned set, units are asserted, and the scope carries the version.
Refs: #2769
Signed-off-by: yxxhero <[email protected]>
|
Metrics best-practice alignment (self-review finding, fixed in the pushed commit):
All three verified in the OTLP integration test (exported explicit bounds, units, and scope version asserted). |
New helmfile.release.duration histogram (seconds, same tuned buckets) with bounded dimensions by default (verb, result). Setting HELMFILE_OTEL_METRICS_PER_RELEASE=true adds helmfile.release and helmfile.namespace, answering "which release is slow" from dashboards: - well-suited to bounded CI runs; long-lived centralized collection needs a backend capacity/TTL story (documented in docs/otel.md) - per-release timing remains available in traces without the flag - env read per call (release operations are low-frequency, and tests toggle it) endReleaseSpan now takes the release and the operation start time; the five worker-loop call sites pass them (doWithReleaseSpan, SyncReleases, DeleteReleasesForSync, PrepareCharts, DiffReleases). Verified end-to-end with the console exporter (default dims vs per-release) and OTLP integration tests pinning both modes. Refs: #2767, #2769 Signed-off-by: yxxhero <[email protected]>
|
Added per-release duration metrics (opt-in): new |
…bing - StartCommandSpan copies the tracingState struct instead of enumerating fields by hand — that pattern dropped the meter provider once already - the two value/pointer ShellRunner switches (helm marker, span attachment) are unified into one withRunnerCtx helper; the duplication caused two review rounds of value-form misses - classifyExec derives the helm classification from the span name (helmExecSpanName constant) instead of returning a third parallel bool - metrics: shared outcomeAttrs for the verb/result dimensions, and the bucket slice renamed to durationBuckets with a comment covering both histograms that use it No behavior change; full -race suite green, lint clean. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
…ook prep; sync the design doc Maintainability: - HermeticEnvVars is now exported from pkg/telemetry (the owner of the env surface) and used by both telemetry tests and otlptest — the two copies had already drifted once (HELMFILE_OTEL_METRICS_PER_RELEASE needed updating in both) - kubedogTraceContext and hookTraceContext were the same concept written twice; unified into traceOnlyContext(parent...) in span.go Readability: - runHook's nested kubectl rewrite extracted into prepareKubectlHook with guard-clause structure Accuracy (docs ↔ code, drifted over five review rounds): - §4.4 now describes the implemented mechanism: the release span is INJECTED into the runner's own context (preserving the kubedog safety valve) rather than the runner context being replaced, and helm classification is marker-based for wrapper binaries - §5 exec span rows list the actual attributes incl. URL/query masking - §6 strict profile documents RedactedRef, --kube-token, and the adjacent-token guarantee No behavior change; full -race suite green, lint clean. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
…, sync user-facing accuracy - tracingState.noop was dead weight in the enabled state and a copy-surface in every transition; a single package-level noopTracerProvider now backs Tracer while disabled - skipUndesired moved next to doWithReleaseSpan in span.go, its only conceptual home (span/metric suppression, not run plumbing) - accuracy: the package doc, --otel-tracing flag help, experimental-features entry, and CHANGELOG now all say tracing AND metrics and list the third instrument (helmfile.release.duration with the HELMFILE_OTEL_METRICS_PER_RELEASE opt-in) — these had drifted when the metric was added; the PR description's metric table is updated to match as well No behavior change; full -race suite green (except the pre-existing network-dependent TestStorage_resolveFile flake), lint clean. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
…t fake; fix instrument-count drift Readability/maintainability: - Setup drops from 56 to 39 lines: provider construction (including the shutdown-tracer-on-meter-failure recovery) moves to newProviders in exporter.go next to the constructors it composes - refredact's magic 16 becomes maxForcedFormPrefix with a comment - span_test's hand-rolled fakeRunner removed in favor of the existing mockRunner (same package) Accuracy: - "Two instruments" wording survived in docs/otel.md and the design proposal §7 after helmfile.release.duration was added; both now say three and mention the per-release opt-in No behavior change; full -race suite green (except the pre-existing network flake), lint clean. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
…x docs nits - the span plumbing helpers (markHelmExec, withRunnerCtx, markHelmRunner, spanAttachedContext) move from exec.go to span.go, next to the marker type and classifiers they serve — exec.go keeps only the funnel call sites - otlptest.SpanNames was never used outside the package; unexported - isHelmBinary's comment now states it is the FALLBACK classifier (funnel invocations are marker-classified), replacing the outdated "cosmetic distinction" framing from before the marker existed - docs/otel.md: release-scoped hooks nest under their release span (added in review round 2, never documented) No behavior change; full -race suite green, lint clean. Refs: #2769 Signed-off-by: yxxhero <[email protected]>
Resolve conflict in pkg/helmexec/exec.go: keep upstream's new ShowChartWithFlags API from #2768, adapted to the 2-arg helm.exec signature introduced by this branch. Signed-off-by: yxxhero <[email protected]>
…601) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [aqua:helmfile/helmfile](https://github.com/helmfile/helmfile) | tools | minor | `1.7.4` → `1.8.0` | --- ### Release Notes <details> <summary>helmfile/helmfile (aqua:helmfile/helmfile)</summary> ### [`v1.8.0`](https://github.com/helmfile/helmfile/releases/tag/v1.8.0) [Compare Source](helmfile/helmfile@v1.7.4...v1.8.0) #### What's Changed - build(deps): bump github.com/stretchr/testify from 1.11.1 to 1.12.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2749](helmfile/helmfile#2749) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.36 to 1.32.37 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2750](helmfile/helmfile#2750) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.1 to 1.107.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2751](helmfile/helmfile#2751) - build(deps): bump github.com/stretchr/testify from 1.12.0 to 1.12.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2752](helmfile/helmfile#2752) - docs: fix broken star history chart by [@​Dessalines39394](https://github.com/Dessalines39394) in [#​2742](helmfile/helmfile#2742) - build(deps): bump github.com/mattn/go-runewidth from 0.0.27 to 0.0.28 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2753](helmfile/helmfile#2753) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.37 to 1.32.38 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2755](helmfile/helmfile#2755) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.2 to 1.107.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2756](helmfile/helmfile#2756) - build(deps): bump helm-diff to v3.15.12 by [@​yxxhero](https://github.com/yxxhero) in [#​2759](helmfile/helmfile#2759) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.38 to 1.33.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2762](helmfile/helmfile#2762) - build(deps): bump github.com/gofrs/flock from 0.13.0 to 0.13.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2761](helmfile/helmfile#2761) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.3 to 1.109.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2760](helmfile/helmfile#2760) - build(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2763](helmfile/helmfile#2763) - feat: allow helmfile to continue on failed releases by [@​ceriath](https://github.com/ceriath) in [#​2616](helmfile/helmfile#2616) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.109.1 to 1.110.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2764](helmfile/helmfile#2764) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.1 to 1.33.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2765](helmfile/helmfile#2765) - fix: resolve OCI version constraints before deriving the shared chart cache path by [@​samifruit514](https://github.com/samifruit514) in [#​2768](helmfile/helmfile#2768) - feat: opt-in OpenTelemetry tracing and metrics (experimental) by [@​yxxhero](https://github.com/yxxhero) in [#​2769](helmfile/helmfile#2769) - build(deps): bump go.opentelemetry.io/otel from 1.44.0 to 1.46.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2778](helmfile/helmfile#2778) - build(deps): bump github.com/mattn/go-runewidth from 0.0.28 to 0.0.29 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2776](helmfile/helmfile#2776) - build(deps): bump go.opentelemetry.io/otel/sdk/metric from 1.44.0 to 1.46.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2777](helmfile/helmfile#2777) - build(deps): bump go.opentelemetry.io/proto/otlp from 1.10.0 to 1.11.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2774](helmfile/helmfile#2774) - build(deps): bump go.opentelemetry.io/otel/sdk from 1.44.0 to 1.46.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2775](helmfile/helmfile#2775) - build(deps): bump gitpython from 3.1.58 to 3.1.59 in /docs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2785](helmfile/helmfile#2785) - build(deps): bump google.golang.org/grpc from 1.83.1 to 1.83.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2784](helmfile/helmfile#2784) - build(deps): bump google.golang.org/protobuf from 1.36.12-0.20260120151049-f2248ac996af to 1.36.12 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2783](helmfile/helmfile#2783) - build(deps): bump golang.org/x/sync from 0.22.0 to 0.23.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2782](helmfile/helmfile#2782) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.2 to 1.33.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2781](helmfile/helmfile#2781) - build(deps): bump go.opentelemetry.io/contrib/exporters/autoexport from 0.67.0 to 0.71.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2780](helmfile/helmfile#2780) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.110.0 to 1.111.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2779](helmfile/helmfile#2779) - fix(list): avoid deadlock in `helmfile list` with more than 100 states by [@​max06](https://github.com/max06) in [#​2773](helmfile/helmfile#2773) - chore: bump Helm to v3.22.0 and v4.3.0 by [@​yxxhero](https://github.com/yxxhero) in [#​2786](helmfile/helmfile#2786) - build(deps): bump helm-diff to v3.15.13 by [@​yxxhero](https://github.com/yxxhero) in [#​2788](helmfile/helmfile#2788) - feat(remote): support wildcards in remote values/secrets file selectors by [@​hoppla20](https://github.com/hoppla20) in [#​2787](helmfile/helmfile#2787) - build(deps): bump helmfile/vals from v0.46.0 to v0.46.1 by [@​yxxhero](https://github.com/yxxhero) in [#​2789](helmfile/helmfile#2789) #### New Contributors - [@​Dessalines39394](https://github.com/Dessalines39394) made their first contribution in [#​2742](helmfile/helmfile#2742) - [@​samifruit514](https://github.com/samifruit514) made their first contribution in [#​2768](helmfile/helmfile#2768) - [@​max06](https://github.com/max06) made their first contribution in [#​2773](helmfile/helmfile#2773) - [@​hoppla20](https://github.com/hoppla20) made their first contribution in [#​2787](helmfile/helmfile#2787) **Full Changelog**: <helmfile/helmfile@v1.7.4...v1.8.0> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC43OS42IiwidXBkYXRlZEluVmVyIjoiNDQuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9taW5vciJdfQ==--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/601
helmfile 1.8.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * build(deps): bump github.com/stretchr/testify from 1.11.1 to 1.12.0 by @dependabot[bot] in helmfile/helmfile#2749 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.36 to 1.32.37 by @dependabot[bot] in helmfile/helmfile#2750 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.1 to 1.107.2 by @dependabot[bot] in helmfile/helmfile#2751 * build(deps): bump github.com/stretchr/testify from 1.12.0 to 1.12.1 by @dependabot[bot] in helmfile/helmfile#2752 * docs: fix broken star history chart by @Dessalines39394 in helmfile/helmfile#2742 * build(deps): bump github.com/mattn/go-runewidth from 0.0.27 to 0.0.28 by @dependabot[bot] in helmfile/helmfile#2753 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.37 to 1.32.38 by @dependabot[bot] in helmfile/helmfile#2755 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.2 to 1.107.3 by @dependabot[bot] in helmfile/helmfile#2756 * build(deps): bump helm-diff to v3.15.12 by @yxxhero in helmfile/helmfile#2759 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.38 to 1.33.1 by @dependabot[bot] in helmfile/helmfile#2762 * build(deps): bump github.com/gofrs/flock from 0.13.0 to 0.13.1 by @dependabot[bot] in helmfile/helmfile#2761 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.3 to 1.109.1 by @dependabot[bot] in helmfile/helmfile#2760 * build(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.1 by @dependabot[bot] in helmfile/helmfile#2763 * feat: allow helmfile to continue on failed releases by @ceriath in helmfile/helmfile#2616 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.109.1 to 1.110.0 by @dependabot[bot] in helmfile/helmfile#2764 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.1 to 1.33.2 by @dependabot[bot] in helmfile/helmfile#2765 * fix: resolve OCI version constraints before deriving the shared chart cache path by @samifruit514 in helmfile/helmfile#2768 * feat: opt-in OpenTelemetry tracing and metrics (experimental) by @yxxhero in helmfile/helmfile#2769 * build(deps): bump go.opentelemetry.io/otel from 1.44.0 to 1.46.0 by @dependabot[bot] in helmfile/helmfile#2778 * build(deps): bump github.com/mattn/go-runewidth from 0.0.28 to 0.0.29 by @dependabot[bot] in helmfile/helmfile#2776 * build(deps): bump go.opentelemetry.io/otel/sdk/metric from 1.44.0 to 1.46.0 by @dependabot[bot] in helmfile/helmfile#2777 * build(deps): bump go.opentelemetry.io/proto/otlp from 1.10.0 to 1.11.0 by @dependabot[bot] in helmfile/helmfile#2774 * build(deps): bump go.opentelemetry.io/otel/sdk from 1.44.0 to 1.46.0 by @dependabot[bot] in helmfile/helmfile#2775 * build(deps): bump gitpython from 3.1.58 to 3.1.59 in /docs by @dependabot[bot] in helmfile/helmfile#2785 * build(deps): bump google.golang.org/grpc from 1.83.1 to 1.83.2 by @dependabot[bot] in helmfile/helmfile#2784 * build(deps): bump google.golang.org/protobuf from 1.36.12-0.20260120151049-f2248ac996af to 1.36.12 by @dependabot[bot] in helmfile/helmfile#2783 * build(deps): bump golang.org/x/sync from 0.22.0 to 0.23.0 by @dependabot[bot] in helmfile/helmfile#2782 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.2 to 1.33.3 by @dependabot[bot] in helmfile/helmfile#2781 * build(deps): bump go.opentelemetry.io/contrib/exporters/autoexport from 0.67.0 to 0.71.0 by @dependabot[bot] in helmfile/helmfile#2780 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.110.0 to 1.111.0 by @dependabot[bot] in helmfile/helmfile#2779 * fix(list): avoid deadlock in `helmfile list` with more than 100 states by @max06 in helmfile/helmfile#2773 * chore: bump Helm to v3.22.0 and v4.3.0 by @yxxhero in helmfile/helmfile#2786 * build(deps): bump helm-diff to v3.15.13 by @yxxhero in helmfile/helmfile#2788 * feat(remote): support wildcards in remote values/secrets file selectors by @hoppla20 in helmfile/helmfile#2787 * build(deps): bump helmfile/vals from v0.46.0 to v0.46.1 by @yxxhero in helmfile/helmfile#2789 ## New Contributors * @Dessalines39394 made their first contribution in helmfile/helmfile#2742 * @samifruit514 made their first contribution in helmfile/helmfile#2768 * @max06 made their first contribution in helmfile/helmfile#2773 * @hoppla20 made their first contribution in helmfile/helmfile#2787 **Full Changelog**: https://github.com/helmfile/helmfile/compare/v1.7.4...v1.8.0</pre> <p>View the full release notes at <a href="https://github.com/helmfile/helmfile/releases/tag/v1.8.0">https://github.com/helmfile/helmfile/releases/tag/v1.8.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!20121
Fixes #2767 (originally raised in #2758)
Summary
Adds opt-in OpenTelemetry tracing and metrics to helmfile — the same capability Terragrunt ships — so CI/CD runs can show where time is spent, what runs most often (label selectors), and what to target for improvement.
Everything is off by default (
--otel-tracing/HELMFILE_OTEL_TRACING=true) and configured through the standardOTEL_*environment variables — helmfile defines no telemetry-specific knobs of its own beyond the on/off switch. Full design indocs/proposals/otel-tracing.md(every code claim in it was verified against the source; see §4.3 "context-reality map").What a run looks like
helmfile --otel-tracing template(console exporter, local chart):Sync/diff/delete/status/test additionally nest their helm subprocesses under the release span via a per-call context (no
helmexec.Interfacesignature changes, no mutation of the shared cached execer). Hooks producehelmfile.hookspans whoseos.execchildren nest under them. A remote parent injected by CI (TRACEPARENT) is honored automatically.Metrics (same provider/switch/resource)
helmfile.helm.exec.durationsubcommand,successhelmfile.release.durationverb,result— plushelmfile.release/helmfile.namespacewhenHELMFILE_OTEL_METRICS_PER_RELEASE=truehelmfile.release.count{release})verb,resultOTEL_METRICS_EXPORTER:otlp(default) /console/prometheus/none.Security
--set,--set=k=v,--set-string/-file/-json/-literal,--username,--password,--key-file) are never recorded on spans.legacyis byte-identical to today's exit-error behavior (existing goldens inexit_error_test.gopass unchanged);strict(spans) is a superset. Span visibility is guaranteed at least as redacted as error messages.Zero functional impact
app.Newis Background-identical.context.WithoutCancel. Semantic fixes belong in separate issues.Testing
httptestreceiver, no external collector): span export, error status/exit code, redaction, parent-linkage to the command span, hook nesting, and metric datapoints.-race -p=1; golangci-lint introduces zero new findings.Docs
docs/otel.md(user guide),docs/experimental-features.mdentry,docs/cli.mdflag,docs/index.mdhighlight, CHANGELOG, and the design proposal above.Follow-ups (documented in the proposal §12)
TemplateRelease/Lint/Unittestexec nestingCommits
Incrementally shippable and revertible: lifecycle+root span → process spans+redaction+bridges → state-load/hook spans → per-release spans → exec nesting completion → metrics → docs.