trickle-observe 0.2.98 → 0.2.100

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.
@@ -53,7 +53,7 @@ const path = __importStar(require("path"));
53
53
  let queriesFile = null;
54
54
  let debugMode = false;
55
55
  const MAX_QUERY_LENGTH = 500;
56
- const MAX_QUERIES = 100;
56
+ const MAX_QUERIES = 500;
57
57
  let queryCount = 0;
58
58
  function getQueriesFile() {
59
59
  if (queriesFile)
@@ -757,7 +757,10 @@ function transformCjsSource(source, filename, moduleName, env, sourceMap) {
757
757
  }
758
758
  }
759
759
  // Also find variable declarations for tracing
760
- const varTraceEnabled = process.env.TRICKLE_TRACE_VARS !== '0';
760
+ // In production mode, disable variable tracing by default
761
+ const isProduction = process.env.TRICKLE_PRODUCTION === '1' || process.env.TRICKLE_PRODUCTION === 'true';
762
+ const varTraceDefault = isProduction ? '0' : '1';
763
+ const varTraceEnabled = (process.env.TRICKLE_TRACE_VARS || varTraceDefault) !== '0';
761
764
  // For TypeScript files (compiled by ts-node/tsc), type declarations (interfaces, type aliases)
762
765
  // are stripped from the compiled JS, shifting line numbers. The only accurate way to get correct
763
766
  // line numbers is to read the original .ts source file and parse it directly.
@@ -885,7 +888,7 @@ function transformCjsSource(source, filename, moduleName, env, sourceMap) {
885
888
  ` module: ${JSON.stringify(effectiveModuleName)},`,
886
889
  ` trackArgs: true,`,
887
890
  ` trackReturn: true,`,
888
- ` sampleRate: 1,`,
891
+ ` sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),`,
889
892
  ` maxDepth: 3,`,
890
893
  ` environment: ${JSON.stringify(env)},`,
891
894
  ` enabled: true,`,
@@ -1253,7 +1256,7 @@ if (enabled) {
1253
1256
  module: moduleName,
1254
1257
  trackArgs: true,
1255
1258
  trackReturn: true,
1256
- sampleRate: 1,
1259
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1257
1260
  maxDepth: 3,
1258
1261
  environment,
1259
1262
  enabled: true,
@@ -1306,7 +1309,7 @@ if (enabled) {
1306
1309
  module: moduleName,
1307
1310
  trackArgs: true,
1308
1311
  trackReturn: true,
1309
- sampleRate: 1,
1312
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1310
1313
  maxDepth: 3,
1311
1314
  environment,
1312
1315
  enabled: true,
@@ -1359,7 +1362,7 @@ if (enabled) {
1359
1362
  module: moduleName,
1360
1363
  trackArgs: true,
1361
1364
  trackReturn: true,
1362
- sampleRate: 1,
1365
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1363
1366
  maxDepth: 3,
1364
1367
  environment,
1365
1368
  enabled: true,
@@ -1392,7 +1395,7 @@ if (enabled) {
1392
1395
  module: moduleName,
1393
1396
  trackArgs: true,
1394
1397
  trackReturn: true,
1395
- sampleRate: 1,
1398
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1396
1399
  maxDepth: 3,
1397
1400
  environment,
1398
1401
  enabled: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trickle-observe",
3
- "version": "0.2.98",
3
+ "version": "0.2.100",
4
4
  "description": "Runtime type observability for JavaScript applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@ interface QueryRecord {
26
26
  let queriesFile: string | null = null;
27
27
  let debugMode = false;
28
28
  const MAX_QUERY_LENGTH = 500;
29
- const MAX_QUERIES = 100;
29
+ const MAX_QUERIES = 500;
30
30
  let queryCount = 0;
31
31
 
32
32
  function getQueriesFile(): string {
@@ -717,7 +717,10 @@ function transformCjsSource(source: string, filename: string, moduleName: string
717
717
  }
718
718
 
719
719
  // Also find variable declarations for tracing
720
- const varTraceEnabled = process.env.TRICKLE_TRACE_VARS !== '0';
720
+ // In production mode, disable variable tracing by default
721
+ const isProduction = process.env.TRICKLE_PRODUCTION === '1' || process.env.TRICKLE_PRODUCTION === 'true';
722
+ const varTraceDefault = isProduction ? '0' : '1';
723
+ const varTraceEnabled = (process.env.TRICKLE_TRACE_VARS || varTraceDefault) !== '0';
721
724
 
722
725
  // For TypeScript files (compiled by ts-node/tsc), type declarations (interfaces, type aliases)
723
726
  // are stripped from the compiled JS, shifting line numbers. The only accurate way to get correct
@@ -851,7 +854,7 @@ function transformCjsSource(source: string, filename: string, moduleName: string
851
854
  ` module: ${JSON.stringify(effectiveModuleName)},`,
852
855
  ` trackArgs: true,`,
853
856
  ` trackReturn: true,`,
854
- ` sampleRate: 1,`,
857
+ ` sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),`,
855
858
  ` maxDepth: 3,`,
856
859
  ` environment: ${JSON.stringify(env)},`,
857
860
  ` enabled: true,`,
@@ -1235,7 +1238,7 @@ if (enabled) {
1235
1238
  module: moduleName,
1236
1239
  trackArgs: true,
1237
1240
  trackReturn: true,
1238
- sampleRate: 1,
1241
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1239
1242
  maxDepth: 3,
1240
1243
  environment,
1241
1244
  enabled: true,
@@ -1280,7 +1283,7 @@ if (enabled) {
1280
1283
  module: moduleName,
1281
1284
  trackArgs: true,
1282
1285
  trackReturn: true,
1283
- sampleRate: 1,
1286
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1284
1287
  maxDepth: 3,
1285
1288
  environment,
1286
1289
  enabled: true,
@@ -1322,7 +1325,7 @@ if (enabled) {
1322
1325
  module: moduleName,
1323
1326
  trackArgs: true,
1324
1327
  trackReturn: true,
1325
- sampleRate: 1,
1328
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1326
1329
  maxDepth: 3,
1327
1330
  environment,
1328
1331
  enabled: true,
@@ -1353,7 +1356,7 @@ if (enabled) {
1353
1356
  module: moduleName,
1354
1357
  trackArgs: true,
1355
1358
  trackReturn: true,
1356
- sampleRate: 1,
1359
+ sampleRate: parseFloat(process.env.TRICKLE_SAMPLE_RATE || '1'),
1357
1360
  maxDepth: 3,
1358
1361
  environment,
1359
1362
  enabled: true,