-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Tracing: Add lttng support for tracing on Linux. #702
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,8 +137,10 @@ void LTTNG_HTTP_SERVER_REQUEST(const FunctionCallbackInfo<Value>& args) { | |
| if (!NODE_HTTP_SERVER_REQUEST_ENABLED()) | ||
| return; | ||
|
|
||
| if (!args[0]->IsObject()) | ||
| return; | ||
|
|
||
| Environment* env = Environment::GetCurrent(args); | ||
| HandleScope scope(env->isolate()); | ||
| Local<Object> arg0 = Local<Object>::Cast(args[0]); | ||
| Local<Object> headers; | ||
|
|
||
|
|
@@ -155,8 +157,9 @@ void LTTNG_HTTP_SERVER_REQUEST(const FunctionCallbackInfo<Value>& args) { | |
|
|
||
| Local<Value> strfwdfor = headers->Get(env->x_forwarded_string()); | ||
| node::Utf8Value fwdfor(env->isolate(), strfwdfor); | ||
| req.forwardedFor = *fwdfor; | ||
|
|
||
| if (!strfwdfor->IsString() || (req.forwardedFor = *fwdfor) == nullptr) | ||
| if (!strfwdfor->IsString() || req.forwardedFor == nullptr) | ||
| req.forwardedFor = const_cast<char*>(""); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't you make forwardedFor const? Style note: io.js uses snake_case for variables and members, not camelCase.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I took this code from here, node_dtrace.cc and it is nearly the exact same - can you advise on the change you want to see?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The struct member should (and can) be Rule of thumb: if something can be const, it probably should. |
||
|
|
||
| SLURP_CONNECTION(args[1], conn); | ||
|
|
@@ -176,13 +179,12 @@ void LTTNG_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo<Value>& args) { | |
|
|
||
| void LTTNG_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo<Value>& args) { | ||
| node_lttng_http_client_request_t req; | ||
| char *header; | ||
| char* header; | ||
|
|
||
| if (!NODE_HTTP_CLIENT_REQUEST_ENABLED()) | ||
| return; | ||
|
|
||
| Environment* env = Environment::GetCurrent(args); | ||
| HandleScope scope(env->isolate()); | ||
|
|
||
| /* | ||
| * For the method and URL, we're going to dig them out of the header. This | ||
|
|
||
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.
Caveat emptor: Cast() does the wrong thing when someone does
this.connection = null. There should be aif (!args[0]->IsObject()) returnguard a few lines up. You probably want to do it after the NODE_HTTP_SERVER_REQUEST_ENABLED check because that check is presumably cheaper than callingargs[0]->IsObject().Side note: you don't need the HandleScope. JS -> C++ callbacks have an implicit HandleScope.