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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling warning message for SpanTrace capture #32

Closed
Mythra opened this issue Jul 1, 2020 · 4 comments 路 Fixed by #33
Closed

Disabling warning message for SpanTrace capture #32

Mythra opened this issue Jul 1, 2020 · 4 comments 路 Fixed by #33
Assignees

Comments

@Mythra
Copy link
Contributor

Mythra commented Jul 1, 2020

Hey 馃憢 Thanks for the great library!

After installing tracing without adding in a ErrorLayer::default() (since that prints span traces which I don't want), even when returning an error from a main function I see a note about:

Warning: SpanTrace capture is Unsupported.
Ensure that you've setup an error layer and the versions match

Specifically a full error message looks like:

$  ../../../target/dl
Error: 
   0: Failed to parse as yaml

 --> .dl/dl-tasks.yml:1:11
  |
...
3 |   - type: ppipeline
  |           ^ tasks[0].type: unknown variant `ppipeline`, expected one of `command`, `oneof`, `pipeline`, `parallel-pipeline` at line 3 column 11
  |

Warning: SpanTrace capture is Unsupported.
Ensure that you've setup an error layer and the versions match

Suggestion: Instead of: "ppipeline", Did you mean: "pipeline"
Note: Full types, and supported values are documented at: https://dev-loop.kungfury.io/docs/schemas/task-conf-file

Is there anyway to remove that: warning: SpanTrace capture is Unsupported message? I've specifically set it up this way because I don't want span traces captured unless a user is specifically asking for it. As for most users of this binary it won't actually be useful (and serve to confuse potential users who don't understand, and shouldn't have to understand the internals of the tool).

@yaahc
Copy link
Collaborator

yaahc commented Jul 1, 2020

if you're not compiling with an error layer it's probably safe to just disable all the tracing support with default-features = false. that should hopefully disable the warning

@Mythra
Copy link
Contributor Author

Mythra commented Jul 1, 2020

Thanks, it's good to know it is a compile time flag. Unfortunately the problem is I do want span traces some of the time, and ideally I'd like to distribute it to users as such (right now I've been adding it if RUST_BACKTRACE or RUST_LIB_BACKTRACE is present in the environment).

There are some cases where it is incredibly useful, just not the default. I can imagine a couple issues where I might ask a user for a span trace, but in the case of the example above (a user typo'd a piece of config) it's just not useful there?

@yaahc
Copy link
Collaborator

yaahc commented Jul 1, 2020

Oh okay. I think the solution is just to add some check of an env variable before capturing SpanTraces when constructing Reports. If the error layer isn't setup but the SpanTrace is None it should skip printing the warning.

I think I'd still prefer to default to capturing SpanTraces, so it would only not capture them if the RUST_SPANTRACE variable is defined and set to 0. You would need to explicitly check if the variable is unset on startup and set it to 0 with std::env::set_var, would this work for you?

@Mythra
Copy link
Contributor Author

Mythra commented Jul 1, 2020

Yep! That'd be more than fine.

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