Appmetrics crashes Node if required after initializing honeycomb-beeline
What is wrong
Requiring appmetrics any point after calling require('honeycomb-beeline')() causes this nasty stack:
$ node test.js
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::V8::ToLocalEmpty() [/usr/local/bin/node]
4: init(v8::Local<v8::Object>, v8::Local<v8::Object>) [/Users/oliveir/Developer/skunkworks/theory_appmetrics_with_honeycomb/node_modules/appmetrics/appmetrics.node]
5: node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
6: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
7: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
8: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
9: 0x2dd20e3042fd
Abort trap: 6
What is expected
Appmetrics loads without showing FATAL ERROR and NodeJS does not exit as a result.
Additional info
You can use the following Node application to reproduce the issue:
test.js
require('honeycomb-beeline')()
require('appmetrics')
package.json
{
"name": "theory_appmetrics_with_honeycomb",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"appmetrics": "^5.0.5",
"honeycomb-beeline": "^1.8.0"
}
}
Note that placing the require('appmetrics') above require('honeycomb-beeline')() line does not cause an error, and Node executes as expected.
It appears that the call to ToLocalChecked on this line may be the culprit...
So am I right in thinking you want to instrument only part of your Node application, excluding honeycomb-beeline from being monitored?
From the README:
You must call require('appmetrics'); before the require statements for any npm modules you want to monitor. Appmetrics must be initialized first so that it can instrument modules for monitoring as they are loaded.
@mattcolegate I reached this edge case in a project that was already using Honeycomb instrumentation.
Is it impossible to have two instrumentation tools working without this type of conflict?
I would like to benefit from the application-level instrumentation Appmetrics enables while still getting the visualization tools Honeycomb provides.
Also to answer your question directly, yes, I would like to exclude honeycomb-beeline from being monitored/instrumented.