@commercetools/ts-sdk-apm 3.1.0 → 3.2.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/CHANGELOG.md +6 -0
- package/dist/commercetools-ts-sdk-apm.browser.cjs.js +20 -38
- package/dist/commercetools-ts-sdk-apm.browser.esm.js +20 -31
- package/dist/commercetools-ts-sdk-apm.cjs.dev.js +20 -38
- package/dist/commercetools-ts-sdk-apm.cjs.prod.js +20 -38
- package/dist/commercetools-ts-sdk-apm.esm.js +20 -31
- package/dist/declarations/src/apm-legacy.d.ts.map +1 -1
- package/dist/declarations/src/apm.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts +0 -1
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/newRelicHelper-2ce5bdaf.cjs.prod.js +14 -0
- package/dist/newRelicHelper-76fc4f4a.cjs.dev.js +14 -0
- package/dist/newRelicHelper-7e5ab5ea.browser.cjs.js +14 -0
- package/dist/newRelicHelper-b7df4fbe.esm.js +8 -0
- package/dist/newRelicHelper-ed9e1fad.browser.esm.js +8 -0
- package/package.json +4 -4
- package/dist/declarations/src/lib/agents.d.ts +0 -4
- package/dist/declarations/src/lib/agents.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @commercetools/ts-sdk-apm
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#933](https://github.com/commercetools/commercetools-sdk-typescript/pull/933) [`be7e9d3`](https://github.com/commercetools/commercetools-sdk-typescript/commit/be7e9d39fb01c696ecb5c5056e50f1376900405d) Thanks [@ajimae](https://github.com/ajimae)! - Release latest typescript apm monitoring package
|
|
8
|
+
|
|
3
9
|
## 3.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -3,52 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var datadog = require('dd-trace');
|
|
6
|
-
var newrelic = require('newrelic');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
8
|
|
|
10
9
|
var datadog__default = /*#__PURE__*/_interopDefault(datadog);
|
|
11
|
-
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
// Initialize datadog once
|
|
12
|
+
datadog__default["default"].init();
|
|
14
13
|
|
|
15
|
-
//
|
|
14
|
+
// Record metrics for datadog
|
|
16
15
|
const recordDatadog = (metric, tags) => {
|
|
17
|
-
datadog__default["default"].
|
|
16
|
+
datadog__default["default"].dogstatsd.gauge(`Commercetools_Client_Response_Total`, metric, tags);
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
const recordNewrelic = metric => {
|
|
22
|
-
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
23
|
-
};
|
|
19
|
+
const time = () => performance.now();
|
|
24
20
|
|
|
25
|
-
/**
|
|
26
|
-
* default newrelic APM and
|
|
27
|
-
* opentelemetry tracer modules
|
|
28
|
-
*/
|
|
29
|
-
const defaultOptions$1 = {
|
|
30
|
-
/**
|
|
31
|
-
* if this is to be used with newrelic, then
|
|
32
|
-
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
33
|
-
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
34
|
-
*/
|
|
35
|
-
apm: () => require('newrelic'),
|
|
36
|
-
tracer: () => require('../opentelemetry')
|
|
37
|
-
};
|
|
38
21
|
function createTelemetryMiddleware$1(options) {
|
|
39
22
|
// trace
|
|
40
23
|
function trace() {
|
|
41
24
|
// validate apm and tracer
|
|
42
25
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
43
|
-
options.apm =
|
|
26
|
+
options.apm = () => {};
|
|
44
27
|
}
|
|
45
28
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
46
|
-
options.tracer =
|
|
29
|
+
options.tracer = () => {};
|
|
47
30
|
}
|
|
48
|
-
options.apm();
|
|
49
|
-
options.tracer();
|
|
50
31
|
}
|
|
51
32
|
trace(); // expose tracing modules
|
|
33
|
+
|
|
52
34
|
return next => async request => {
|
|
53
35
|
// get start (high resolution milliseconds) timestamp
|
|
54
36
|
const start = time();
|
|
@@ -61,10 +43,18 @@ function createTelemetryMiddleware$1(options) {
|
|
|
61
43
|
|
|
62
44
|
// send `response_time` to APM platforms
|
|
63
45
|
if (options?.customMetrics) {
|
|
64
|
-
options.customMetrics.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
if (options.customMetrics.datadog) {
|
|
47
|
+
recordDatadog(response_time, {
|
|
48
|
+
env: process.env.NODE_ENV || 'dev'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (options.customMetrics.newrelic) {
|
|
52
|
+
// Lazy load New Relic only if necessary otherwise it will require to have set the env variable NEW_RELIC_APP_NAME
|
|
53
|
+
const {
|
|
54
|
+
recordNewRelic
|
|
55
|
+
} = await Promise.resolve().then(function () { return require('./newRelicHelper-7e5ab5ea.browser.cjs.js'); });
|
|
56
|
+
recordNewRelic(response_time);
|
|
57
|
+
}
|
|
68
58
|
}
|
|
69
59
|
return response;
|
|
70
60
|
};
|
|
@@ -113,13 +103,5 @@ function createTelemetryMiddleware(options) {
|
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
|
|
116
|
-
Object.defineProperty(exports, 'datadog', {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () { return datadog__default["default"]; }
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, 'newrelic', {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () { return newrelic__default["default"]; }
|
|
123
|
-
});
|
|
124
106
|
exports.createTelemetryMiddleware = createTelemetryMiddleware$1;
|
|
125
107
|
exports.createTelemetryMiddlewareLegacy = createTelemetryMiddleware;
|
|
@@ -1,47 +1,28 @@
|
|
|
1
1
|
import datadog from 'dd-trace';
|
|
2
|
-
export { default as datadog } from 'dd-trace';
|
|
3
|
-
import newrelic from 'newrelic';
|
|
4
|
-
export { default as newrelic } from 'newrelic';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
// Initialize datadog once
|
|
4
|
+
datadog.init();
|
|
7
5
|
|
|
8
|
-
//
|
|
6
|
+
// Record metrics for datadog
|
|
9
7
|
const recordDatadog = (metric, tags) => {
|
|
10
|
-
datadog.
|
|
8
|
+
datadog.dogstatsd.gauge(`Commercetools_Client_Response_Total`, metric, tags);
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
const recordNewrelic = metric => {
|
|
15
|
-
newrelic.recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
16
|
-
};
|
|
11
|
+
const time = () => performance.now();
|
|
17
12
|
|
|
18
|
-
/**
|
|
19
|
-
* default newrelic APM and
|
|
20
|
-
* opentelemetry tracer modules
|
|
21
|
-
*/
|
|
22
|
-
const defaultOptions$1 = {
|
|
23
|
-
/**
|
|
24
|
-
* if this is to be used with newrelic, then
|
|
25
|
-
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
26
|
-
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
27
|
-
*/
|
|
28
|
-
apm: () => require('newrelic'),
|
|
29
|
-
tracer: () => require('../opentelemetry')
|
|
30
|
-
};
|
|
31
13
|
function createTelemetryMiddleware$1(options) {
|
|
32
14
|
// trace
|
|
33
15
|
function trace() {
|
|
34
16
|
// validate apm and tracer
|
|
35
17
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
36
|
-
options.apm =
|
|
18
|
+
options.apm = () => {};
|
|
37
19
|
}
|
|
38
20
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
39
|
-
options.tracer =
|
|
21
|
+
options.tracer = () => {};
|
|
40
22
|
}
|
|
41
|
-
options.apm();
|
|
42
|
-
options.tracer();
|
|
43
23
|
}
|
|
44
24
|
trace(); // expose tracing modules
|
|
25
|
+
|
|
45
26
|
return next => async request => {
|
|
46
27
|
// get start (high resolution milliseconds) timestamp
|
|
47
28
|
const start = time();
|
|
@@ -54,10 +35,18 @@ function createTelemetryMiddleware$1(options) {
|
|
|
54
35
|
|
|
55
36
|
// send `response_time` to APM platforms
|
|
56
37
|
if (options?.customMetrics) {
|
|
57
|
-
options.customMetrics.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
if (options.customMetrics.datadog) {
|
|
39
|
+
recordDatadog(response_time, {
|
|
40
|
+
env: process.env.NODE_ENV || 'dev'
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (options.customMetrics.newrelic) {
|
|
44
|
+
// Lazy load New Relic only if necessary otherwise it will require to have set the env variable NEW_RELIC_APP_NAME
|
|
45
|
+
const {
|
|
46
|
+
recordNewRelic
|
|
47
|
+
} = await import('./newRelicHelper-ed9e1fad.browser.esm.js');
|
|
48
|
+
recordNewRelic(response_time);
|
|
49
|
+
}
|
|
61
50
|
}
|
|
62
51
|
return response;
|
|
63
52
|
};
|
|
@@ -3,52 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var datadog = require('dd-trace');
|
|
6
|
-
var newrelic = require('newrelic');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
8
|
|
|
10
9
|
var datadog__default = /*#__PURE__*/_interopDefault(datadog);
|
|
11
|
-
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
// Initialize datadog once
|
|
12
|
+
datadog__default["default"].init();
|
|
14
13
|
|
|
15
|
-
//
|
|
14
|
+
// Record metrics for datadog
|
|
16
15
|
const recordDatadog = (metric, tags) => {
|
|
17
|
-
datadog__default["default"].
|
|
16
|
+
datadog__default["default"].dogstatsd.gauge(`Commercetools_Client_Response_Total`, metric, tags);
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
const recordNewrelic = metric => {
|
|
22
|
-
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
23
|
-
};
|
|
19
|
+
const time = () => performance.now();
|
|
24
20
|
|
|
25
|
-
/**
|
|
26
|
-
* default newrelic APM and
|
|
27
|
-
* opentelemetry tracer modules
|
|
28
|
-
*/
|
|
29
|
-
const defaultOptions$1 = {
|
|
30
|
-
/**
|
|
31
|
-
* if this is to be used with newrelic, then
|
|
32
|
-
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
33
|
-
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
34
|
-
*/
|
|
35
|
-
apm: () => require('newrelic'),
|
|
36
|
-
tracer: () => require('../opentelemetry')
|
|
37
|
-
};
|
|
38
21
|
function createTelemetryMiddleware$1(options) {
|
|
39
22
|
// trace
|
|
40
23
|
function trace() {
|
|
41
24
|
// validate apm and tracer
|
|
42
25
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
43
|
-
options.apm =
|
|
26
|
+
options.apm = () => {};
|
|
44
27
|
}
|
|
45
28
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
46
|
-
options.tracer =
|
|
29
|
+
options.tracer = () => {};
|
|
47
30
|
}
|
|
48
|
-
options.apm();
|
|
49
|
-
options.tracer();
|
|
50
31
|
}
|
|
51
32
|
trace(); // expose tracing modules
|
|
33
|
+
|
|
52
34
|
return next => async request => {
|
|
53
35
|
// get start (high resolution milliseconds) timestamp
|
|
54
36
|
const start = time();
|
|
@@ -61,10 +43,18 @@ function createTelemetryMiddleware$1(options) {
|
|
|
61
43
|
|
|
62
44
|
// send `response_time` to APM platforms
|
|
63
45
|
if (options?.customMetrics) {
|
|
64
|
-
options.customMetrics.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
if (options.customMetrics.datadog) {
|
|
47
|
+
recordDatadog(response_time, {
|
|
48
|
+
env: process.env.NODE_ENV || 'dev'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (options.customMetrics.newrelic) {
|
|
52
|
+
// Lazy load New Relic only if necessary otherwise it will require to have set the env variable NEW_RELIC_APP_NAME
|
|
53
|
+
const {
|
|
54
|
+
recordNewRelic
|
|
55
|
+
} = await Promise.resolve().then(function () { return require('./newRelicHelper-76fc4f4a.cjs.dev.js'); });
|
|
56
|
+
recordNewRelic(response_time);
|
|
57
|
+
}
|
|
68
58
|
}
|
|
69
59
|
return response;
|
|
70
60
|
};
|
|
@@ -113,13 +103,5 @@ function createTelemetryMiddleware(options) {
|
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
|
|
116
|
-
Object.defineProperty(exports, 'datadog', {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () { return datadog__default["default"]; }
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, 'newrelic', {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () { return newrelic__default["default"]; }
|
|
123
|
-
});
|
|
124
106
|
exports.createTelemetryMiddleware = createTelemetryMiddleware$1;
|
|
125
107
|
exports.createTelemetryMiddlewareLegacy = createTelemetryMiddleware;
|
|
@@ -3,52 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var datadog = require('dd-trace');
|
|
6
|
-
var newrelic = require('newrelic');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
8
|
|
|
10
9
|
var datadog__default = /*#__PURE__*/_interopDefault(datadog);
|
|
11
|
-
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
// Initialize datadog once
|
|
12
|
+
datadog__default["default"].init();
|
|
14
13
|
|
|
15
|
-
//
|
|
14
|
+
// Record metrics for datadog
|
|
16
15
|
const recordDatadog = (metric, tags) => {
|
|
17
|
-
datadog__default["default"].
|
|
16
|
+
datadog__default["default"].dogstatsd.gauge(`Commercetools_Client_Response_Total`, metric, tags);
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
const recordNewrelic = metric => {
|
|
22
|
-
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
23
|
-
};
|
|
19
|
+
const time = () => performance.now();
|
|
24
20
|
|
|
25
|
-
/**
|
|
26
|
-
* default newrelic APM and
|
|
27
|
-
* opentelemetry tracer modules
|
|
28
|
-
*/
|
|
29
|
-
const defaultOptions$1 = {
|
|
30
|
-
/**
|
|
31
|
-
* if this is to be used with newrelic, then
|
|
32
|
-
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
33
|
-
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
34
|
-
*/
|
|
35
|
-
apm: () => require('newrelic'),
|
|
36
|
-
tracer: () => require('../opentelemetry')
|
|
37
|
-
};
|
|
38
21
|
function createTelemetryMiddleware$1(options) {
|
|
39
22
|
// trace
|
|
40
23
|
function trace() {
|
|
41
24
|
// validate apm and tracer
|
|
42
25
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
43
|
-
options.apm =
|
|
26
|
+
options.apm = () => {};
|
|
44
27
|
}
|
|
45
28
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
46
|
-
options.tracer =
|
|
29
|
+
options.tracer = () => {};
|
|
47
30
|
}
|
|
48
|
-
options.apm();
|
|
49
|
-
options.tracer();
|
|
50
31
|
}
|
|
51
32
|
trace(); // expose tracing modules
|
|
33
|
+
|
|
52
34
|
return next => async request => {
|
|
53
35
|
// get start (high resolution milliseconds) timestamp
|
|
54
36
|
const start = time();
|
|
@@ -61,10 +43,18 @@ function createTelemetryMiddleware$1(options) {
|
|
|
61
43
|
|
|
62
44
|
// send `response_time` to APM platforms
|
|
63
45
|
if (options?.customMetrics) {
|
|
64
|
-
options.customMetrics.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
if (options.customMetrics.datadog) {
|
|
47
|
+
recordDatadog(response_time, {
|
|
48
|
+
env: "production"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (options.customMetrics.newrelic) {
|
|
52
|
+
// Lazy load New Relic only if necessary otherwise it will require to have set the env variable NEW_RELIC_APP_NAME
|
|
53
|
+
const {
|
|
54
|
+
recordNewRelic
|
|
55
|
+
} = await Promise.resolve().then(function () { return require('./newRelicHelper-2ce5bdaf.cjs.prod.js'); });
|
|
56
|
+
recordNewRelic(response_time);
|
|
57
|
+
}
|
|
68
58
|
}
|
|
69
59
|
return response;
|
|
70
60
|
};
|
|
@@ -113,13 +103,5 @@ function createTelemetryMiddleware(options) {
|
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
|
|
116
|
-
Object.defineProperty(exports, 'datadog', {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () { return datadog__default["default"]; }
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, 'newrelic', {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () { return newrelic__default["default"]; }
|
|
123
|
-
});
|
|
124
106
|
exports.createTelemetryMiddleware = createTelemetryMiddleware$1;
|
|
125
107
|
exports.createTelemetryMiddlewareLegacy = createTelemetryMiddleware;
|
|
@@ -1,47 +1,28 @@
|
|
|
1
1
|
import datadog from 'dd-trace';
|
|
2
|
-
export { default as datadog } from 'dd-trace';
|
|
3
|
-
import newrelic from 'newrelic';
|
|
4
|
-
export { default as newrelic } from 'newrelic';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
// Initialize datadog once
|
|
4
|
+
datadog.init();
|
|
7
5
|
|
|
8
|
-
//
|
|
6
|
+
// Record metrics for datadog
|
|
9
7
|
const recordDatadog = (metric, tags) => {
|
|
10
|
-
datadog.
|
|
8
|
+
datadog.dogstatsd.gauge(`Commercetools_Client_Response_Total`, metric, tags);
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
const recordNewrelic = metric => {
|
|
15
|
-
newrelic.recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
16
|
-
};
|
|
11
|
+
const time = () => performance.now();
|
|
17
12
|
|
|
18
|
-
/**
|
|
19
|
-
* default newrelic APM and
|
|
20
|
-
* opentelemetry tracer modules
|
|
21
|
-
*/
|
|
22
|
-
const defaultOptions$1 = {
|
|
23
|
-
/**
|
|
24
|
-
* if this is to be used with newrelic, then
|
|
25
|
-
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
26
|
-
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
27
|
-
*/
|
|
28
|
-
apm: () => require('newrelic'),
|
|
29
|
-
tracer: () => require('../opentelemetry')
|
|
30
|
-
};
|
|
31
13
|
function createTelemetryMiddleware$1(options) {
|
|
32
14
|
// trace
|
|
33
15
|
function trace() {
|
|
34
16
|
// validate apm and tracer
|
|
35
17
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
36
|
-
options.apm =
|
|
18
|
+
options.apm = () => {};
|
|
37
19
|
}
|
|
38
20
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
39
|
-
options.tracer =
|
|
21
|
+
options.tracer = () => {};
|
|
40
22
|
}
|
|
41
|
-
options.apm();
|
|
42
|
-
options.tracer();
|
|
43
23
|
}
|
|
44
24
|
trace(); // expose tracing modules
|
|
25
|
+
|
|
45
26
|
return next => async request => {
|
|
46
27
|
// get start (high resolution milliseconds) timestamp
|
|
47
28
|
const start = time();
|
|
@@ -54,10 +35,18 @@ function createTelemetryMiddleware$1(options) {
|
|
|
54
35
|
|
|
55
36
|
// send `response_time` to APM platforms
|
|
56
37
|
if (options?.customMetrics) {
|
|
57
|
-
options.customMetrics.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
if (options.customMetrics.datadog) {
|
|
39
|
+
recordDatadog(response_time, {
|
|
40
|
+
env: process.env.NODE_ENV || 'dev'
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (options.customMetrics.newrelic) {
|
|
44
|
+
// Lazy load New Relic only if necessary otherwise it will require to have set the env variable NEW_RELIC_APP_NAME
|
|
45
|
+
const {
|
|
46
|
+
recordNewRelic
|
|
47
|
+
} = await import('./newRelicHelper-b7df4fbe.esm.js');
|
|
48
|
+
recordNewRelic(response_time);
|
|
49
|
+
}
|
|
61
50
|
}
|
|
62
51
|
return response;
|
|
63
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apm-legacy.d.ts","sourceRoot":"../../../src","sources":["apm-legacy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"apm-legacy.d.ts","sourceRoot":"../../../src","sources":["apm-legacy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAIhB,2BAA2B,EAC5B,0BAAsB;AAiBvB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAO,EAAE,2BAA2B,GACnC,gBAAgB,CA0BlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apm.d.ts","sourceRoot":"../../../src","sources":["apm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,2BAA2B,EAC5B,0BAAsB;
|
|
1
|
+
{"version":3,"file":"apm.d.ts","sourceRoot":"../../../src","sources":["apm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,2BAA2B,EAC5B,0BAAsB;AAIvB,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAO,EAAE,2BAA2B,GACnC,UAAU,CA0CZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AAAA,kCAAgC;AAChC,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,iBAAa;AAC5D,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,wBAAoB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AAAA,kCAAgC;AAChC,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,iBAAa;AAC5D,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,wBAAoB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var newrelic = require('newrelic');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
8
|
+
|
|
9
|
+
// record for newrelic
|
|
10
|
+
const recordNewRelic = metric => {
|
|
11
|
+
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.recordNewRelic = recordNewRelic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var newrelic = require('newrelic');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
8
|
+
|
|
9
|
+
// record for newrelic
|
|
10
|
+
const recordNewRelic = metric => {
|
|
11
|
+
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.recordNewRelic = recordNewRelic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var newrelic = require('newrelic');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var newrelic__default = /*#__PURE__*/_interopDefault(newrelic);
|
|
8
|
+
|
|
9
|
+
// record for newrelic
|
|
10
|
+
const recordNewRelic = metric => {
|
|
11
|
+
newrelic__default["default"].recordMetric(`Commercetools/Client/Response/Total`, metric);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.recordNewRelic = recordNewRelic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/ts-sdk-apm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "commercetools typescript SDK application performance monitoring.",
|
|
5
5
|
"main": "dist/commercetools-ts-sdk-apm.cjs.js",
|
|
6
6
|
"module": "dist/commercetools-ts-sdk-apm.esm.js",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"private": false,
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@opentelemetry/api": "^1.4.1",
|
|
12
|
-
"@opentelemetry/auto-instrumentations-node": "^0.
|
|
12
|
+
"@opentelemetry/auto-instrumentations-node": "^0.56.0",
|
|
13
13
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.57.0",
|
|
14
14
|
"@opentelemetry/sdk-node": "^0.57.0",
|
|
15
15
|
"dd-trace": "^5.31.0",
|
|
16
16
|
"newrelic": "^12.10.0",
|
|
17
|
-
"uuid": "11.0.
|
|
17
|
+
"uuid": "11.0.5"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"post_process_generate": "yarn organize_imports"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/newrelic": "
|
|
58
|
+
"@types/newrelic": "9.14.7"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"../../../../src/lib","sources":["agents.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,QAAQ,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|