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

feat: add xray_trace_id key when tracing is active #137 #150

Merged

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Aug 30, 2020

Issue #, if available: #137

Description of changes:

When X-Ray is enabled, Logger will include a xray_trace_id key with the value of the Trace ID captured from the environment.

UPDATE: Given X-Ray Trace ID will change on a per invocation we cannot support changing the order of xray_trace_id. If you don't enable X-Ray this will key only appear.

When enabled

{
    "level": "INFO",
    "location": "<module>:7",
    "message": "Testing x-ray id...",
    "timestamp": "2020-08-30 17:03:12,653",
    "service": "blah",
    "sampling_rate": 0.0,
    "xray_trace_id": "1-5759e988-bd862e3fe1be46a994272793"
}

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2020

Codecov Report

Merging #150 into develop will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #150   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          705       714    +9     
  Branches        68        68           
=========================================
+ Hits           705       714    +9     
Impacted Files Coverage Δ
aws_lambda_powertools/logging/formatter.py 100.00% <100.00%> (ø)
aws_lambda_powertools/logging/logger.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 319c363...20e7f33. Read the comment docs.

@heitorlessa heitorlessa self-assigned this Aug 30, 2020
@heitorlessa heitorlessa added feature New feature or functionality and removed enhancement labels Aug 30, 2020
@heitorlessa heitorlessa marked this pull request as draft August 30, 2020 17:37
@heitorlessa heitorlessa marked this pull request as ready for review September 1, 2020 15:17
@heitorlessa heitorlessa merged commit adc6b40 into aws-powertools:develop Sep 1, 2020
@heitorlessa heitorlessa deleted the feat/logger-add-xray-trace-id branch September 1, 2020 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants