securenow 7.6.7 → 7.6.8
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/NPM_README.md +13 -13
- package/README.md +21 -37
- package/app-config.js +5 -3
- package/cli/config.js +4 -3
- package/cli/diagnostics.js +54 -15
- package/cli/run.js +40 -11
- package/firewall-only.js +1 -1
- package/mcp/catalog.js +1 -1
- package/nextjs-webpack-config.js +3 -15
- package/nextjs.js +21 -23
- package/nuxt-server-plugin.mjs +20 -10
- package/package.json +33 -34
- package/register.js +1 -1
- package/tracing.js +17 -7
- package/web-vite.mjs +23 -13
- package/CONSUMING-APPS-GUIDE.md +0 -463
- package/docs/ALL-FRAMEWORKS-QUICKSTART.md +0 -1388
- package/docs/API-KEYS-GUIDE.md +0 -278
- package/docs/ARCHITECTURE.md +0 -408
- package/docs/AUTO-BODY-CAPTURE.md +0 -412
- package/docs/AUTO-SETUP-SUMMARY.md +0 -331
- package/docs/AUTO-SETUP.md +0 -419
- package/docs/AUTOMATIC-IP-CAPTURE.md +0 -359
- package/docs/BODY-CAPTURE-FIX.md +0 -261
- package/docs/BODY-CAPTURE-QUICKSTART.md +0 -147
- package/docs/CHANGELOG-NEXTJS.md +0 -235
- package/docs/COMPLETION-REPORT.md +0 -408
- package/docs/CUSTOMER-GUIDE.md +0 -364
- package/docs/EASIEST-SETUP.md +0 -342
- package/docs/ENVIRONMENT-VARIABLES.md +0 -166
- package/docs/ENVIRONMENTS.md +0 -60
- package/docs/EXPRESS-BODY-CAPTURE.md +0 -1028
- package/docs/EXPRESS-SETUP-GUIDE.md +0 -722
- package/docs/FINAL-SOLUTION.md +0 -335
- package/docs/FIREWALL-GUIDE.md +0 -440
- package/docs/IMPLEMENTATION-SUMMARY.md +0 -410
- package/docs/INDEX.md +0 -222
- package/docs/LOGGING-GUIDE.md +0 -704
- package/docs/LOGGING-QUICKSTART.md +0 -221
- package/docs/MCP-GUIDE.md +0 -58
- package/docs/NEXTJS-BODY-CAPTURE-COMPARISON.md +0 -323
- package/docs/NEXTJS-BODY-CAPTURE.md +0 -368
- package/docs/NEXTJS-GUIDE.md +0 -392
- package/docs/NEXTJS-QUICKSTART.md +0 -83
- package/docs/NEXTJS-SETUP-COMPLETE.md +0 -795
- package/docs/NEXTJS-WEBPACK-WARNINGS.md +0 -267
- package/docs/NEXTJS-WRAPPER-APPROACH.md +0 -414
- package/docs/NUXT-GUIDE.md +0 -173
- package/docs/QUICKSTART-BODY-CAPTURE.md +0 -293
- package/docs/REDACTION-EXAMPLES.md +0 -484
- package/docs/REQUEST-BODY-CAPTURE.md +0 -587
- package/docs/SOLUTION-SUMMARY.md +0 -312
- package/docs/VERCEL-OTEL-MIGRATION.md +0 -255
- package/examples/README.md +0 -265
- package/examples/express-with-logging.js +0 -137
- package/examples/instrumentation-with-auto-capture.ts +0 -41
- package/examples/next.config.js +0 -37
- package/examples/nextjs-api-route-with-body-capture.ts +0 -54
- package/examples/nextjs-env-example.txt +0 -32
- package/examples/nextjs-instrumentation.js +0 -36
- package/examples/nextjs-instrumentation.ts +0 -36
- package/examples/nextjs-middleware.js +0 -37
- package/examples/nextjs-middleware.ts +0 -37
- package/examples/nextjs-with-logging-example.md +0 -301
- package/examples/nextjs-with-options.ts +0 -36
- package/examples/test-nextjs-setup.js +0 -70
- package/postinstall.js +0 -296
package/nuxt-server-plugin.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
11
11
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
12
|
-
import
|
|
12
|
+
import * as otelResources from '@opentelemetry/resources';
|
|
13
13
|
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
14
14
|
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
|
15
15
|
import {
|
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
trace as otelTrace,
|
|
18
18
|
SpanStatusCode,
|
|
19
19
|
} from '@opentelemetry/api';
|
|
20
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
21
20
|
import { createRequire } from 'node:module';
|
|
21
|
+
import { randomUUID } from 'node:crypto';
|
|
22
22
|
|
|
23
23
|
const nodeRequire = createRequire(import.meta.url);
|
|
24
24
|
const appConfig = nodeRequire('./app-config');
|
|
@@ -27,6 +27,16 @@ const appConfig = nodeRequire('./app-config');
|
|
|
27
27
|
|
|
28
28
|
const env = appConfig.env;
|
|
29
29
|
|
|
30
|
+
function createResource(attributes) {
|
|
31
|
+
if (typeof otelResources.resourceFromAttributes === 'function') {
|
|
32
|
+
return otelResources.resourceFromAttributes(attributes);
|
|
33
|
+
}
|
|
34
|
+
if (typeof otelResources.Resource === 'function') {
|
|
35
|
+
return new otelResources.Resource(attributes);
|
|
36
|
+
}
|
|
37
|
+
throw new Error('Unsupported @opentelemetry/resources version');
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
const DEFAULT_SENSITIVE_FIELDS = [
|
|
31
41
|
'password', 'passwd', 'pwd', 'secret', 'token', 'api_key', 'apikey',
|
|
32
42
|
'access_token', 'auth', 'credentials', 'mysql_pwd', 'stripeToken',
|
|
@@ -79,9 +89,9 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
79
89
|
|
|
80
90
|
let serviceName;
|
|
81
91
|
if (baseName) {
|
|
82
|
-
serviceName = noUuid ? baseName : `${baseName}-${
|
|
92
|
+
serviceName = noUuid ? baseName : `${baseName}-${randomUUID()}`;
|
|
83
93
|
} else {
|
|
84
|
-
serviceName = `nuxt-app-${
|
|
94
|
+
serviceName = `nuxt-app-${randomUUID()}`;
|
|
85
95
|
console.warn(
|
|
86
96
|
'[securenow] ⚠️ No app identity resolved. Using fallback: %s',
|
|
87
97
|
serviceName,
|
|
@@ -91,7 +101,7 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
91
101
|
);
|
|
92
102
|
}
|
|
93
103
|
|
|
94
|
-
const serviceInstanceId = `${baseName || 'securenow'}-${
|
|
104
|
+
const serviceInstanceId = `${baseName || 'securenow'}-${randomUUID()}`;
|
|
95
105
|
|
|
96
106
|
// ── Endpoints ──
|
|
97
107
|
const resolvedEndpoints = appConfig.resolveEndpoints({ endpoint: opts.endpoint || resolvedApp.instance });
|
|
@@ -101,7 +111,7 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
101
111
|
const headers = resolvedEndpoints.headers;
|
|
102
112
|
|
|
103
113
|
// ── Resource ──
|
|
104
|
-
const resource =
|
|
114
|
+
const resource = createResource({
|
|
105
115
|
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
106
116
|
[SemanticResourceAttributes.SERVICE_INSTANCE_ID]: serviceInstanceId,
|
|
107
117
|
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
|
|
@@ -237,10 +247,10 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
237
247
|
);
|
|
238
248
|
|
|
239
249
|
const logExporter = new OTLPLogExporter({ url: logsUrl, headers });
|
|
240
|
-
loggerProvider = new LoggerProvider({
|
|
241
|
-
|
|
242
|
-
new BatchLogRecordProcessor(logExporter),
|
|
243
|
-
);
|
|
250
|
+
loggerProvider = new LoggerProvider({
|
|
251
|
+
resource,
|
|
252
|
+
processors: [new BatchLogRecordProcessor(logExporter)],
|
|
253
|
+
});
|
|
244
254
|
|
|
245
255
|
const logger = loggerProvider.getLogger('console', '1.0.0');
|
|
246
256
|
const SEV = { DEBUG: 5, INFO: 9, WARN: 13, ERROR: 17 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securenow",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.8",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for Node.js, Next.js, and Nuxt - Send traces and logs to any OTLP-compatible backend",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "register.js",
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
"securenow": "cli.js",
|
|
10
10
|
"securenow-mcp": "mcp/server.js"
|
|
11
11
|
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"postinstall": "node postinstall.js || exit 0"
|
|
14
|
-
},
|
|
15
12
|
"keywords": [
|
|
16
13
|
"opentelemetry",
|
|
17
14
|
"otel",
|
|
@@ -135,47 +132,49 @@
|
|
|
135
132
|
"firewall-tcp.js",
|
|
136
133
|
"firewall-iptables.js",
|
|
137
134
|
"firewall-cloud.js",
|
|
138
|
-
"postinstall.js",
|
|
139
135
|
"register-vite.js",
|
|
140
136
|
"web-vite.mjs",
|
|
141
137
|
"app-config.js",
|
|
142
|
-
"examples/",
|
|
143
|
-
"docs/",
|
|
144
138
|
"README.md",
|
|
145
139
|
"NPM_README.md",
|
|
146
|
-
"CONSUMING-APPS-GUIDE.md",
|
|
147
140
|
"SKILL-CLI.md",
|
|
148
141
|
"SKILL-API.md"
|
|
149
142
|
],
|
|
150
143
|
"dependencies": {
|
|
151
|
-
"@opentelemetry/api": "1.
|
|
152
|
-
"@opentelemetry/api-logs": "0.
|
|
153
|
-
"@opentelemetry/auto-instrumentations-node": "0.
|
|
154
|
-
"@opentelemetry/
|
|
155
|
-
"@opentelemetry/exporter-
|
|
156
|
-
"@opentelemetry/
|
|
157
|
-
"@opentelemetry/instrumentation
|
|
158
|
-
"@opentelemetry/instrumentation-
|
|
159
|
-
"@opentelemetry/instrumentation-
|
|
160
|
-
"@opentelemetry/instrumentation-
|
|
161
|
-
"@opentelemetry/instrumentation-
|
|
162
|
-
"@opentelemetry/instrumentation-
|
|
163
|
-
"@opentelemetry/
|
|
164
|
-
"@opentelemetry/
|
|
165
|
-
"@opentelemetry/sdk-
|
|
166
|
-
"@opentelemetry/sdk-
|
|
167
|
-
"@opentelemetry/
|
|
168
|
-
"
|
|
169
|
-
"
|
|
144
|
+
"@opentelemetry/api": "1.9.1",
|
|
145
|
+
"@opentelemetry/api-logs": "0.218.0",
|
|
146
|
+
"@opentelemetry/auto-instrumentations-node": "0.76.0",
|
|
147
|
+
"@opentelemetry/core": "2.7.1",
|
|
148
|
+
"@opentelemetry/exporter-logs-otlp-http": "0.218.0",
|
|
149
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.218.0",
|
|
150
|
+
"@opentelemetry/instrumentation": "0.218.0",
|
|
151
|
+
"@opentelemetry/instrumentation-document-load": "0.63.0",
|
|
152
|
+
"@opentelemetry/instrumentation-fetch": "0.218.0",
|
|
153
|
+
"@opentelemetry/instrumentation-http": "0.218.0",
|
|
154
|
+
"@opentelemetry/instrumentation-mongodb": "0.71.0",
|
|
155
|
+
"@opentelemetry/instrumentation-user-interaction": "0.62.0",
|
|
156
|
+
"@opentelemetry/instrumentation-xml-http-request": "0.218.0",
|
|
157
|
+
"@opentelemetry/resources": "2.7.1",
|
|
158
|
+
"@opentelemetry/sdk-logs": "0.218.0",
|
|
159
|
+
"@opentelemetry/sdk-metrics": "2.7.1",
|
|
160
|
+
"@opentelemetry/sdk-node": "0.218.0",
|
|
161
|
+
"@opentelemetry/sdk-trace-base": "2.7.1",
|
|
162
|
+
"@opentelemetry/sdk-trace-web": "2.7.1",
|
|
163
|
+
"@opentelemetry/semantic-conventions": "1.41.1",
|
|
164
|
+
"dotenv": "17.2.1"
|
|
170
165
|
},
|
|
171
166
|
"optionalDependencies": {
|
|
172
|
-
"@vercel/otel": "1.
|
|
173
|
-
},
|
|
174
|
-
"overrides": {
|
|
175
|
-
"@opentelemetry/api": "1.7.0",
|
|
176
|
-
"@opentelemetry/api-logs": "0.47.0",
|
|
177
|
-
"protobufjs": "^7.5.5"
|
|
167
|
+
"@vercel/otel": "2.1.2"
|
|
178
168
|
},
|
|
179
169
|
"sideEffects": true,
|
|
180
|
-
"license": "ISC"
|
|
170
|
+
"license": "ISC",
|
|
171
|
+
"directories": {
|
|
172
|
+
"doc": "docs",
|
|
173
|
+
"example": "examples"
|
|
174
|
+
},
|
|
175
|
+
"devDependencies": {},
|
|
176
|
+
"scripts": {
|
|
177
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
178
|
+
},
|
|
179
|
+
"author": ""
|
|
181
180
|
}
|
package/register.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// 1. Load dotenv quietly only for legacy installs. Normal local and production
|
|
10
10
|
// configuration comes from .securenow/credentials.json via app-config.js.
|
|
11
11
|
try {
|
|
12
|
-
require('dotenv').config();
|
|
12
|
+
require('dotenv').config({ quiet: true });
|
|
13
13
|
} catch (e) {
|
|
14
14
|
// dotenv is optional.
|
|
15
15
|
}
|
package/tracing.js
CHANGED
|
@@ -33,15 +33,25 @@ const { NodeSDK } = require('@opentelemetry/sdk-node');
|
|
|
33
33
|
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
34
34
|
const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-http');
|
|
35
35
|
const { LoggerProvider, BatchLogRecordProcessor } = require('@opentelemetry/sdk-logs');
|
|
36
|
-
const
|
|
36
|
+
const otelResources = require('@opentelemetry/resources');
|
|
37
37
|
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
|
38
38
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
|
39
39
|
const { MongoDBInstrumentation } = require('@opentelemetry/instrumentation-mongodb');
|
|
40
|
-
const {
|
|
40
|
+
const { randomUUID } = require('crypto');
|
|
41
41
|
const appConfig = require('./app-config');
|
|
42
42
|
|
|
43
43
|
const env = appConfig.env;
|
|
44
44
|
|
|
45
|
+
function createResource(attributes) {
|
|
46
|
+
if (typeof otelResources.resourceFromAttributes === 'function') {
|
|
47
|
+
return otelResources.resourceFromAttributes(attributes);
|
|
48
|
+
}
|
|
49
|
+
if (typeof otelResources.Resource === 'function') {
|
|
50
|
+
return new otelResources.Resource(attributes);
|
|
51
|
+
}
|
|
52
|
+
throw new Error('Unsupported @opentelemetry/resources version');
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
// Default sensitive fields to redact from request bodies
|
|
46
56
|
const DEFAULT_SENSITIVE_FIELDS = [
|
|
47
57
|
'password', 'passwd', 'pwd', 'secret', 'token', 'api_key', 'apikey',
|
|
@@ -297,15 +307,15 @@ if (!baseName && inPm2Cluster && strict) {
|
|
|
297
307
|
// service.name
|
|
298
308
|
let serviceName;
|
|
299
309
|
if (baseName) {
|
|
300
|
-
serviceName = noUuid ? baseName : `${baseName}-${
|
|
310
|
+
serviceName = noUuid ? baseName : `${baseName}-${randomUUID()}`;
|
|
301
311
|
} else {
|
|
302
312
|
// last-resort fallback (only if STRlCT is off). You can rename this to make it obvious in monitoring.
|
|
303
|
-
serviceName = `securenow-free-${
|
|
313
|
+
serviceName = `securenow-free-${randomUUID()}`;
|
|
304
314
|
}
|
|
305
315
|
|
|
306
316
|
// service.instance.id = <appid-or-fallback>-<uuid> (unique per worker)
|
|
307
317
|
const instancePrefix = baseName || 'securenow';
|
|
308
|
-
const serviceInstanceId = `${instancePrefix}-${
|
|
318
|
+
const serviceInstanceId = `${instancePrefix}-${randomUUID()}`;
|
|
309
319
|
|
|
310
320
|
// Loud line per worker to prove what was used
|
|
311
321
|
console.log('[securenow] pid=%d appId=%s instance=%s apiKey=%s → service.name=%s instance.id=%s',
|
|
@@ -466,7 +476,7 @@ const httpInstrumentation = new HttpInstrumentation({
|
|
|
466
476
|
const loggingEnabled = !/^(0|false)$/i.test(String(env('SECURENOW_LOGGING_ENABLED') ?? ''));
|
|
467
477
|
|
|
468
478
|
// Create shared resource for both traces and logs
|
|
469
|
-
const sharedResource =
|
|
479
|
+
const sharedResource = createResource({
|
|
470
480
|
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
471
481
|
[SemanticResourceAttributes.SERVICE_INSTANCE_ID]: serviceInstanceId,
|
|
472
482
|
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: appConfig.resolveDeploymentEnvironment(),
|
|
@@ -485,8 +495,8 @@ if (loggingEnabled) {
|
|
|
485
495
|
const batchLogProcessor = new BatchLogRecordProcessor(logExporter);
|
|
486
496
|
loggerProvider = new LoggerProvider({
|
|
487
497
|
resource: sharedResource,
|
|
498
|
+
processors: [batchLogProcessor],
|
|
488
499
|
});
|
|
489
|
-
loggerProvider.addLogRecordProcessor(batchLogProcessor);
|
|
490
500
|
|
|
491
501
|
// Auto-patch console.* so every log/warn/error becomes an OTel log record
|
|
492
502
|
const _logger = loggerProvider.getLogger('console', '1.0.0');
|
package/web-vite.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { WebTracerProvider, BatchSpanProcessor } from '@opentelemetry/sdk-trace-web';
|
|
5
5
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
6
|
-
import
|
|
6
|
+
import * as otelResources from '@opentelemetry/resources';
|
|
7
7
|
import { SemanticResourceAttributes as S } from '@opentelemetry/semantic-conventions';
|
|
8
8
|
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
9
9
|
import { DocumentLoadInstrumentation } from '@opentelemetry/instrumentation-document-load';
|
|
@@ -12,9 +12,19 @@ import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
|
|
|
12
12
|
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
|
|
13
13
|
|
|
14
14
|
// ---- helpers / env ----
|
|
15
|
-
const viteEnv
|
|
15
|
+
const viteEnv = import.meta.env || {};
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function createResource(attributes) {
|
|
18
|
+
if (typeof otelResources.resourceFromAttributes === 'function') {
|
|
19
|
+
return otelResources.resourceFromAttributes(attributes);
|
|
20
|
+
}
|
|
21
|
+
if (typeof otelResources.Resource === 'function') {
|
|
22
|
+
return new otelResources.Resource(attributes);
|
|
23
|
+
}
|
|
24
|
+
throw new Error('Unsupported @opentelemetry/resources version');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function env(k) {
|
|
18
28
|
// Accept both Vite envs (VITE_*) and raw names for window.__SECURENOW__
|
|
19
29
|
const direct =
|
|
20
30
|
viteEnv[k] ??
|
|
@@ -23,13 +33,13 @@ function env(k: string): string | undefined {
|
|
|
23
33
|
if (direct != null) return String(direct);
|
|
24
34
|
|
|
25
35
|
// Optionally support runtime overrides via window.__SECURENOW__
|
|
26
|
-
const w =
|
|
36
|
+
const w = globalThis.window;
|
|
27
37
|
if (w && w.__SECURENOW__ && k in w.__SECURENOW__) return String(w.__SECURENOW__[k]);
|
|
28
38
|
return undefined;
|
|
29
39
|
}
|
|
30
40
|
|
|
31
|
-
function parseHeaders(str
|
|
32
|
-
const out
|
|
41
|
+
function parseHeaders(str) {
|
|
42
|
+
const out = {};
|
|
33
43
|
if (!str) return out;
|
|
34
44
|
String(str).split(',').forEach(raw => {
|
|
35
45
|
const s = raw.trim();
|
|
@@ -63,7 +73,7 @@ const noUuid =
|
|
|
63
73
|
: !!baseName;
|
|
64
74
|
const strict = String(env('SECURENOW_STRICT')) === '1' || String(env('SECURENOW_STRICT')).toLowerCase() === 'true';
|
|
65
75
|
|
|
66
|
-
function uuidv4()
|
|
76
|
+
function uuidv4() {
|
|
67
77
|
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
68
78
|
return crypto.randomUUID();
|
|
69
79
|
}
|
|
@@ -79,7 +89,7 @@ function uuidv4(): string {
|
|
|
79
89
|
return `${hex.slice(0,8)}-${hex.slice(8,12)}-${hex.slice(12,16)}-${hex.slice(16,20)}-${hex.slice(20)}`;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
|
-
let serviceName
|
|
92
|
+
let serviceName;
|
|
83
93
|
let disabled = false;
|
|
84
94
|
if (baseName) {
|
|
85
95
|
serviceName = noUuid ? baseName : `${baseName}-${uuidv4()}`;
|
|
@@ -125,15 +135,15 @@ export function startSecurenowWeb() {
|
|
|
125
135
|
});
|
|
126
136
|
|
|
127
137
|
const provider = new WebTracerProvider({
|
|
128
|
-
resource:
|
|
138
|
+
resource: createResource({
|
|
129
139
|
[S.SERVICE_NAME]: serviceName,
|
|
130
140
|
[S.SERVICE_INSTANCE_ID]: serviceInstanceId,
|
|
131
141
|
[S.DEPLOYMENT_ENVIRONMENT]: viteEnv.MODE || 'production',
|
|
132
142
|
[S.SERVICE_VERSION]: viteEnv.VITE_APP_VERSION || undefined,
|
|
133
143
|
}),
|
|
144
|
+
spanProcessors: [new BatchSpanProcessor(exporter)],
|
|
134
145
|
});
|
|
135
146
|
|
|
136
|
-
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
|
|
137
147
|
provider.register();
|
|
138
148
|
|
|
139
149
|
registerInstrumentations({
|
|
@@ -163,13 +173,13 @@ export function startSecurenowWeb() {
|
|
|
163
173
|
}
|
|
164
174
|
|
|
165
175
|
// ---- Free trial banner (browser DOM injection) ----
|
|
166
|
-
function injectFreeTrialBanner()
|
|
176
|
+
function injectFreeTrialBanner() {
|
|
167
177
|
const FREETRIAL_HOST = 'freetrial.securenow.ai';
|
|
168
178
|
const hideBanner = String(env('SECURENOW_HIDE_BANNER')) === '1';
|
|
169
179
|
if (hideBanner || !endpointBase.includes(FREETRIAL_HOST)) return;
|
|
170
180
|
if (typeof document === 'undefined') return;
|
|
171
181
|
|
|
172
|
-
function create()
|
|
182
|
+
function create() {
|
|
173
183
|
if (document.getElementById('sn-ft-banner')) return;
|
|
174
184
|
|
|
175
185
|
const d = document.createElement('div');
|
|
@@ -240,7 +250,7 @@ function injectFreeTrialBanner(): void {
|
|
|
240
250
|
try {
|
|
241
251
|
startSecurenowWeb();
|
|
242
252
|
injectFreeTrialBanner();
|
|
243
|
-
} catch (e
|
|
253
|
+
} catch (e) {
|
|
244
254
|
console.error('[securenow/web-vite] failed to start:', e);
|
|
245
255
|
}
|
|
246
256
|
|