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

add RequestID for each request #543

Merged
merged 4 commits into from
Nov 20, 2017
Merged

add RequestID for each request #543

merged 4 commits into from
Nov 20, 2017

Conversation

DrMegavolt
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 17, 2017

Codecov Report

Merging #543 into master will increase coverage by 0.03%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
+ Coverage   88.51%   88.55%   +0.03%     
==========================================
  Files         114      114              
  Lines        3553     3556       +3     
==========================================
+ Hits         3145     3149       +4     
+ Misses        408      407       -1
Impacted Files Coverage Δ
lib/policies/log/log.js 88.88% <0%> (-1.12%) ⬇️
lib/gateway/context.js 100% <100%> (ø) ⬆️
lib/db.js 76.66% <0%> (+3.33%) ⬆️

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 58d691d...6080e65. Read the comment docs.

@altsang
Copy link
Contributor

altsang commented Nov 19, 2017

I believe this has become requestId or something alone those lines - can we update the issue description

@XVincentX
Copy link
Member

@altsang
Just a clarification — this pull request will add this ID for each single request that's hitting the gateway, even if you're not interested in any tracking feature at all.

Do we want go in this way? Wouldn't it be better to be a core policy — so you pay only for what you use?

@altsang
Copy link
Contributor

altsang commented Nov 19, 2017 via email

@altsang
Copy link
Contributor

altsang commented Nov 19, 2017 via email

@XVincentX
Copy link
Member

@altsang No, we do not have such feature right now. In the current PR the requestID will always be added, whether you want it or not.

If we make it as a policy, the user would be responsible to put the ID in the request or not.

@altsang
Copy link
Contributor

altsang commented Nov 19, 2017 via email

@altsang
Copy link
Contributor

altsang commented Nov 19, 2017

so I looked at this outside of just the Waffle.io comments, it's fine - it adds a variable as part of egContext object, if later folks don't like this we can put in a flag to turn it off in system.config.yml for now it's fine

Copy link
Member

@XVincentX XVincentX left a comment

Choose a reason for hiding this comment

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

That looks good to me.

One thing though — I can see you're also modifying the egContext properties as well the way we run code in sandbox. This does not seem to be necessary for this PR (and indeed codeconv is complaining about lack of testing in this part). Is it preparatory for some subsequent PR?

@DrMegavolt DrMegavolt changed the title add traceid for each request add RequestID for each request Nov 20, 2017

const uuid62 = require('uuid-base62');
function EgContextBase () {
this.requestId = uuid62.v4();
Copy link
Member

Choose a reason for hiding this comment

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

Any linter advice on requestId vs requestID. I tend to follow the latter pattern as that's what built-in JavaScript functions adhere to (e.g., encodeURI).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, ObjectID, MySQL, GraphQL kind of thing.

@kevinswiber
Copy link
Member

Looks good to me. Just one question on the case of the property name.

@XVincentX
Copy link
Member

XVincentX commented Nov 20, 2017 via email

@DrMegavolt
Copy link
Contributor Author

Changed to requestID, will update 546 as well

@DrMegavolt DrMegavolt merged commit 544bc2e into master Nov 20, 2017
@DrMegavolt DrMegavolt deleted the feature/traceId branch November 20, 2017 17:03
@DrMegavolt DrMegavolt removed the test label Nov 20, 2017
gatherchou pushed a commit to yilu-tech/express-gateway that referenced this pull request Jul 29, 2021
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.

4 participants