-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
correlation-id plugin, fixes #1086 #1094
Conversation
end | ||
|
||
-- For later use, to echo it back downstream | ||
ngx.ctx.correlationid_header_value = header_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this feature benefits the plugin. I would expect such a behavior to be quite private and only related to the internals of one's infrastructure. I would be in favor of making this behavior configurable, and disabled by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Echoing back downstream?
Sure it will - it will help the caller "correlate" if there was a problem with the request.
E.g. mockbin also echos x-request-id
back:
curl http://mockbin.com/request --data 'foo=bar'
{
"startedDateTime": "2016-03-22T19:42:26.954Z",
"clientIPAddress": "77.101.29.24",
"method": "POST",
"url": "http://mockbin.com/request",
"httpVersion": "HTTP/1.1",
"cookies": {},
"headers": {
"host": "mockbin.com",
"connection": "close",
"accept-encoding": "gzip",
"x-forwarded-for": "77.101.29.24, 162.158.152.161",
"cf-ray": "287c2079a0a73578-LHR",
"x-forwarded-proto": "http",
"cf-visitor": "{\"scheme\":\"http\"}",
"user-agent": "curl/7.47.1",
"accept": "*/*",
"x-request-id": "b04bad2e-c240-43ad-a0f9-60c98d86599d",
"content-type": "application/x-www-form-urlencoded",
"cf-connecting-ip": "77.101.29.24",
"x-forwarded-port": "80",
"via": "1.1 vegur",
"connect-time": "0",
"x-request-start": "1458675746943",
"total-route-time": "0",
"content-length": "7"
},
"queryString": {},
"postData": {
"mimeType": "application/x-www-form-urlencoded",
"text": "foo=bar",
"params": {
"foo": "bar"
}
},
"headersSize": 535,
"bodySize": 7
}
Please confirm if you disagree, then I'll make it configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it could help for sure, but I think most providers do not want to expose their internals to the public facing side of their services, is what I meant :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(mockbin echoes it back because it simply echoes whatever you send to it)
Hey, that looks great! Just added a few concerns. Thanks :) |
Coverage remained the same at 59.451% when pulling ed761a5edb618dbfda37a76c696b26cb81b34107 on opyate:correlation-id into c9d3e56 on Mashape:next. |
The linting fails with 2 errors:
|
Not my code :) |
Oh indeed! I'm sorry haha, I should have checked! (not sure how it went through, I assumed that was not possible...) |
yes, mockbin does its own |
I committed the spec matcher, but since rebasing this error popped up which means I don't know if my commit will work.
|
Fair enough! But mockbin is a debugging/development tool :) I think we can all agree on why this should not be the default behavior for our use case. |
OK, I'll make "echo correlation ID back to downstream" configurable. |
Coverage remained the same at 59.451% when pulling d612dc031b2e8402297b251624ec656136e32263 on opyate:correlation-id into c9d3e56 on Mashape:next. |
Fixing this is easy: delete all keyspaces in your Cassandra cluster ( |
|
agreed, and mockbin should also not override such headers if they exist: Kong/insomnia-mockbin#45 |
Silly me: I'll change the spec to test for actual headers, but perhaps @thibaultcha can look at the Cassandra-related problem that's blocking my testing since the rebase (yes, I have the latest |
@opyate Seems your migrations did not run correctly for some reason. |
- also revert busted:match, since it's not for regex
@thibaultcha I've committed the following:
Also, following the keyspace mess from yesterday, I think the Makefile
|
Yes it does patterns, I have used it numerous times. See the luassert code base if doubts persist. The make clean command is intended to be run without the datastores running. Anyways, such "messes" as you say are rare and would only occur during development, as migrations aren't always fixed until releasing. That is fine.
|
Heh, it seems clean is already using the migrations. Mixing with other projects... But the issue here is that one is free to have as many keyspaces as desired (even for testing, I often use several ones) and thus the command can never know which ones are in an inconsistent state. Plus deleting other keyspaces, even developement is very unsafe and might not always be desired. Only the tests keyspace should be deleted without too much worrying. |
@thibaultcha Found it - apologies for doubting you :) This should be it! |
Hey, I agree that this looks ready! A couple last things:
|
|
||
assert.are_not_equals(correlation_id1, correlation_id2) | ||
|
||
-- TODO kong_TEST.yml's worker_processes has to be 1 for the below to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be in the future :)
how about "request-tracker"? |
Requests Trace |
a similar problem here #1118 |
What is the status of this PR? |
As the commiter, here's my opinion:
|
IMHO "Web people" know this feature as Request-ID. |
Tried to rebase to latest
|
Hey @opyate, no worries, I have manually merged this to git
Thanks a lot for contributing on this! |
PS: |
Thanks for all the assistance! |
No description provided.