Skip to content

Conversation

@llgerard
Copy link
Contributor

When logging errors, it is very useful to log the request Id (and xray id if available). But, not every one might want it, so we probably don't want to include it by default in every log.

The solution proposed in this PR is to use a span with fields containing the request id and xray id. Then, to get the request id part of the log messages, one has to enable logging spans in the logger setup (using tracing_subscriber for example).

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

Tracing filters by default trim events and *spans* according to the level.
This means that entering a span with a level below the threshold will
be a no-op and the current span is not updated.

The lambda request span is a meaningful info one, so bump to INFO level.
@calavera
Copy link
Contributor

@llgerard can you run cargo fmt and push the code properly formatted?

@llgerard
Copy link
Contributor Author

@calavera I had it formatted already. I reran cargo fmt when changing the name (commit just above), but nothing was changed.

Which part looks improperly formatted?

Copy link
Contributor

@calavera calavera left a comment

Choose a reason for hiding this comment

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

LGTM

@calavera calavera merged commit 181c5d9 into aws:main Dec 16, 2022
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