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

Update _X_AMZN_TRACE_ID on every invoke #269

Merged
merged 1 commit into from Mar 5, 2020

Conversation

bmoffatt
Copy link
Collaborator

@bmoffatt bmoffatt commented Mar 5, 2020

Issue #, if available:

#236

Description of changes:

Updates the value of the environment variable _X_AMZN_TRACE_ID on every invoke. This is consistent with the docs

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

@bmoffatt bmoffatt requested a review from mukhtar March 5, 2020 13:26
@codecov-io
Copy link

codecov-io commented Mar 5, 2020

Codecov Report

Merging #269 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
+ Coverage   74.59%   74.63%   +0.03%     
==========================================
  Files          20       20              
  Lines         681      682       +1     
==========================================
+ Hits          508      509       +1     
  Misses        128      128              
  Partials       45       45
Impacted Files Coverage Δ
lambda/function.go 60.78% <100%> (+0.78%) ⬆️

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 4a86f66...bade9a7. Read the comment docs.

@bmoffatt bmoffatt merged commit dd65554 into aws:master Mar 5, 2020
@bmoffatt bmoffatt deleted the x-amzn-trace-id branch March 5, 2020 17:43
@alex
Copy link
Contributor

alex commented Mar 5, 2020

I don't think this will work. The Go Lambda support uses net/rpc to server traffic. net/rpc spawns a go-routine per incoming connection.

Unless there's no concurrency at all here, because only a single connection is ever established, these environment variables will become a race condition, constantly stomping over each other between concurrent connections. Environemnt variables in general cannot be used for state for this reason.

If it really is the case that there's no concurrency, I'd implore you to add a comment next to the Setenv call.

@mhart
Copy link

mhart commented Mar 5, 2020

A single Lambda (unix) process only ever processes one request at a time

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.

None yet

6 participants