@contrast/agentify 1.52.2 → 1.54.0

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/lib/index.js CHANGED
@@ -12,7 +12,6 @@
12
12
  * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
13
  * way not consistent with the End User License Agreement.
14
14
  */
15
- /*eslint node/no-unsupported-features/es-syntax: ["error", {version: >=10.0.0}]*/
16
15
  'use strict';
17
16
 
18
17
  const Module = require('module');
@@ -137,6 +136,7 @@ module.exports = function init(core = {}) {
137
136
 
138
137
  logger.info('Starting %s v%s', core.agentName, core.agentVersion);
139
138
  logger.info({ config }, 'Agent configuration');
139
+ logger.debug({ effectiveConfig: config.getReport({ redact: true }) }, 'Effective configuration');
140
140
 
141
141
  const plugin = await _callback?.(core);
142
142
 
@@ -191,9 +191,9 @@ module.exports = function init(core = {}) {
191
191
  { name: 'reporter', spec: '@contrast/reporter', default: true },
192
192
  { name: 'instrumentation', spec: '@contrast/instrumentation' },
193
193
  { name: 'metrics', spec: '@contrast/metrics' },
194
+ { name: 'sources', spec: '@contrast/sources' },
194
195
  // compose additional local services
195
196
  { name: 'heap-snapshots', spec: './heap-snapshots' },
196
- { name: 'sources', spec: './sources' },
197
197
  { name: 'function-hooks', spec: './function-hooks' },
198
198
  { name: 'diagnostics', spec: './diagnostics' },
199
199
  { name: 'rewrite-hooks', spec: './rewrite-hooks' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agentify",
3
- "version": "1.52.2",
3
+ "version": "1.54.0",
4
4
  "description": "Configures Contrast agent services and instrumentation within an application",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -20,21 +20,22 @@
20
20
  "test": "bash ../scripts/test.sh"
21
21
  },
22
22
  "dependencies": {
23
- "@contrast/common": "1.34.2",
24
- "@contrast/config": "1.49.2",
25
- "@contrast/core": "1.54.2",
26
- "@contrast/deadzones": "1.26.2",
27
- "@contrast/dep-hooks": "1.23.2",
28
- "@contrast/esm-hooks": "2.28.2",
23
+ "@contrast/common": "1.35.0",
24
+ "@contrast/config": "1.50.0",
25
+ "@contrast/core": "1.55.0",
26
+ "@contrast/deadzones": "1.27.0",
27
+ "@contrast/dep-hooks": "1.24.0",
28
+ "@contrast/esm-hooks": "2.29.0",
29
29
  "@contrast/find-package-json": "^1.1.0",
30
- "@contrast/instrumentation": "1.33.2",
31
- "@contrast/logger": "1.27.2",
32
- "@contrast/metrics": "1.31.2",
33
- "@contrast/patcher": "1.26.2",
30
+ "@contrast/instrumentation": "1.34.0",
31
+ "@contrast/logger": "1.28.0",
32
+ "@contrast/metrics": "1.32.0",
33
+ "@contrast/patcher": "1.27.0",
34
34
  "@contrast/perf": "1.3.1",
35
- "@contrast/reporter": "1.51.2",
36
- "@contrast/rewriter": "1.30.2",
37
- "@contrast/scopes": "1.24.2",
35
+ "@contrast/reporter": "1.53.0",
36
+ "@contrast/rewriter": "1.31.0",
37
+ "@contrast/scopes": "1.25.0",
38
+ "@contrast/sources": "1.1.0",
38
39
  "on-finished": "^2.4.1",
39
40
  "semver": "^7.6.0"
40
41
  }
package/lib/sources.js DELETED
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright: 2025 Contrast Security, Inc
3
- * Contact: support@contrastsecurity.com
4
- * License: Commercial
5
-
6
- * NOTICE: This Software and the patented inventions embodied within may only be
7
- * used as part of Contrast Security’s commercial offerings. Even though it is
8
- * made available through public repositories, use of this Software is subject to
9
- * the applicable End User Licensing Agreement found at
10
- * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
11
- * between Contrast Security and the End User. The Software may not be reverse
12
- * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
- * way not consistent with the End User License Agreement.
14
- */
15
-
16
- 'use strict';
17
-
18
- const { EventEmitter } = require('events');
19
- const onFinished = require('on-finished');
20
- const { Event, primordials: { StringPrototypeToLowerCase } } = require('@contrast/common');
21
-
22
- module.exports = function(core) {
23
- const {
24
- messages,
25
- instrumentation: { instrument },
26
- scopes: { sources: sourcesStorage }
27
- } = core;
28
-
29
- const _hooks = new EventEmitter();
30
-
31
- function aroundHook(serverType) {
32
- return function around(next, data) {
33
- const { args: [event, req, res] } = data;
34
-
35
- if (event !== 'request') {
36
- if (event === 'listening') {
37
- // take a snapshot of Perf.all at this point. this will get logged
38
- // at some point on the perf interval timer.
39
- core.Perf.mark('listening');
40
- messages.emit(Event.SERVER_LISTENING, { type: serverType, server: data.obj });
41
- }
42
- return next();
43
- }
44
- // let's count requests.
45
- core.Perf.requestCount += 1;
46
-
47
- const store = {
48
- sourceInfo: {
49
- port: req.socket.address?.()?.port || 0,
50
- protocol: serverType === 'http' ? 'http' : 'https',
51
- serverType,
52
- time: Date.now(),
53
- method: StringPrototypeToLowerCase.call(req.method),
54
- }
55
- };
56
-
57
- if (_hooks._events.onSource) {
58
- _hooks.emit('onSource', {
59
- // future: non-http sources will have their own type
60
- sourceType: 'HTTP',
61
- store,
62
- incomingMessage: req,
63
- serverResponse: res,
64
- });
65
- }
66
-
67
- onFinished(res, (/* err, req */) => {
68
- messages.emit(Event.RESPONSE_FINISH, store);
69
- });
70
-
71
- return sourcesStorage.run(store, next);
72
- };
73
- }
74
-
75
- function install() {
76
- ['http', 'https', 'spdy', 'http2'].forEach((moduleName) => {
77
- instrument({
78
- moduleName,
79
- patchObjects: [{
80
- name: 'Server.prototype',
81
- methods: ['emit'],
82
- patchType: 'sources',
83
- around: aroundHook(moduleName)
84
- }]
85
- });
86
- });
87
- }
88
- return core.sources = {
89
- install,
90
- addHook(name, handler) {
91
- if (name === 'onSource') _hooks.on(name, handler);
92
- },
93
- aroundHook
94
- };
95
- };