mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

Allows APM vendors to generate a diagnostic report without calling into JavaScript. Like, from their own message channels interrupting the isolate and generating a report on demand. PR-URL: https://github.com/nodejs/node/pull/44255 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
#include <node.h>
|
|
#include <v8.h>
|
|
|
|
using v8::FunctionCallbackInfo;
|
|
using v8::Isolate;
|
|
using v8::Local;
|
|
using v8::Object;
|
|
using v8::Value;
|
|
|
|
void TriggerReport(const FunctionCallbackInfo<Value>& args) {
|
|
Isolate* isolate = args.GetIsolate();
|
|
|
|
node::TriggerNodeReport(
|
|
isolate, "FooMessage", "BarTrigger", std::string(), Local<Value>());
|
|
}
|
|
|
|
void TriggerReportNoIsolate(const FunctionCallbackInfo<Value>& args) {
|
|
node::TriggerNodeReport(static_cast<Isolate*>(nullptr),
|
|
"FooMessage",
|
|
"BarTrigger",
|
|
std::string(),
|
|
Local<Value>());
|
|
}
|
|
|
|
void TriggerReportEnv(const FunctionCallbackInfo<Value>& args) {
|
|
Isolate* isolate = args.GetIsolate();
|
|
|
|
node::TriggerNodeReport(
|
|
node::GetCurrentEnvironment(isolate->GetCurrentContext()),
|
|
"FooMessage",
|
|
"BarTrigger",
|
|
std::string(),
|
|
Local<Value>());
|
|
}
|
|
|
|
void TriggerReportNoEnv(const FunctionCallbackInfo<Value>& args) {
|
|
Isolate* isolate = args.GetIsolate();
|
|
|
|
node::TriggerNodeReport(static_cast<node::Environment*>(nullptr),
|
|
"FooMessage",
|
|
"BarTrigger",
|
|
std::string(),
|
|
Local<Value>());
|
|
}
|
|
|
|
void init(Local<Object> exports) {
|
|
NODE_SET_METHOD(exports, "triggerReport", TriggerReport);
|
|
NODE_SET_METHOD(exports, "triggerReportNoIsolate", TriggerReportNoIsolate);
|
|
NODE_SET_METHOD(exports, "triggerReportEnv", TriggerReportEnv);
|
|
NODE_SET_METHOD(exports, "triggerReportNoEnv", TriggerReportNoEnv);
|
|
}
|
|
|
|
NODE_MODULE(NODE_GYP_MODULE_NAME, init)
|