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

Setting existing span's status code/description #197

Closed
mechie opened this issue May 10, 2023 · 4 comments
Closed

Setting existing span's status code/description #197

mechie opened this issue May 10, 2023 · 4 comments

Comments

@mechie
Copy link

mechie commented May 10, 2023

A fairly common use case in our non-otel-cli-instrumented code is:

  1. Open a span
  2. Do work
  3. If a failure occurs, record it as an event and then set the span's status to Error
  4. Close the span

I don't see a way to modify an existing background span via the cli commands, maybe span could have a new subcommand, modify, existing, or status? Or, although not as flexible, span end could take span's optional --status-code/--status-description flags, since a caller could reasonably store the outcome of their background span and set it at the end.

Alternatively, this might already a feature and I'm not finding the way to do so 😅 If so, would appreciate an example.

@tobert
Copy link
Collaborator

tobert commented May 10, 2023

I like the idea of adding the --status-code and --status-description flags to otel-cli span end. It makes sense and isn't super hard to add. I'll take a look.

@tobert
Copy link
Collaborator

tobert commented May 10, 2023

I got it working in #201, I'm gonna sleep on it so I can review the PR with fresher eyes and likely merge tomorrow.

tobert added a commit that referenced this issue May 12, 2023
…ans #197 (#201)

* break status code params out to their own helper

they'll also be used by span_end.go

* add support for StatusCode and StatusDescription

* add support for status code and desc on span background end

Adds support to set --status-code and --status-description when calling
otel-cli span end, along with tests.
@tobert
Copy link
Collaborator

tobert commented May 12, 2023

Merged :) I'll try to do a release next week, week after at the latest. I have a couple more things I want to clean up post-#175 before releasing.

@tobert
Copy link
Collaborator

tobert commented May 26, 2023

release v0.3.0, please reopen if there's still an issue

@tobert tobert closed this as completed May 26, 2023
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

No branches or pull requests

2 participants