Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

chore: rename nodereport to node-report #37

Closed
wants to merge 1 commit into from
Closed

Conversation

gdams
Copy link
Member

@gdams gdams commented Jan 12, 2017

This changes nodereport to node-report

@rnchamberlain
Copy link
Contributor

rnchamberlain commented Jan 12, 2017

@gdams the hyphen is not allowed in C variable or macro names, so the project won't build as-is. For example, NODEREPORT_VERSION will need to change to perhaps NODE_REPORT_VERSION, not node-report_VERSION. Ditto C variables and the environment variables.

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

I assume this was a global search and replace. It's left very ugly looking function/variable names, e.g. Processnode-reportFileName has replaced ProcessNodeReportFileName.

@@ -21,7 +21,7 @@
}],
],
"defines": [
'NODEREPORT_VERSION="<!(node -p \"require(\'./package.json\').version\")"'
'node-report_VERSION="<!(node -p \"require(\'./package.json\').version\")"'
Copy link
Member

Choose a reason for hiding this comment

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

Please either revert this, or upper case. I don't believe - is a valid character for C/C++ macro names.

@@ -1,7 +1,7 @@
2016-12-12, Version 1.0.7
=========================

* Fix version reporting in NodeReport section (Richard Lau)
* Fix version reporting in node-report section (Richard Lau)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should rename in the history -- It was correct at the time.

@@ -23,7 +23,7 @@

* Fix for failure in fatal error (OOM) test (Richard Chamberlain)

* Add support for nodereport on AIX (Richard Chamberlain)
* Add support for node-report on AIX (Richard Chamberlain)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should rename in the history -- It was correct at the time.

--------------------------------------------------

*nodereport contributors listed at <https://github.com/nodejs/nodereport/blob/master/AUTHORS>*
*node-report contributors listed at <https://github.com/nodejs/node-report/blob/master/AUTHORS>*
Copy link
Member

Choose a reason for hiding this comment

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

If we're updating this file, https://github.com/nodejs/nodereport/blob/master/AUTHORS no longer exists (it was removed by #13).

export node-report_FILENAME=stdout|stderr|<filename>
export node-report_DIRECTORY=<full path>
export node-report_COREDUMP=yes|no
export node-report_VERBOSE=yes|no
Copy link
Member

Choose a reason for hiding this comment

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

We want to keep the environment variables case (upper), probably without the hyphen.

// NODEREPORT_EVENTS env var overrides the defaults
const options = process.env.NODEREPORT_EVENTS || 'exception+fatalerror+signal+apicall';
// node-report_EVENTS env var overrides the defaults
const options = process.env.node-report_EVENTS || 'exception+fatalerror+signal+apicall';
Copy link
Member

Choose a reason for hiding this comment

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

We want to keep the environment variables case (upper), probably without the hyphen.

@gdams gdams force-pushed the master branch 2 times, most recently from 7a9cf0d to 9d757a2 Compare January 13, 2017 08:19
* Verbose mode
******************************************************************************/
unsigned int ProcessNodeReportEvents(const char* args) {
unsigned int ProcessProcessNode_ReportEvents(const char* args) {
Copy link
Member

Choose a reason for hiding this comment

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

Extra Process. Doesn't match the call in src/module.cc.

@richardlau
Copy link
Member

I'd like a second opinion on the function name changes in the C++ code -- I'm finding it much harder to read. When I see ProcessNode_ReportCoreSwitch I'm mentally parsing the underscore as a separator so I read it as ProcessNode and ReportCoreSwitch.

Copy link
Contributor

@sam-github sam-github left a comment

Choose a reason for hiding this comment

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

You don't have to change the js and c++ symbol names, and many of the name changes are syntactically invalid. The env var names don't need changing, either. A number of comments refer to a report as a "NodeReport", which was weird to begin with, just call it a "report", which is better wording, and robust to module name changes. A bunch of other comments unnecessarily name the module, just remove that part of the comment. Any reader of the code surely knows the module the code is part of! Or can find out easily if they are really confused.

application.

```js
var nodereport = require('nodereport');
nodereport.triggerReport();
var node-report = require('node-report');
Copy link
Contributor

Choose a reason for hiding this comment

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

this is syntactically invalid javascript, you need to be more discerning in your search and replace. revert it to the original.

export NODEREPORT_DIRECTORY=<full path>
export NODEREPORT_COREDUMP=yes|no
export NODEREPORT_VERBOSE=yes|no
export NODE_REPORT_EVENTS=exception+fatalerror+signal+apicall
Copy link
Contributor

Choose a reason for hiding this comment

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

These don't have to be changed. Its the module name that is punctuated, we don't have to punctuate the env var names

```

## Examples

To see examples of NodeReports generated from these events you can run the
demonstration applications provided in the nodereport github repository. These are
To see examples of node-reports generated from these events you can run the
Copy link
Contributor

Choose a reason for hiding this comment

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

"of reports generated"

To see examples of NodeReports generated from these events you can run the
demonstration applications provided in the nodereport github repository. These are
To see examples of node-reports generated from these events you can run the
demonstration applications provided in the node-report github repository. These are
Copy link
Contributor

Choose a reason for hiding this comment

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

"in the github repository"

2. `exception.js` - NodeReport triggered by unhandled exception.
3. `fatalerror.js` - NodeReport triggered by fatal error on JavaScript heap out of memory.
4. `loop.js` - looping application, NodeReport triggered using kill `-USR2 <pid>`.
1. `api.js` - node-report triggered by JavaScript API call.
Copy link
Contributor

Choose a reason for hiding this comment

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

for all s/node-report/report/


const api = require('./api');

// NODEREPORT_EVENTS env var overrides the defaults
const options = process.env.NODEREPORT_EVENTS || 'exception+fatalerror+signal+apicall';
// NODE_REPORT_EVENTS env var overrides the defaults
Copy link
Contributor

Choose a reason for hiding this comment

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

revert, unnecessary to change this

@@ -1,7 +1,7 @@
#include "node_report.h"
#include <nan.h>

namespace nodereport {
namespace node-report {
Copy link
Contributor

Choose a reason for hiding this comment

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

invalid, revert to original

Copy link
Contributor

Choose a reason for hiding this comment

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

I think every change in this file pretty much, except maybe some comments, can be reverted as unnecessary (and won't compile).

@@ -241,26 +241,26 @@ static int StartWatchdogThread(void* (*thread_main)(void* unused)) {
pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
pthread_attr_destroy(&attr);
if (err != 0) {
fprintf(stderr, "nodereport: StartWatchdogThread pthread_create() failed: %s\n", strerror(err));
fprintf(stderr, "node-report: StartWatchdogThread pthread_create() failed: %s\n", strerror(err));
Copy link
Contributor

Choose a reason for hiding this comment

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

this change is one of the few that should stay, because it names the module

inline void* ReportSignalThreadMain(void* unused) {
for (;;) {
uv_sem_wait(&report_semaphore);
if (nodereport_verbose) {
fprintf(stdout, "nodereport: signal %s received\n", node::signo_string(report_signal));
if (node-report_verbose) {
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need this line

if (nodereport_verbose) {
fprintf(stdout, "nodereport: signal %s received\n", node::signo_string(report_signal));
if (node-report_verbose) {
fprintf(stdout, "node-report: signal %s received\n", node::signo_string(report_signal));
Copy link
Contributor

Choose a reason for hiding this comment

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

do need this line. etc.

@richardlau
Copy link
Member

Superseded by #43.

@richardlau richardlau closed this Jan 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants