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

bug: fix structured logging crash #174

Merged

Conversation

emattiza
Copy link
Contributor

configures the log layer to have an appropriate FormatFields when using json, or uses the default Full configuration

Feature or Problem

Crashing when running WADM_TRACING_ENABLED=true WADM_STRUCTURED_LOGGING=true RUST_LOG=debug RUST_BACKTRACE=1 cargo run --features cli --bin wadm

WADM_TRACING_ENABLED=true WADM_STRUCTURED_LOGGING=true cargo run --features cli --bin wadm
     Running `target/debug/wadm`
RUST_LOG was not set or the given directive was invalid: FromEnvError { kind: Env(NotPresent) }
Defaulting logger to `info` level
{"timestamp":"2023-09-12T14:33:16.518961Z","level":"INFO","fields":{"message":"event: connected"},"target":"async_nats::options"}
thread 'main' panicked at 'span 'new' had malformed fields! this is a bug.
  error: EOF while parsing a value at line 1 column 0
  fields: FormattedFields { fields: "", formatter: tracing_subscriber::fmt::format::DefaultFields, was_ansi: true }', /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.17/src/fmt/format/json.rs:197:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Related Issues

partially addresses #147

Release Information

next

Consumer Impact

enables structured logging without crashing

Testing

See above command

Built on platform(s)

  • x86_64-linux
  • aarch64-linux
  • x86_64-darwin
  • aarch64-darwin
  • x86_64-windows

Tested on platform(s)

  • x86_64-linux
  • aarch64-linux
  • x86_64-darwin
  • aarch64-darwin
  • x86_64-windows

Unit Test(s)

none

Acceptance or Integration

none

Manual Verification

see above command

Comments

I think additionally the rest of the issue may need addressing with a deeper refactor, and we can use other projects as a guide of sorts (like linkerd2-proxy here https://github.com/linkerd/linkerd2-proxy/blob/main/linkerd/tracing/src/lib.rs)

configures the log layer to have an appropriate FormatFields when
using json, or uses the default Full configuration

partially addresses wasmCloud#147

Signed-off-by: Evan Mattiza <emattiza@gmail.com>
Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix here!

@thomastaylor312
Copy link
Contributor

Oh and also, I’d love the idea of refactoring this. I figured it out once and have copy pasted since then 😅

@thomastaylor312 thomastaylor312 merged commit 226bb82 into wasmCloud:main Sep 12, 2023
5 checks passed
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 this pull request may close these issues.

2 participants