opbeat / opbeat-node Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED - See Elastic APM instead: https://github.com/elastic/apm-agent-nodejs
License: BSD 2-Clause "Simplified" License
DEPRECATED - See Elastic APM instead: https://github.com/elastic/apm-agent-nodejs
License: BSD 2-Clause "Simplified" License
Note that I am using version 3.9.x and running node 4.6.x
Also I am not using any promises, maybe a library is though.
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
RangeError: Maximum call stack size exceeded
at wrappedPromise.propagateAslWrapper (/home/adri/Server/node_modules/opbeat/lib/instrumentation/async-hooks.js:372:35)
at wrappedPromise.proxyWrapper [as __asl_wrapper] (/home/adri/Server/node_modules/opbeat/lib/instrumentation/async-hooks.js:375:31)
at wrappedPromise.proxyWrapper [as __asl_wrapper] (/home/adri/Server/node_modules/async-listener/index.js:445:19)
... X 3000 of these lines
I write my Node in CoffeeScript, and start my app with ´coffee app.coffee´.
Doesn't seem to be your fault, but here's what happens:
Error: Traceback does not support Error.prepareStackTrace being defined already
at Object.<anonymous>
(/Users/jacob/Sites/Konfect/node_modules/opbeat/node_modules/raw-stacktrace/node_modules/traceback/traceback.js:23:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load
(/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous>
(/Users/jacob/Sites/Konfect/node_modules/opbeat/node_modules/raw-stacktrace/node_modules/traceback/api.js:15:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load
(/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous>
(/Users/jacob/Sites/Konfect/node_modules/opbeat/node_modules/raw-stacktrace/index.js:2:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load
(/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous>
(/Users/jacob/Sites/Konfect/node_modules/opbeat/lib/client.js:7:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load
(/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous>
(/Users/jacob/Sites/Konfect/node_modules/opbeat/index.js:1:80)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load
(/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/jacob/Sites/Konfect/app.coffee:2:10, <js>:6:12)
at Object.<anonymous> (/Users/jacob/Sites/Konfect/app.coffee:1:1, <js>:117:4)
at Module._compile (module.js:456:26)
Hi,
We've been using opbeat for a while and truly enjoying it, thank you for that :)
Recently we've split the business logic, helpers and other parts of our Express App into modules that we require. It allows us to share logic among projects and better isolate domain responsibility as well as write better tests.
The downside we've seen is that now we don't have stack traces anymore in opbeat when one of these module fails.
Here is an example (note: we use bunyan as logger, hence the formatting)
[2016-11-25T12:21:54.578Z] ERROR: screen-api/2589 on dev-vizeat: Places not found
Error: Places not found
at rp.then.then.ifttt (/path/to/expressApp/node_modules/vizeat-helpers/lib/geolocater.js:23:109)
at /path/to/expressApp/node_modules/vizeat-helpers/lib/ifttt.js:25:40
at tryCatcher (/path/to/expressApp/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/path/to/expressApp/node_modules/bluebird/js/release/promise.js:510:31)
at Promise._settlePromise (/path/to/expressApp/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/path/to/expressApp/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/path/to/expressApp/node_modules/bluebird/js/release/promise.js:691:18)
at Async._drainQueue (/path/to/expressApp/node_modules/bluebird/js/release/async.js:138:16)
at Async._drainQueues (/path/to/expressApp/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues (/path/to/expressApp/node_modules/bluebird/js/release/async.js:17:14)
at Immediate.instrumented (/path/to/expressApp/node_modules/opbeat/lib/instrumentation/index.js:107:27)
at tryOnImmediate (timers.js:543:15)
at processImmediate [as _immediateCallback] (timers.js:523:5)
Opbeat logged error successfully at https://opbeat.com/<org>/<project>/errors/shortcut/<uuid> { uuid: '<uuid>' }
This error is successfully logged to opbeat, but the stack trace is not.
No data available.
Are we missing something ?
Consider configuring the module using a config file instead of the optional options hash parsed as the first parameter to createClient()
.
This idea is heavily inspired by the way node-newrelic is configured
Looks like opbeat
is crashing my app. Here's the error (captured by opbeat):
Error: "next" function called after the final callback. Make sure all the calls to "next" are on the same tick
node_modules/opbeat/node_modules/after-all/index.js in next
if (calls === 0) {
done = true;
afterAllCb();
}
});
return function next(cb) {
if (done) throw new Error(errorMessage);
calls++;
return function thecallback(err) {
var args = arguments;
if (isError(err) && !finalError) finalError = err;
process.nextTick(function() {
if (cb) cb.apply(null, args);
Crash log
App 39714 stderr: Error: "next" function called after the final callback. Make sure all the calls to "next" are on the same tick
App 39714 stderr: at next (/[edited]/app/node_modules/opbeat/node_modules/after-all/index.js:25:21)
App 39714 stderr: at /[edited]/app/node_modules/opbeat/lib/instrumentation/index.js:208:16
App 39714 stderr: at Array.forEach (native)
App 39714 stderr: at addStackTracesToTraceGroups (/[edited]/app/node_modules/opbeat/lib/instrumentation/index.js:202:10)
App 39714 stderr: at Instrumentation._flush (/[edited]/app/node_modules/opbeat/lib/instrumentation/index.js:153:3)
App 39714 stderr: at Instrumentation._send (/[edited]/app/node_modules/opbeat/lib/instrumentation/index.js:132:8)
App 39714 stderr: at instrumented (/[edited]/app/node_modules/opbeat/lib/instrumentation/index.js:111:27)
App 39714 stderr: at Timer.unrefdHandle (timers.js:312:14)
When data is sent to Opbeat messages a message is added that says opbeat: logged error successfully...
.
When an unhandled exception is caught it writes out opbeat: caught unhandled excetion
and then adds opbeat:
to the error and logs it.
All of these cases should probably be guarded with a debug flag.
feature request :)
Hi there!
I was trying to send a different culprit to Opbeat to better group our custom errors (we can always check for function and filename below in the stacktrace) but I noticed that the module always overrides our options.culprit
.
Could you add a simple check not to force calling to setCulprit()
in lib/parsers.js
when one is already specified?
I was going to write a pull request but I'm not sure how you guys prefer to do this ;-)
Thanks!
Some errors are logged in Opbeat as undefined undefined
. This happens when the regular error message extractor fails extracting any meaningful error message. In those cases we should add a better fallback - optionally just the same fallback as the built-in V8 stack trace generator uses.
Only occur when i make the require('opbeat')
How do I set up performance monitoring?
Sorry it seems like theres not documentation for this
First off, thanks for providing an awesome error logging solution. We've been using it for a few weeks now, and it's pretty solid.
I'm not sure if there is an option and I overlooked it, I'm looking for a way to silent the console.log
messages from reporting errors.
We are using this as an open source project command line interface from a project, Ionic.
Since we have a plethora of users from around the world using the CLI, we'd like to not show the users the link to the opbeat errors.
Is there any way to silent the message that comes when an error is reported?
The message in question is:
Opbeat logged error successfully at https://opbeat.com
I've found in index.js
- line 60 and line 145, there is a callback from captureError that then console.log
s the message out.
if (opbeatErr) {
client.logger.info('Could not notify Opbeat!');
client.logger.error(opbeatErr.stack);
} else {
client.logger.info('Opbeat logged error successfully at ' + url);
}
Would there be any way to disable or silence this logging? I'd really appreciate any feedback or suggestions you have to offer!
Thanks in advance.
I think it would be very useful to have an option to sample data for transactions. That should allow you to get an accurate representation of the performance of pages without logging the data for every request. I noticed you can turn it on and off https://opbeat.com/docs/articles/opbeat-for-nodejs-api/#instrument but this would include logging it for only a sample of the requests.
I would like to use bunyan logger. I found bunyan-loggly but I did not found yet the same solution for opbeat. Could you please create it?
Using express 4.12.4 we were seeing a lot of hits identified by 'unknown route'. We traced this to being static files such as images which were being served using express.static.
We got around this by using the following middleware function:
function opbeatStaticFileServing(name) {
return function (req, res, next) {
opbeat.setTransactionName('static:' + name);
return next();
};
}
Might help someone in the future.
It should be possible to capture a message and associate it with a http request at the same time
Everything works until I try to add stacktrace. Below is the format that prints to console but I am not sure whats deviating from the opbeat stacktrace example?
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Connected to the target VM, address: '127.0.0.1:50079', transport: 'socket'
Application Starting
{
"message": "worked",
"level": "error",
"exception": {
"value": "My Test Exception",
"type": "java.io.IOException",
"module": "java.io.IOException"
},
"extra": {
"environment": "PRODUCTION",
"Application": "xxxxx",
"timestamp": "2016-05-25T16:34+0000"
},
"stacktrace": {
"frames": [
{
"filename": "ProgramJava",
"lineno": "43"
}
]
}
}java.io.IOException: Server returned HTTP response code: 400 for URL: https://intake.opbeat
Accidently used secret
instead of secretToken
, which causes our express app to fail to start.
We did see the following logged:
Opbeat isn't correctly configured: Missing organizationId, appId or secretToken
The desired behavior is still to log the warning, but not break the entire express app. Is this possible?
I'm behind corporate proxy and this module doesn't work.
I already have proxy setting like this,
process.env.HTTPS_PROXY = 'http://127.0.0.1:3128';
process.env.HTTP_PROXY = 'http://127.0.0.1:3128';
but still throw following error
Could not notify Opbeat { uuid: undefined }
Error: connect ECONNREFUSED 52.4.105.210:443
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)
Hey @watson,
Have a question regarding manual starting of transactions that could be useful when using WebSockets for instance. I saw that startTransaction
and endTransaction
methods were added. Can we use these methods? Is there anything else that needs to be done manually to get proper stats?
Thanks :)
The API returned:
{
"status": 400,
"error_message": "Unable to validate data.",
"structured_error": {
"stacktrace": {
"frames": {
"0": {
"lineno": "None is not of type <class 'int'>"
}
}
}
}
}
which seems to indicate that the agent sent: {"stacktrace": {"frames": [{"lineno": None ...}]}}
.
I am using Sails.js (built ontop of Express) and created my own ApiError object that I send to the client side using res.json
. Before putting in this module everything worked fine. After adding it, it seems like stackman is adding a Circular JSON object onto every single Error object created after the first opbeat.captureError
call.
The additional property that gets added to all Error objects is _sb_callsites: Array[9]
which went sent through res.json throws this error: Unhandled rejection TypeError: Converting circular structure to JSON
Version 3.6.8 cause every call to an express app to timeout =/
Don't know the underlying cause, but it's a big issue
Hey @watson
Have a question regarding CPU profiling. I'm not sure what's going on, but looks like instrumented
(line 108 in instrumentation/index.js
) is taking too much time. Though, I think, it's the original function which takes that time and it's just my paranoia.
Anyway, just wanted to check with you and move forward :)
Hi,
Is there a way to exclude routes somehow ?
My /
route is only used for health check and is periodically getting requests every few seconds.
Hey @watson,
I'm getting random errors. CPU usage is ~4% on each core (16x cores) and ram usage is around 6.5GB/54GB.
Node: v4.6.0
Opbeat: v3.17.2
Express: v4.14.0
App 22321 stderr: Could not notify Opbeat { uuid: undefined }
App 22321 stderr: Error: Opbeat error (502): <html>
App 22321 stderr: <head><title>502 Bad Gateway</title></head>
App 22321 stderr: <body bgcolor="white">
App 22321 stderr: <center><h1>502 Bad Gateway</h1></center>
App 22321 stderr: <hr><center>nginx</center>
App 22321 stderr: </body>
App 22321 stderr: </html>
App 22321 stderr:
App 22321 stderr: at /app/node_modules/opbeat/lib/request.js:29:10
App 22321 stderr: at IncomingMessage.<anonymous> (/app/node_modules/opbeat/node_modules/opbeat-http-client/index.js:59:9)
App 22321 stderr: at emitNone (events.js:72:20)
App 22321 stderr: at IncomingMessage.emit (events.js:166:7)
App 22321 stderr: at endReadableNT (_stream_readable.js:921:12)
App 22321 stderr: at instrumented (/app/node_modules/opbeat/lib/instrumentation/index.js:111:27)
App 22321 stderr: at nextTickCallbackWith2Args (node.js:476:9)
App 22321 stderr: at process._tickCallback (node.js:390:17)
It can happen that the agent picks up errors that were generated inside the agent. E.g. if the API rejects an event, it will be logged back to the API. This could become an infinite loop problem.
I have not looked into how the error reporting actually functions under the hood, so I'm not sure this is even possible, but would it be possible to add sourcemap support?
Basically, if I use Babel to compile src/server.js
to lib/server.js
with sourcemaps enabled, is there any way it could report the errors with the correct location?
Just got another error. I think it would be much, much better to just disable all opbeat network related errors while environment is set to production, or at least make it configurable. In my case I receive email alert every time something is written to stdout and believe me you don't want to receive an email at 4 am just because of DNS timeout which happened inside opbeat :)
App 55807 stderr: Could not notify Opbeat { uuid: undefined }
App 55807 stderr: Error: getaddrinfo EAI_AGAIN intake.opbeat.com:443
App 55807 stderr: at Object.exports._errnoException (util.js:907:11)
App 55807 stderr: at errnoException (dns.js:32:15)
App 55807 stderr: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)
agent.trackRelease
accepts a data
parameter which is passed to getTracker which accepts an auto
property as a default to actually use the rev
option passed in rather than using git rev-parse
: watson/opbeat-release-tracker@93342fc
Since the client
argument is provided to getTracker
but not the defaults
argument, there is no way to provide this option to the release tracker, which means that the function throws an exception if executed on a server where the git
executable or a parent .git
isn't available.
Currently I am monkey patching this like so:
Opbeat.start({
appId: process.env.OPBEAT_SERVER_APP_ID,
organizationId: process.env.OPBEAT_ORGANIZATION_ID,
secretToken: process.env.OPBEAT_SECRET_TOKEN
});
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'staging') {
// Hack defaults to prevent Opbeat from calling git
Opbeat._httpClient.auto = false;
Opbeat.trackRelease({ rev: process.env.GIT_COMMIT });
}
The server runs in Docker and doesn't have the project's git history. I populate GIT_COMMIT
with Webpack's DefinePlugin at build time.
I'm happy to work on a PR for this in either project, but I wasn't sure if @watson would think it should be patched here or in opbeat-release-tracker
. I have to say, having a defaults
argument inside of a closure which acts to override the options
argument passed into the actual function is a bit unintuitive. It seems semantically correct that options
be merged with defaults and override them.
I try to receive reports for a microservice which uses the module mongodb
.
Unfortunately nothing is showing up in the Performance Metrics
section.
Setting DEBUG=opbeat
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming [email protected] module
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming https.Server.prototype functions: [ 'on', 'addListener' ]
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming https.request function
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming [email protected] module
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming mongodb-core.Server.prototype.command
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming mongodb-core.Server.prototype functions: [ 'insert', 'update', 'remove', 'auth' ]
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:22 GMT opbeat shimming mongodb-core.Cursor.prototype functions: [ '_find', '_getmore' ]
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:23 GMT opbeat shimming [email protected] module
ms-messenger-26 (err): Fri, 19 Feb 2016 20:18:23 GMT opbeat shimming mongodb-core.Server.prototype.command
ms-messenger-26 (err): Fri, 19 Feb 2016 20:18:23 GMT opbeat shimming mongodb-core.Server.prototype functions: [ 'insert', 'update', 'remove', 'auth' ]
ms-messenger-26 (err): Fri, 19 Feb 2016 20:18:23 GMT opbeat shimming mongodb-core.Cursor.prototype functions: [ '_find', '_getmore' ]
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:23 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'admin.$cmd' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:23 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'admin.$cmd' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to http.request { uuid: null }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Cursor.prototype._find { uuid: null }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Server.prototype.insert { uuid: null, ns: 'locator.conversations' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'locator.$cmd' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'locator.$cmd' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Server.prototype.insert { uuid: null, ns: 'locator.messages' }
ms-messenger-26 (err): 2016-02-19 21:18 +01:00: Fri, 19 Feb 2016 20:18:25 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'locator.$cmd' }
ms-messenger-26 Fri, 19 Feb 2016 20:18:55 GMT opbeat intercepted call to mongodb-core.Server.prototype.insert { uuid: null, ns: 'locator.conversations' }
ms-messenger-26 Fri, 19 Feb 2016 20:18:55 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'locator.$cmd' }
ms-messenger-26 Fri, 19 Feb 2016 20:18:55 GMT opbeat intercepted call to mongodb-core.Server.prototype.command { uuid: null, ns: 'locator.$cmd' }
I'm using "mongodb": "^2.1.3"
and "opbeat": "^3.5.2"
In our API-Service which uses hapi11, everything seem to work.
logging error with Opbeat: { uuid: '7ddfd240-0f20-49a1-9355-f9f8ee6c4b94' }
TypeError: Cannot read property 'apply' of undefined
at Command.wrappedCallback (E:\www_node\vscene\vscene-h5\node_modules\opbeat\lib\instrumentation\modules\redis.js:36:20)
at Command.instrumented [as callback] (E:\www_node\vscene\vscene-h5\node_modules\opbeat\lib\instrumentation\index.js:112:27)
at normal_reply (E:\www_node\vscene\vscene-h5\node_modules\redis\index.js:714:21)
at RedisClient.return_reply (E:\www_node\vscene\vscene-h5\node_modules\redis\index.js:816:9)
at JavascriptRedisParser.Parser.returnReply (E:\www_node\vscene\vscene-h5\node_modules\redis\index.js:188:18)
at JavascriptRedisParser.execute (E:\www_node\vscene\vscene-h5\node_modules\redis\node_modules\redis-parser\lib\parser.js:413:12)
at Socket.<anonymous> (E:\www_node\vscene\vscene-h5\node_modules\redis\index.js:267:27)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
at TCP.instrumented [as onread] (E:\www_node\vscene\vscene-h5\node_modules\opbeat\lib\instrumentation\index.js:112:27)
Is it possible to have conditional reporting? Meaning, to decide when not to send reports to opbeat?
For example, we have pull notifications api, which is accessed by every user multiple times in just one second. Having this in the reports, will bloat up our package immediately.
Opbeat currently instruments the pbkdf2
, pseudoRandomBytes
, and randomBytes
methods on the crypto
module by replacing them with wrapper functions, and crashes if it can't add this instrumentation, for example if crypto
has been frozen with Object.freeze()
:
./node_modules/opbeat/lib/instrumentation/shimmer.js:48
nodule[name] = wrapped
^
TypeError: Cannot assign to read only property 'pbkdf2' of object '#<Object>'
at wrap (./node_modules/opbeat/lib/instrumentation/shimmer.js:48:16)
at ./node_modules/opbeat/lib/instrumentation/shimmer.js:69:7
at Array.forEach (native)
at ./node_modules/opbeat/lib/instrumentation/shimmer.js:68:11
at Array.forEach (native)
at massWrap (./node_modules/opbeat/lib/instrumentation/shimmer.js:67:11)
at module.exports (./node_modules/opbeat/lib/instrumentation/async-hooks.js:264:5)
at Instrumentation.start (./node_modules/opbeat/lib/instrumentation/index.js:30:27)
at Agent.start (./node_modules/opbeat/lib/agent.js:105:25)
at Object.<anonymous> (./server/lib/opbeat.js:4:34)
While I generally trust opbeat, I'd really prefer not to allow it (or any third party code I use) to modify the crypto
module in any way.
Please consider adding a config option that would allow me to prevent opbeat from instrumenting specific modules. Or, alternatively, allow me to specify a whitelist of modules that I do want opbeat to instrument.
Right now the client doesn't send anything to Opbeat if the process.env.NODE_ENV
is either development
or test
. In any other case it does. It would be nice if it was possible to specify which environments that should result in errors being logged to Opbeat.
E.g. something like:
opbeat.createClient({
logIn: ['production', 'staging']
})
Just expose a config option named agent_enabled
and have the user set to true
or false
at load-time
Contrary to the readme, it appears that custom loggers (bunyan, winston etc) are not supported anymore. From the history it looks as though this was removed in the 3.x.x release
I reported this is an email a while ago.
Opbeat currently shows the stack trace inside the node mysql lib but that does not help to find where the error came from.
I would be happy to spend time on this since this is something I/we really want and if you can point me in the right direction that would be great!
I am using express.Router for nested routes i.e.
main app.js
:
var express = require('express')
var users = require('./users')
var app = express() // main app
// ...
app.use('/users', users)
and in users.js
:
var express = require('express')
var router = express.Router()
router.get('/', function(req, res, next) {
// ...
})
module.exports = router
It seems that Opbeat doesn't recognize the nested routes correctly and shows them as unknonwn.
Hapi catches exceptions (https://github.com/hapijs/hapi/blob/a7b3ad753febbacc10e17e352de6385dfc642dca/lib/protect.js#L43), so errors dont make it to opbeats uncaught error listeners (
Line 210 in c3f8e9e
server.on('request-error')
event and send to opbeat manually.
Not a bug with opbeat, but might be a worthy addition to the readme, etc, as Hapi is one of the most popular node frameworks.
[App:server][Err] Could not notify Opbeat { uuid: undefined }
[App:server][Err] Error: Opbeat error (400): {
"error_message": "Unable to validate data.",
"structured_error": {
"traces": {
"groups": {
"0": {
"transaction": "Exceeds max. allowed length of 512 characters"
},
"1": {
"transaction": "Exceeds max. allowed length of 512 characters"
},
"2": {
"transaction": "Exceeds max. allowed length of 512 characters"
}
}
}
},
"status": 400
}
at /app/node_modules/opbeat/lib/request.js:11:10
at IncomingMessage.<anonymous> (/app/node_modules/opbeat-http-client/index.js:44:9)
at emitNone (events.js:85:20)
at IncomingMessage.emit (events.js:179:7)
at endReadableNT (_stream_readable.js:906:12)
at instrumented (/app/node_modules/opbeat/lib/instrumentation/async-hooks.js:19:23)
at nextTickCallbackWith2Args (node.js:475:9)
at process._tickDomainCallback [as _tickCallback] (node.js:430:17)
This is a follow up to #59
So what I have is this:
server.on('log', (event, tags) => {
if (tags.error && !tags.client) {
const info = {
extra: event,
logger: exports.register.attributes.name
};
// super useful for when you are logging with a bunch of tags
info.extra.tags = tags;
if (event.data instanceof Error) {
this.options.opbeat.captureError(event.data, info);
}
else {
this.options.opbeat.captureError(event, info);
}
}
});
server.on('request', (request, event, tags) => {
if (tags.error && !tags.client) {
const info = {
extra: event,
user: request.auth.credentials,
request: request.raw.req,
logger: exports.register.attributes.name
};
info.extra.tags = tags;
if (event.data instanceof Error) {
this.options.opbeat.captureError(event.data, info);
}
else {
this.options.opbeat.captureError(event, info);
}
}
});
server.on('request-error', (request, error) => {
// censor password, we don't want it leaking
// while posting I realised this should also be done on `on('request', ...)`
if (request.raw.req && request.raw.req.json && request.raw.req.json.password) {
request.raw.req.json.password = 'CENSORED';
}
const info = {
extra: error,
user: request.auth.credentials,
request: request.raw.req,
logger: exports.register.attributes.name
};
this.options.opbeat.captureError(error, info);
});
I have this in a plugin so exports.register.attributes.name
is something custom.
In general I ignore client errors since they do not hold much information but maybe that is me.
As to #59 would it be possible to make it optional? Right now I can't up my version since it will double log (unless Opbeat dedupes it in the backend?)
TypeError: Cannot read property 'apply' of undefined
at Command.wrappedCallback (/node_modules/opbeat/lib/instrumentation/modules/redis.js:36:20)
at Command.instrumented [as callback] (/node_modules/opbeat/lib/instrumentation/index.js:112:27)
at normal_reply (/node_modules/redis/index.js:714:21)
at RedisClient.return_reply (/node_modules/redis/index.js:816:9)
at JavascriptRedisParser.Parser.returnReply (/node_modules/redis/index.js:188:18)
at JavascriptRedisParser.execute (/node_modules/redis-parser/lib/parser.js:415:12)
at Socket.<anonymous> (/node_modules/redis/index.js:267:27)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:177:18)
at Socket.Readable.push (_stream_readable.js:135:10)
at TCP.onread (net.js:542:20)
at TCP.instrumented [as onread] (/node_modules/opbeat/lib/instrumentation/index.js:112:27)
It would be nice to have a helper for deployment tracking, IE: opbeat.trackDeployment(path)
When using Hapi and tracking errors, for POST requests instead of seeing a body object I get:
unavailable: use bodyParser middleware
There is no documentation on this, especially as Hapi doesn't have the same concept of middleware as express/connect has.
Hey guys, I'm having an issue.
backend-1 (err): Could not notify Opbeat { uuid: undefined }
backend-1 (err): Error: connect ETIMEDOUT 54.86.238.45:443
backend-1 (err): at Object.exports._errnoException (util.js:874:11)
backend-1 (err): at exports._exceptionWithHostPort (util.js:897:20)
backend-1 (err): at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
Looks like some kind of network issue.
Branch | Build failing 🚨 |
---|---|
Dependency | debug |
Current Version | 2.4.2 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Hey there,
I've just tried the 2.0 version and I see "Transaction is out of sync." and "Can't record ended trace after parent transaction have ended - ignoring!" messages. I'm using Sails.js which is based on express.
Am I doing something wrong or it's the debug info? Also, one more question regarding the usage. Before 2.0 I was able to initialize more than one instance. I used one in middleware and another one for logging. As I see I cannot do that anymore, is there any way to get already initialized instance?
The documentation states "It’s important that the Opbeat agent is started before you require any other modules in your Node.js application - i.e. before hapi, before http, even before Babel if you use that."
In our application we use mostly dotenv to load env-vars from a file:
require('dotenv').config({path: pathToEnv});
So, my question is: Will it break if I require dotenv
before opbeat
? Or do I simply get no errors from code above require('opbeat')
?
thanks in advance for your help :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.