equinix-labs / equinix-labs/otel-cli
SoftFail after span closure masks exec failure
- Dominant language
- Go
- Stars
- 716
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
If `config.SoftFail` is called after an `exec` has finished (e.g. due to the OTel collector returning a non-compliant header), otel-cli [will return 0][1] (or 1, if `--fail`/`OTEL_CLI_FAIL=true`), masking any failures in the underlying operation.
Instead, it should probably do something like:
```golang
# exitCode could be a parameter, or come from a helper that fetches it?
if c.Fail {
os.Exit(exitCode | 1) // or just `1`?
} else {
os.Exit(exitCode)
}
```
Otherwise, otel-cli should probably make clear that its surfacing of the operation's return code is incidental, maybe provide some alternative method of surfacing it (export an `OTEL_CLI_LAST_RC`?).
[1]: https://github.com/equinix-labs/otel-cli/blob/3a5648dd799fcb430275a1c139e01b30f4ba22ef/otelcli/config.go#L384C3-L384C13
Contributor guide
Assessment
This issue has not been assessed yet.