Comparing version 0.1.33 to 0.1.34
@@ -90,3 +90,3 @@ "use strict"; | ||
this.setupStateManagement(); | ||
this.startNewConnection(); | ||
this.startNewConnection(true); | ||
@@ -185,3 +185,3 @@ var self = this; | ||
try { | ||
self.startNewConnection(); | ||
self.startNewConnection(false); | ||
} catch (e) {} | ||
@@ -233,3 +233,3 @@ }, self.backoff * 1000); | ||
key: "startNewConnection", | ||
value: function startNewConnection() { | ||
value: function startNewConnection(shouldThrow) { | ||
var _this2 = this; | ||
@@ -248,94 +248,102 @@ | ||
this.client.ping(pingMessage, this.metadata, { deadline: deadline }, function (err, reply) { | ||
if (err) { | ||
var code = err.code; | ||
try { | ||
if (err) { | ||
var code = err.code; | ||
if ([grpc.status.CANCELLED, grpc.status.NOT_FOUND, grpc.status.UNIMPLEMENTED, grpc.status.PERMISSION_DENIED, grpc.status.UNAUTHENTICATED].includes(code)) { | ||
throw new _exceptions.RookInvalidToken(); | ||
} | ||
if ([grpc.status.CANCELLED, grpc.status.NOT_FOUND, grpc.status.UNIMPLEMENTED, grpc.status.PERMISSION_DENIED, grpc.status.UNAUTHENTICATED].includes(code)) { | ||
throw new _exceptions.RookInvalidToken(); | ||
} | ||
if (self.retries === 0) { | ||
_logger.logger.error("Error on gRPC ping connection-", err); | ||
} | ||
self.events.emit("error"); | ||
} else { | ||
var info = _this2.output.getRookInfo(); | ||
self.request = _this2.client.new_rook_notification(info, _this2.metadata); | ||
if (self.retries === 0) { | ||
_logger.logger.error("Error on gRPC ping connection-", err); | ||
} | ||
self.events.emit("error"); | ||
} else { | ||
var info = _this2.output.getRookInfo(); | ||
self.request = _this2.client.new_rook_notification(info, _this2.metadata); | ||
self.request.on('end', function (err) { | ||
try { | ||
_logger.logger.error("End on gRPC connection-", err); | ||
self.events.emit("error"); | ||
} catch (e) {} | ||
}); | ||
self.request.on('end', function (err) { | ||
try { | ||
_logger.logger.error("End on gRPC connection-", err); | ||
self.events.emit("error"); | ||
} catch (e) {} | ||
}); | ||
self.request.on('error', function (err) { | ||
try { | ||
if (err.code === grpc.status.CANCELLED) return; | ||
self.request.on('error', function (err) { | ||
try { | ||
if (err.code === grpc.status.CANCELLED) return; | ||
_logger.logger.error("Error on gRPC connection-", err); | ||
self.events.emit("error"); | ||
} catch (e) {} | ||
}); | ||
_logger.logger.error("Error on gRPC connection-", err); | ||
self.events.emit("error"); | ||
} catch (e) {} | ||
}); | ||
self.request.on('data', function (command) { | ||
try { | ||
switch (command.getCommandType()) { | ||
self.request.on('data', function (command) { | ||
try { | ||
switch (command.getCommandType()) { | ||
case 1: | ||
//proto.RookCommand.Type.COMMAND_ADD_AUG | ||
_logger.logger.info("Got an add aug command"); | ||
try { | ||
self.augManager.addAug(JSON.parse(command.getAugJson())); | ||
} catch (e) { | ||
_logger.logger.exception("Error processing new aug", e); | ||
} | ||
break; | ||
case 1: | ||
//proto.RookCommand.Type.COMMAND_ADD_AUG | ||
_logger.logger.info("Got an add aug command"); | ||
try { | ||
self.augManager.addAug(JSON.parse(command.getAugJson())); | ||
} catch (e) { | ||
_logger.logger.exception("Error processing new aug", e); | ||
} | ||
break; | ||
case 2: | ||
//proto.RookCommand.COMMAND_REMOVE_AUG | ||
_logger.logger.info("Got a remove aug command"); | ||
try { | ||
self.augManager.removeAug(command.getAugId()); | ||
} catch (e) { | ||
_logger.logger.exception("Error removing aug", e); | ||
} | ||
break; | ||
case 2: | ||
//proto.RookCommand.COMMAND_REMOVE_AUG | ||
_logger.logger.info("Got a remove aug command"); | ||
try { | ||
self.augManager.removeAug(command.getAugId()); | ||
} catch (e) { | ||
_logger.logger.exception("Error removing aug", e); | ||
} | ||
break; | ||
case 3: | ||
//proto.RookCommand.COMAND_INIT_FINISHED | ||
_logger.logger.info("Finished initialization"); | ||
try { | ||
self.output.startSendingMessages(); | ||
} catch (e) { | ||
_logger.logger.exception("Error initiating output", e); | ||
} | ||
self.events.emit("success"); | ||
break; | ||
case 3: | ||
//proto.RookCommand.COMAND_INIT_FINISHED | ||
_logger.logger.info("Finished initialization"); | ||
try { | ||
self.output.startSendingMessages(); | ||
} catch (e) { | ||
_logger.logger.exception("Error initiating output", e); | ||
} | ||
self.events.emit("success"); | ||
break; | ||
case 4: | ||
//proto.RookCommand.COMMAND_CLEAR_AUGS | ||
_logger.logger.info("Got clear augs command"); | ||
try { | ||
self.augManager.clearAugs(); | ||
} catch (e) { | ||
_logger.logger.exception("Error clearing augs", e); | ||
} | ||
break; | ||
case 4: | ||
//proto.RookCommand.COMMAND_CLEAR_AUGS | ||
_logger.logger.info("Got clear augs command"); | ||
try { | ||
self.augManager.clearAugs(); | ||
} catch (e) { | ||
_logger.logger.exception("Error clearing augs", e); | ||
} | ||
break; | ||
case 5: | ||
//proto.RookCommand.COMMAND_SET_ROOK_ID | ||
_logger.logger.info("Got set rook_id command- %s", command.getRookId()); | ||
try { | ||
self.output.setRookId(command.getRookId()); | ||
} catch (e) { | ||
_logger.logger.exception("Error setting id", e); | ||
} | ||
break; | ||
case 5: | ||
//proto.RookCommand.COMMAND_SET_ROOK_ID | ||
_logger.logger.info("Got set rook_id command- %s", command.getRookId()); | ||
try { | ||
self.output.setRookId(command.getRookId()); | ||
} catch (e) { | ||
_logger.logger.exception("Error setting id", e); | ||
} | ||
break; | ||
default: | ||
_logger.logger.error("Unknown command- %d", command.getCommandType()); | ||
break; | ||
} | ||
} catch (e) {} | ||
}); | ||
default: | ||
_logger.logger.error("Unknown command- %d", command.getCommandType()); | ||
break; | ||
} | ||
} catch (e) {} | ||
}); | ||
} | ||
} catch (e) { | ||
if (shouldThrow) { | ||
throw e; | ||
} | ||
_logger.logger.error(e); | ||
} | ||
@@ -342,0 +350,0 @@ }); |
@@ -170,12 +170,4 @@ "use strict"; | ||
try { | ||
var args = { | ||
pid: new _JSObjectNamespace2.default(process.pid) | ||
}; | ||
message.setProcessId(process.pid); | ||
message.setArguments(new _NamespaceSerializer2.default().dumps(new _ContainerNamespace2.default(args))); | ||
} catch (e) { | ||
_logger.logger.exception("Failed to get additional arguments"); | ||
} | ||
message.setIp(ip.address()); | ||
@@ -182,0 +174,0 @@ message.setHostname(os.hostname()); |
{ | ||
"name": "rookout", | ||
"commit": "5c126a3495e439192ae3fc87f9b86d177e1eafb7", | ||
"version": "0.1.33", | ||
"commit": "05d7dc248c554abebb35b4ba1515dd1aa85008f9", | ||
"version": "0.1.34", | ||
"description": "Rook is a package for on the fly debugging and data extraction for applications in production", | ||
@@ -55,3 +55,6 @@ "main": "index.js", | ||
"rookout-node": "./CircleCiOrbWrapper.js" | ||
}, | ||
"engines": { | ||
"node": ">= 8" | ||
} | ||
} |
@@ -108,3 +108,3 @@ "use strict"; | ||
return { maxDepth: DEFAULT_MAX_DEPTH, | ||
maxWidth: 250, | ||
maxWidth: 50, | ||
maxCollectionDepth: DEFAULT_MAX_COLLECTION_DEPTH, | ||
@@ -111,0 +111,0 @@ maxString: DEFAULT_MAX_STRING }; |
@@ -586,3 +586,3 @@ "use strict"; | ||
var engine = config.InstrumentationConfig.ENGINE; | ||
if (engine === "auto") { | ||
if (!engine || engine === "auto") { | ||
var versions = process.version.split('.'); | ||
@@ -589,0 +589,0 @@ var major = parseInt(versions[0].substr(1)); |
@@ -110,3 +110,4 @@ "use strict"; | ||
value: function check_version_supported() { | ||
var version = process.versions["node"].split("."); | ||
var nodeVersion = process.versions["node"]; | ||
var version = nodeVersion.split("."); | ||
var majorVersion = parseInt(version[0]); | ||
@@ -120,8 +121,7 @@ var minorVersion = parseInt(version[1]); | ||
switch (majorVersion) { | ||
case 4: | ||
if (minorVersion < 3) { | ||
case 8: | ||
// There's a bug in 8.9.1; https://github.com/nodejs/node/issues/16949 | ||
if (minorVersion === 9 && nodeVersion.startsWith("8.9.1")) { | ||
throw new _exceptions.RookUnsupportedNodeVersion(process.version); | ||
} | ||
case 6: | ||
case 8: | ||
case 10: | ||
@@ -128,0 +128,0 @@ break; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1172150
10446