securenow 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nextjs.js +647 -613
- package/package.json +164 -164
- package/tracing.js +42 -1
package/package.json
CHANGED
|
@@ -1,164 +1,164 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "securenow",
|
|
3
|
-
"version": "6.0.
|
|
4
|
-
"description": "OpenTelemetry instrumentation for Node.js and Next.js - Send traces and logs to SigNoz or any OTLP backend",
|
|
5
|
-
"type": "commonjs",
|
|
6
|
-
"main": "register.js",
|
|
7
|
-
"types": "register.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"securenow": "cli.js"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"postinstall": "node postinstall.js || exit 0"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/securenow-ai/securenow-npm.git"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://securenow.ai",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/securenow-ai/securenow-npm/issues",
|
|
21
|
-
"email": "support@securenow.ai"
|
|
22
|
-
},
|
|
23
|
-
"author": "SecureNow <support@securenow.ai> (https://securenow.ai)",
|
|
24
|
-
"keywords": [
|
|
25
|
-
"opentelemetry",
|
|
26
|
-
"otel",
|
|
27
|
-
"tracing",
|
|
28
|
-
"logging",
|
|
29
|
-
"logs",
|
|
30
|
-
"observability",
|
|
31
|
-
"apm",
|
|
32
|
-
"monitoring",
|
|
33
|
-
"nextjs",
|
|
34
|
-
"next.js",
|
|
35
|
-
"signoz",
|
|
36
|
-
"instrumentation",
|
|
37
|
-
"telemetry",
|
|
38
|
-
"distributed-tracing",
|
|
39
|
-
"node",
|
|
40
|
-
"express",
|
|
41
|
-
"fastify",
|
|
42
|
-
"nestjs"
|
|
43
|
-
],
|
|
44
|
-
"exports": {
|
|
45
|
-
".": {
|
|
46
|
-
"types": "./register.d.ts",
|
|
47
|
-
"default": "./register.js"
|
|
48
|
-
},
|
|
49
|
-
"./register": {
|
|
50
|
-
"types": "./register.d.ts",
|
|
51
|
-
"default": "./register.js"
|
|
52
|
-
},
|
|
53
|
-
"./tracing": {
|
|
54
|
-
"types": "./tracing.d.ts",
|
|
55
|
-
"default": "./tracing.js"
|
|
56
|
-
},
|
|
57
|
-
"./console-instrumentation": {
|
|
58
|
-
"default": "./console-instrumentation.js"
|
|
59
|
-
},
|
|
60
|
-
"./nextjs": {
|
|
61
|
-
"types": "./nextjs.d.ts",
|
|
62
|
-
"default": "./nextjs.js"
|
|
63
|
-
},
|
|
64
|
-
"./nextjs-auto-capture": {
|
|
65
|
-
"types": "./nextjs-auto-capture.d.ts",
|
|
66
|
-
"default": "./nextjs-auto-capture.js"
|
|
67
|
-
},
|
|
68
|
-
"./nextjs-middleware": {
|
|
69
|
-
"types": "./nextjs-middleware.d.ts",
|
|
70
|
-
"default": "./nextjs-middleware.js"
|
|
71
|
-
},
|
|
72
|
-
"./nextjs-wrapper": {
|
|
73
|
-
"types": "./nextjs-wrapper.d.ts",
|
|
74
|
-
"default": "./nextjs-wrapper.js"
|
|
75
|
-
},
|
|
76
|
-
"./nextjs-webpack-config": "./nextjs-webpack-config.js",
|
|
77
|
-
"./register-vite": "./register-vite.js",
|
|
78
|
-
"./web-vite": {
|
|
79
|
-
"import": "./web-vite.mjs",
|
|
80
|
-
"default": "./web-vite.mjs"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"files": [
|
|
84
|
-
"register.js",
|
|
85
|
-
"register.d.ts",
|
|
86
|
-
"tracing.js",
|
|
87
|
-
"tracing.d.ts",
|
|
88
|
-
"console-instrumentation.js",
|
|
89
|
-
"nextjs.js",
|
|
90
|
-
"nextjs.d.ts",
|
|
91
|
-
"nextjs-auto-capture.js",
|
|
92
|
-
"nextjs-auto-capture.d.ts",
|
|
93
|
-
"nextjs-middleware.js",
|
|
94
|
-
"nextjs-middleware.d.ts",
|
|
95
|
-
"nextjs-wrapper.js",
|
|
96
|
-
"nextjs-wrapper.d.ts",
|
|
97
|
-
"nextjs-webpack-config.js",
|
|
98
|
-
"cli.js",
|
|
99
|
-
"postinstall.js",
|
|
100
|
-
"register-vite.js",
|
|
101
|
-
"web-vite.mjs",
|
|
102
|
-
"examples/",
|
|
103
|
-
"docs/ALL-FRAMEWORKS-QUICKSTART.md",
|
|
104
|
-
"docs/ARCHITECTURE.md",
|
|
105
|
-
"docs/AUTO-BODY-CAPTURE.md",
|
|
106
|
-
"docs/CHANGELOG-NEXTJS.md",
|
|
107
|
-
"docs/NEXTJS-WEBPACK-WARNINGS.md",
|
|
108
|
-
"docs/AUTO-SETUP.md",
|
|
109
|
-
"docs/AUTOMATIC-IP-CAPTURE.md",
|
|
110
|
-
"docs/BODY-CAPTURE-QUICKSTART.md",
|
|
111
|
-
"docs/CUSTOMER-GUIDE.md",
|
|
112
|
-
"docs/EASIEST-SETUP.md",
|
|
113
|
-
"docs/ENVIRONMENT-VARIABLES.md",
|
|
114
|
-
"docs/EXPRESS-BODY-CAPTURE.md",
|
|
115
|
-
"docs/EXPRESS-SETUP-GUIDE.md",
|
|
116
|
-
"docs/INDEX.md",
|
|
117
|
-
"docs/LOGGING-GUIDE.md",
|
|
118
|
-
"docs/LOGGING-QUICKSTART.md",
|
|
119
|
-
"docs/NEXTJS-BODY-CAPTURE.md",
|
|
120
|
-
"docs/NEXTJS-GUIDE.md",
|
|
121
|
-
"docs/NEXTJS-QUICKSTART.md",
|
|
122
|
-
"docs/NEXTJS-WRAPPER-APPROACH.md",
|
|
123
|
-
"docs/QUICKSTART-BODY-CAPTURE.md",
|
|
124
|
-
"docs/REDACTION-EXAMPLES.md",
|
|
125
|
-
"docs/REQUEST-BODY-CAPTURE.md",
|
|
126
|
-
"docs/VERCEL-OTEL-MIGRATION.md",
|
|
127
|
-
"README.md",
|
|
128
|
-
"LICENSE"
|
|
129
|
-
],
|
|
130
|
-
"dependencies": {
|
|
131
|
-
"@opentelemetry/api": "1.7.0",
|
|
132
|
-
"@opentelemetry/api-logs": "^0.47.0",
|
|
133
|
-
"@opentelemetry/auto-instrumentations-node": "0.47.0",
|
|
134
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.47.0",
|
|
135
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.47.0",
|
|
136
|
-
"@opentelemetry/instrumentation": "0.47.0",
|
|
137
|
-
"@opentelemetry/instrumentation-document-load": "0.47.0",
|
|
138
|
-
"@opentelemetry/instrumentation-fetch": "0.47.0",
|
|
139
|
-
"@opentelemetry/instrumentation-http": "^0.208.0",
|
|
140
|
-
"@opentelemetry/instrumentation-user-interaction": "0.47.0",
|
|
141
|
-
"@opentelemetry/instrumentation-xml-http-request": "0.47.0",
|
|
142
|
-
"@opentelemetry/resources": "1.20.0",
|
|
143
|
-
"@opentelemetry/sdk-logs": "^0.47.0",
|
|
144
|
-
"@opentelemetry/sdk-node": "0.47.0",
|
|
145
|
-
"@opentelemetry/sdk-trace-web": "1.20.0",
|
|
146
|
-
"@opentelemetry/semantic-conventions": "1.20.0",
|
|
147
|
-
"@vercel/otel": "^1.14.0",
|
|
148
|
-
"dotenv": "^17.2.1",
|
|
149
|
-
"uuid": "^9.0.0"
|
|
150
|
-
},
|
|
151
|
-
"peerDependencies": {
|
|
152
|
-
"next": ">=13.0.0"
|
|
153
|
-
},
|
|
154
|
-
"peerDependenciesMeta": {
|
|
155
|
-
"next": {
|
|
156
|
-
"optional": true
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
"overrides": {
|
|
160
|
-
"@opentelemetry/api": "1.7.0"
|
|
161
|
-
},
|
|
162
|
-
"sideEffects": true,
|
|
163
|
-
"license": "ISC"
|
|
164
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "securenow",
|
|
3
|
+
"version": "6.0.2",
|
|
4
|
+
"description": "OpenTelemetry instrumentation for Node.js and Next.js - Send traces and logs to SigNoz or any OTLP backend",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "register.js",
|
|
7
|
+
"types": "register.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"securenow": "cli.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"postinstall": "node postinstall.js || exit 0"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/securenow-ai/securenow-npm.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://securenow.ai",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/securenow-ai/securenow-npm/issues",
|
|
21
|
+
"email": "support@securenow.ai"
|
|
22
|
+
},
|
|
23
|
+
"author": "SecureNow <support@securenow.ai> (https://securenow.ai)",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"opentelemetry",
|
|
26
|
+
"otel",
|
|
27
|
+
"tracing",
|
|
28
|
+
"logging",
|
|
29
|
+
"logs",
|
|
30
|
+
"observability",
|
|
31
|
+
"apm",
|
|
32
|
+
"monitoring",
|
|
33
|
+
"nextjs",
|
|
34
|
+
"next.js",
|
|
35
|
+
"signoz",
|
|
36
|
+
"instrumentation",
|
|
37
|
+
"telemetry",
|
|
38
|
+
"distributed-tracing",
|
|
39
|
+
"node",
|
|
40
|
+
"express",
|
|
41
|
+
"fastify",
|
|
42
|
+
"nestjs"
|
|
43
|
+
],
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./register.d.ts",
|
|
47
|
+
"default": "./register.js"
|
|
48
|
+
},
|
|
49
|
+
"./register": {
|
|
50
|
+
"types": "./register.d.ts",
|
|
51
|
+
"default": "./register.js"
|
|
52
|
+
},
|
|
53
|
+
"./tracing": {
|
|
54
|
+
"types": "./tracing.d.ts",
|
|
55
|
+
"default": "./tracing.js"
|
|
56
|
+
},
|
|
57
|
+
"./console-instrumentation": {
|
|
58
|
+
"default": "./console-instrumentation.js"
|
|
59
|
+
},
|
|
60
|
+
"./nextjs": {
|
|
61
|
+
"types": "./nextjs.d.ts",
|
|
62
|
+
"default": "./nextjs.js"
|
|
63
|
+
},
|
|
64
|
+
"./nextjs-auto-capture": {
|
|
65
|
+
"types": "./nextjs-auto-capture.d.ts",
|
|
66
|
+
"default": "./nextjs-auto-capture.js"
|
|
67
|
+
},
|
|
68
|
+
"./nextjs-middleware": {
|
|
69
|
+
"types": "./nextjs-middleware.d.ts",
|
|
70
|
+
"default": "./nextjs-middleware.js"
|
|
71
|
+
},
|
|
72
|
+
"./nextjs-wrapper": {
|
|
73
|
+
"types": "./nextjs-wrapper.d.ts",
|
|
74
|
+
"default": "./nextjs-wrapper.js"
|
|
75
|
+
},
|
|
76
|
+
"./nextjs-webpack-config": "./nextjs-webpack-config.js",
|
|
77
|
+
"./register-vite": "./register-vite.js",
|
|
78
|
+
"./web-vite": {
|
|
79
|
+
"import": "./web-vite.mjs",
|
|
80
|
+
"default": "./web-vite.mjs"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"files": [
|
|
84
|
+
"register.js",
|
|
85
|
+
"register.d.ts",
|
|
86
|
+
"tracing.js",
|
|
87
|
+
"tracing.d.ts",
|
|
88
|
+
"console-instrumentation.js",
|
|
89
|
+
"nextjs.js",
|
|
90
|
+
"nextjs.d.ts",
|
|
91
|
+
"nextjs-auto-capture.js",
|
|
92
|
+
"nextjs-auto-capture.d.ts",
|
|
93
|
+
"nextjs-middleware.js",
|
|
94
|
+
"nextjs-middleware.d.ts",
|
|
95
|
+
"nextjs-wrapper.js",
|
|
96
|
+
"nextjs-wrapper.d.ts",
|
|
97
|
+
"nextjs-webpack-config.js",
|
|
98
|
+
"cli.js",
|
|
99
|
+
"postinstall.js",
|
|
100
|
+
"register-vite.js",
|
|
101
|
+
"web-vite.mjs",
|
|
102
|
+
"examples/",
|
|
103
|
+
"docs/ALL-FRAMEWORKS-QUICKSTART.md",
|
|
104
|
+
"docs/ARCHITECTURE.md",
|
|
105
|
+
"docs/AUTO-BODY-CAPTURE.md",
|
|
106
|
+
"docs/CHANGELOG-NEXTJS.md",
|
|
107
|
+
"docs/NEXTJS-WEBPACK-WARNINGS.md",
|
|
108
|
+
"docs/AUTO-SETUP.md",
|
|
109
|
+
"docs/AUTOMATIC-IP-CAPTURE.md",
|
|
110
|
+
"docs/BODY-CAPTURE-QUICKSTART.md",
|
|
111
|
+
"docs/CUSTOMER-GUIDE.md",
|
|
112
|
+
"docs/EASIEST-SETUP.md",
|
|
113
|
+
"docs/ENVIRONMENT-VARIABLES.md",
|
|
114
|
+
"docs/EXPRESS-BODY-CAPTURE.md",
|
|
115
|
+
"docs/EXPRESS-SETUP-GUIDE.md",
|
|
116
|
+
"docs/INDEX.md",
|
|
117
|
+
"docs/LOGGING-GUIDE.md",
|
|
118
|
+
"docs/LOGGING-QUICKSTART.md",
|
|
119
|
+
"docs/NEXTJS-BODY-CAPTURE.md",
|
|
120
|
+
"docs/NEXTJS-GUIDE.md",
|
|
121
|
+
"docs/NEXTJS-QUICKSTART.md",
|
|
122
|
+
"docs/NEXTJS-WRAPPER-APPROACH.md",
|
|
123
|
+
"docs/QUICKSTART-BODY-CAPTURE.md",
|
|
124
|
+
"docs/REDACTION-EXAMPLES.md",
|
|
125
|
+
"docs/REQUEST-BODY-CAPTURE.md",
|
|
126
|
+
"docs/VERCEL-OTEL-MIGRATION.md",
|
|
127
|
+
"README.md",
|
|
128
|
+
"LICENSE"
|
|
129
|
+
],
|
|
130
|
+
"dependencies": {
|
|
131
|
+
"@opentelemetry/api": "1.7.0",
|
|
132
|
+
"@opentelemetry/api-logs": "^0.47.0",
|
|
133
|
+
"@opentelemetry/auto-instrumentations-node": "0.47.0",
|
|
134
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.47.0",
|
|
135
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.47.0",
|
|
136
|
+
"@opentelemetry/instrumentation": "0.47.0",
|
|
137
|
+
"@opentelemetry/instrumentation-document-load": "0.47.0",
|
|
138
|
+
"@opentelemetry/instrumentation-fetch": "0.47.0",
|
|
139
|
+
"@opentelemetry/instrumentation-http": "^0.208.0",
|
|
140
|
+
"@opentelemetry/instrumentation-user-interaction": "0.47.0",
|
|
141
|
+
"@opentelemetry/instrumentation-xml-http-request": "0.47.0",
|
|
142
|
+
"@opentelemetry/resources": "1.20.0",
|
|
143
|
+
"@opentelemetry/sdk-logs": "^0.47.0",
|
|
144
|
+
"@opentelemetry/sdk-node": "0.47.0",
|
|
145
|
+
"@opentelemetry/sdk-trace-web": "1.20.0",
|
|
146
|
+
"@opentelemetry/semantic-conventions": "1.20.0",
|
|
147
|
+
"@vercel/otel": "^1.14.0",
|
|
148
|
+
"dotenv": "^17.2.1",
|
|
149
|
+
"uuid": "^9.0.0"
|
|
150
|
+
},
|
|
151
|
+
"peerDependencies": {
|
|
152
|
+
"next": ">=13.0.0"
|
|
153
|
+
},
|
|
154
|
+
"peerDependenciesMeta": {
|
|
155
|
+
"next": {
|
|
156
|
+
"optional": true
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"overrides": {
|
|
160
|
+
"@opentelemetry/api": "1.7.0"
|
|
161
|
+
},
|
|
162
|
+
"sideEffects": true,
|
|
163
|
+
"license": "ISC"
|
|
164
|
+
}
|
package/tracing.js
CHANGED
|
@@ -99,8 +99,9 @@ function redactGraphQLQuery(query, sensitiveFields = DEFAULT_SENSITIVE_FIELDS) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
// -------- diagnostics --------
|
|
102
|
+
const diagLevel = (env('OTEL_LOG_LEVEL') || '').toLowerCase();
|
|
102
103
|
(() => {
|
|
103
|
-
const L =
|
|
104
|
+
const L = diagLevel;
|
|
104
105
|
const level = L === 'debug' ? DiagLogLevel.DEBUG :
|
|
105
106
|
L === 'info' ? DiagLogLevel.INFO :
|
|
106
107
|
L === 'warn' ? DiagLogLevel.WARN :
|
|
@@ -278,6 +279,46 @@ if (loggingEnabled) {
|
|
|
278
279
|
globalLogger = loggerProvider.getLogger('securenow', '1.0.0');
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
// -------- Guard against OTLP exporter socket errors --------
|
|
283
|
+
// The OTLP HTTP exporter uses keep-alive connections that can be reset by the
|
|
284
|
+
// remote end (ECONNRESET / "socket hang up"). These transient errors sometimes
|
|
285
|
+
// escape as unhandled exceptions or rejections because the underlying HTTP
|
|
286
|
+
// request's error path is not fully covered by the OTel library. We install
|
|
287
|
+
// targeted process-level handlers to catch them and log at debug level instead
|
|
288
|
+
// of crashing the host app.
|
|
289
|
+
const _TRANSIENT_CODES = new Set(['ECONNRESET', 'ECONNREFUSED', 'ETIMEDOUT', 'EPIPE', 'EAI_AGAIN']);
|
|
290
|
+
function _isOtlpTransientError(err) {
|
|
291
|
+
if (!err) return false;
|
|
292
|
+
if (_TRANSIENT_CODES.has(err.code)) return true;
|
|
293
|
+
if (typeof err.message === 'string' && /socket hang up|ECONNRESET/.test(err.message)) return true;
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
function _looksLikeOtlpStack(err) {
|
|
297
|
+
const s = err && err.stack;
|
|
298
|
+
if (!s) return false;
|
|
299
|
+
return /OTLPTraceExporter|OTLPLogExporter|otlp|exporter.*http|BatchSpanProcessor|BatchLogRecordProcessor/i.test(s)
|
|
300
|
+
|| /node:_http_client|ClientRequest|TLSSocket/i.test(s);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
process.on('uncaughtException', (err, origin) => {
|
|
304
|
+
if (_isOtlpTransientError(err) && _looksLikeOtlpStack(err)) {
|
|
305
|
+
if (diagLevel === 'debug') {
|
|
306
|
+
console.debug('[securenow] Suppressed transient OTLP exporter error (%s): %s', origin, err.message);
|
|
307
|
+
}
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
throw err;
|
|
311
|
+
});
|
|
312
|
+
process.on('unhandledRejection', (reason) => {
|
|
313
|
+
if (_isOtlpTransientError(reason) && _looksLikeOtlpStack(reason)) {
|
|
314
|
+
if (diagLevel === 'debug') {
|
|
315
|
+
console.debug('[securenow] Suppressed transient OTLP exporter rejection: %s', reason && reason.message);
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
throw reason;
|
|
320
|
+
});
|
|
321
|
+
|
|
281
322
|
// -------- SDK --------
|
|
282
323
|
const traceExporter = new OTLPTraceExporter({ url: tracesUrl, headers });
|
|
283
324
|
const sdk = new NodeSDK({
|