Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

otel-cli exec does not report a span if the command failed #258

Closed
parsonsmatt opened this issue Aug 31, 2023 · 1 comment · Fixed by #259
Closed

otel-cli exec does not report a span if the command failed #258

parsonsmatt opened this issue Aug 31, 2023 · 1 comment · Fixed by #259

Comments

@parsonsmatt
Copy link
Contributor

$ otel-cli exec -- false

The above example does not report a span. If I run with --verbose, then I see this:

$ otel-cli exec --verbose -- false
2023/08/30 18:36:07 command failed: exit status 1

I think the issue is here:

	if err := child.Run(); err != nil {
		config.SoftFail("command failed: %s", err)
	}
	span.EndTimeUnixNano = uint64(time.Now().UnixNano())

	ctx, err := otlpclient.SendSpan(ctx, client, config, span)
	if err != nil {
		config.SoftFail("unable to send span: %s", err)
	}

Calling config.SoftFail is going to exit immediately. What is probably intended instead is to record the span with an error code.

@tobert
Copy link
Collaborator

tobert commented Sep 13, 2023

Yep, the first config.SoftFail is the problem. My bad. If we get the test in your PR working, it'll make sure this doesn't revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants