@commercetools/ts-sdk-apm 3.3.0 → 3.3.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/CHANGELOG.md +12 -0
- package/dist/commercetools-ts-sdk-apm.browser.cjs.js +29 -16
- package/dist/commercetools-ts-sdk-apm.browser.esm.js +29 -16
- package/dist/commercetools-ts-sdk-apm.cjs.dev.js +29 -16
- package/dist/commercetools-ts-sdk-apm.cjs.prod.js +29 -16
- package/dist/commercetools-ts-sdk-apm.esm.js +29 -16
- package/dist/declarations/src/apm.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/newRelicHelper-2ce5bdaf.cjs.prod.js +0 -14
- package/dist/newRelicHelper-76fc4f4a.cjs.dev.js +0 -14
- package/dist/newRelicHelper-7e5ab5ea.browser.cjs.js +0 -14
- package/dist/newRelicHelper-b7df4fbe.esm.js +0 -8
- package/dist/newRelicHelper-ed9e1fad.browser.esm.js +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @commercetools/ts-sdk-apm
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1002](https://github.com/commercetools/commercetools-sdk-typescript/pull/1002) [`6a842db`](https://github.com/commercetools/commercetools-sdk-typescript/commit/6a842db96c51a9ac9bf53b19050acfff961a5fa4) Thanks [@ajimae](https://github.com/ajimae)! - fix issue with tracer functions not being called
|
|
8
|
+
|
|
9
|
+
## 3.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#961](https://github.com/commercetools/commercetools-sdk-typescript/pull/961) [`28f0578`](https://github.com/commercetools/commercetools-sdk-typescript/commit/28f057841fcfd26b30ff41167dc88ada3c143371) Thanks [@ajimae](https://github.com/ajimae)! - Release changes for type modification
|
|
14
|
+
|
|
3
15
|
## 3.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -19,18 +19,34 @@ const recordDatadog = (metric, tags) => {
|
|
|
19
19
|
const time = () => performance.now();
|
|
20
20
|
|
|
21
21
|
function createTelemetryMiddleware$1(options) {
|
|
22
|
+
/**
|
|
23
|
+
* default newrelic APM and
|
|
24
|
+
* opentelemetry tracer modules
|
|
25
|
+
*/
|
|
26
|
+
const defaultOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* if this is to be used with newrelic, then
|
|
29
|
+
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
30
|
+
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
31
|
+
* Note: don't forget to install newrelic agent in your project `yarn add newrelic`
|
|
32
|
+
*/
|
|
33
|
+
apm: () => {},
|
|
34
|
+
tracer: () => require('../opentelemetry')
|
|
35
|
+
};
|
|
36
|
+
|
|
22
37
|
// trace
|
|
23
38
|
function trace() {
|
|
24
39
|
// validate apm and tracer
|
|
25
40
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
26
|
-
options.apm =
|
|
41
|
+
options.apm = defaultOptions.apm;
|
|
27
42
|
}
|
|
28
43
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
29
|
-
options.tracer =
|
|
44
|
+
options.tracer = defaultOptions.tracer;
|
|
30
45
|
}
|
|
46
|
+
options.apm();
|
|
47
|
+
options.tracer();
|
|
31
48
|
}
|
|
32
49
|
trace(); // expose tracing modules
|
|
33
|
-
|
|
34
50
|
return next => async request => {
|
|
35
51
|
// get start (high resolution milliseconds) timestamp
|
|
36
52
|
const start = time();
|
|
@@ -42,19 +58,16 @@ function createTelemetryMiddleware$1(options) {
|
|
|
42
58
|
const response_time = time() - start;
|
|
43
59
|
|
|
44
60
|
// send `response_time` to APM platforms
|
|
45
|
-
if (options?.customMetrics) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = await Promise.resolve().then(function () { return require('./newRelicHelper-7e5ab5ea.browser.cjs.js'); });
|
|
56
|
-
recordNewRelic(response_time);
|
|
57
|
-
}
|
|
61
|
+
if (options?.customMetrics && options.customMetrics.datadog) {
|
|
62
|
+
recordDatadog(response_time, {
|
|
63
|
+
env: process.env.NODE_ENV || 'dev'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (options?.customMetrics && options.customMetrics.newrelic) {
|
|
67
|
+
const {
|
|
68
|
+
recordNewRelic
|
|
69
|
+
} = require('./helpers/newRelicHelper');
|
|
70
|
+
recordNewRelic(response_time);
|
|
58
71
|
}
|
|
59
72
|
return response;
|
|
60
73
|
};
|
|
@@ -11,18 +11,34 @@ const recordDatadog = (metric, tags) => {
|
|
|
11
11
|
const time = () => performance.now();
|
|
12
12
|
|
|
13
13
|
function createTelemetryMiddleware$1(options) {
|
|
14
|
+
/**
|
|
15
|
+
* default newrelic APM and
|
|
16
|
+
* opentelemetry tracer modules
|
|
17
|
+
*/
|
|
18
|
+
const defaultOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* if this is to be used with newrelic, then
|
|
21
|
+
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
22
|
+
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
23
|
+
* Note: don't forget to install newrelic agent in your project `yarn add newrelic`
|
|
24
|
+
*/
|
|
25
|
+
apm: () => {},
|
|
26
|
+
tracer: () => require('../opentelemetry')
|
|
27
|
+
};
|
|
28
|
+
|
|
14
29
|
// trace
|
|
15
30
|
function trace() {
|
|
16
31
|
// validate apm and tracer
|
|
17
32
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
18
|
-
options.apm =
|
|
33
|
+
options.apm = defaultOptions.apm;
|
|
19
34
|
}
|
|
20
35
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
21
|
-
options.tracer =
|
|
36
|
+
options.tracer = defaultOptions.tracer;
|
|
22
37
|
}
|
|
38
|
+
options.apm();
|
|
39
|
+
options.tracer();
|
|
23
40
|
}
|
|
24
41
|
trace(); // expose tracing modules
|
|
25
|
-
|
|
26
42
|
return next => async request => {
|
|
27
43
|
// get start (high resolution milliseconds) timestamp
|
|
28
44
|
const start = time();
|
|
@@ -34,19 +50,16 @@ function createTelemetryMiddleware$1(options) {
|
|
|
34
50
|
const response_time = time() - start;
|
|
35
51
|
|
|
36
52
|
// send `response_time` to APM platforms
|
|
37
|
-
if (options?.customMetrics) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = await import('./newRelicHelper-ed9e1fad.browser.esm.js');
|
|
48
|
-
recordNewRelic(response_time);
|
|
49
|
-
}
|
|
53
|
+
if (options?.customMetrics && options.customMetrics.datadog) {
|
|
54
|
+
recordDatadog(response_time, {
|
|
55
|
+
env: process.env.NODE_ENV || 'dev'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (options?.customMetrics && options.customMetrics.newrelic) {
|
|
59
|
+
const {
|
|
60
|
+
recordNewRelic
|
|
61
|
+
} = require('./helpers/newRelicHelper');
|
|
62
|
+
recordNewRelic(response_time);
|
|
50
63
|
}
|
|
51
64
|
return response;
|
|
52
65
|
};
|
|
@@ -19,18 +19,34 @@ const recordDatadog = (metric, tags) => {
|
|
|
19
19
|
const time = () => performance.now();
|
|
20
20
|
|
|
21
21
|
function createTelemetryMiddleware$1(options) {
|
|
22
|
+
/**
|
|
23
|
+
* default newrelic APM and
|
|
24
|
+
* opentelemetry tracer modules
|
|
25
|
+
*/
|
|
26
|
+
const defaultOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* if this is to be used with newrelic, then
|
|
29
|
+
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
30
|
+
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
31
|
+
* Note: don't forget to install newrelic agent in your project `yarn add newrelic`
|
|
32
|
+
*/
|
|
33
|
+
apm: () => {},
|
|
34
|
+
tracer: () => require('../opentelemetry')
|
|
35
|
+
};
|
|
36
|
+
|
|
22
37
|
// trace
|
|
23
38
|
function trace() {
|
|
24
39
|
// validate apm and tracer
|
|
25
40
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
26
|
-
options.apm =
|
|
41
|
+
options.apm = defaultOptions.apm;
|
|
27
42
|
}
|
|
28
43
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
29
|
-
options.tracer =
|
|
44
|
+
options.tracer = defaultOptions.tracer;
|
|
30
45
|
}
|
|
46
|
+
options.apm();
|
|
47
|
+
options.tracer();
|
|
31
48
|
}
|
|
32
49
|
trace(); // expose tracing modules
|
|
33
|
-
|
|
34
50
|
return next => async request => {
|
|
35
51
|
// get start (high resolution milliseconds) timestamp
|
|
36
52
|
const start = time();
|
|
@@ -42,19 +58,16 @@ function createTelemetryMiddleware$1(options) {
|
|
|
42
58
|
const response_time = time() - start;
|
|
43
59
|
|
|
44
60
|
// send `response_time` to APM platforms
|
|
45
|
-
if (options?.customMetrics) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = await Promise.resolve().then(function () { return require('./newRelicHelper-76fc4f4a.cjs.dev.js'); });
|
|
56
|
-
recordNewRelic(response_time);
|
|
57
|
-
}
|
|
61
|
+
if (options?.customMetrics && options.customMetrics.datadog) {
|
|
62
|
+
recordDatadog(response_time, {
|
|
63
|
+
env: process.env.NODE_ENV || 'dev'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (options?.customMetrics && options.customMetrics.newrelic) {
|
|
67
|
+
const {
|
|
68
|
+
recordNewRelic
|
|
69
|
+
} = require('./helpers/newRelicHelper');
|
|
70
|
+
recordNewRelic(response_time);
|
|
58
71
|
}
|
|
59
72
|
return response;
|
|
60
73
|
};
|
|
@@ -19,18 +19,34 @@ const recordDatadog = (metric, tags) => {
|
|
|
19
19
|
const time = () => performance.now();
|
|
20
20
|
|
|
21
21
|
function createTelemetryMiddleware$1(options) {
|
|
22
|
+
/**
|
|
23
|
+
* default newrelic APM and
|
|
24
|
+
* opentelemetry tracer modules
|
|
25
|
+
*/
|
|
26
|
+
const defaultOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* if this is to be used with newrelic, then
|
|
29
|
+
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
30
|
+
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
31
|
+
* Note: don't forget to install newrelic agent in your project `yarn add newrelic`
|
|
32
|
+
*/
|
|
33
|
+
apm: () => {},
|
|
34
|
+
tracer: () => require('../opentelemetry')
|
|
35
|
+
};
|
|
36
|
+
|
|
22
37
|
// trace
|
|
23
38
|
function trace() {
|
|
24
39
|
// validate apm and tracer
|
|
25
40
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
26
|
-
options.apm =
|
|
41
|
+
options.apm = defaultOptions.apm;
|
|
27
42
|
}
|
|
28
43
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
29
|
-
options.tracer =
|
|
44
|
+
options.tracer = defaultOptions.tracer;
|
|
30
45
|
}
|
|
46
|
+
options.apm();
|
|
47
|
+
options.tracer();
|
|
31
48
|
}
|
|
32
49
|
trace(); // expose tracing modules
|
|
33
|
-
|
|
34
50
|
return next => async request => {
|
|
35
51
|
// get start (high resolution milliseconds) timestamp
|
|
36
52
|
const start = time();
|
|
@@ -42,19 +58,16 @@ function createTelemetryMiddleware$1(options) {
|
|
|
42
58
|
const response_time = time() - start;
|
|
43
59
|
|
|
44
60
|
// send `response_time` to APM platforms
|
|
45
|
-
if (options?.customMetrics) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = await Promise.resolve().then(function () { return require('./newRelicHelper-2ce5bdaf.cjs.prod.js'); });
|
|
56
|
-
recordNewRelic(response_time);
|
|
57
|
-
}
|
|
61
|
+
if (options?.customMetrics && options.customMetrics.datadog) {
|
|
62
|
+
recordDatadog(response_time, {
|
|
63
|
+
env: "production"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (options?.customMetrics && options.customMetrics.newrelic) {
|
|
67
|
+
const {
|
|
68
|
+
recordNewRelic
|
|
69
|
+
} = require('./helpers/newRelicHelper');
|
|
70
|
+
recordNewRelic(response_time);
|
|
58
71
|
}
|
|
59
72
|
return response;
|
|
60
73
|
};
|
|
@@ -11,18 +11,34 @@ const recordDatadog = (metric, tags) => {
|
|
|
11
11
|
const time = () => performance.now();
|
|
12
12
|
|
|
13
13
|
function createTelemetryMiddleware$1(options) {
|
|
14
|
+
/**
|
|
15
|
+
* default newrelic APM and
|
|
16
|
+
* opentelemetry tracer modules
|
|
17
|
+
*/
|
|
18
|
+
const defaultOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* if this is to be used with newrelic, then
|
|
21
|
+
* pass this (apm) as an option in the `createTelemetryMiddleware`
|
|
22
|
+
* function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
|
|
23
|
+
* Note: don't forget to install newrelic agent in your project `yarn add newrelic`
|
|
24
|
+
*/
|
|
25
|
+
apm: () => {},
|
|
26
|
+
tracer: () => require('../opentelemetry')
|
|
27
|
+
};
|
|
28
|
+
|
|
14
29
|
// trace
|
|
15
30
|
function trace() {
|
|
16
31
|
// validate apm and tracer
|
|
17
32
|
if (!(options?.apm && typeof options.apm == 'function')) {
|
|
18
|
-
options.apm =
|
|
33
|
+
options.apm = defaultOptions.apm;
|
|
19
34
|
}
|
|
20
35
|
if (!(options?.tracer && typeof options.tracer == 'function')) {
|
|
21
|
-
options.tracer =
|
|
36
|
+
options.tracer = defaultOptions.tracer;
|
|
22
37
|
}
|
|
38
|
+
options.apm();
|
|
39
|
+
options.tracer();
|
|
23
40
|
}
|
|
24
41
|
trace(); // expose tracing modules
|
|
25
|
-
|
|
26
42
|
return next => async request => {
|
|
27
43
|
// get start (high resolution milliseconds) timestamp
|
|
28
44
|
const start = time();
|
|
@@ -34,19 +50,16 @@ function createTelemetryMiddleware$1(options) {
|
|
|
34
50
|
const response_time = time() - start;
|
|
35
51
|
|
|
36
52
|
// send `response_time` to APM platforms
|
|
37
|
-
if (options?.customMetrics) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = await import('./newRelicHelper-b7df4fbe.esm.js');
|
|
48
|
-
recordNewRelic(response_time);
|
|
49
|
-
}
|
|
53
|
+
if (options?.customMetrics && options.customMetrics.datadog) {
|
|
54
|
+
recordDatadog(response_time, {
|
|
55
|
+
env: process.env.NODE_ENV || 'dev'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (options?.customMetrics && options.customMetrics.newrelic) {
|
|
59
|
+
const {
|
|
60
|
+
recordNewRelic
|
|
61
|
+
} = require('./helpers/newRelicHelper');
|
|
62
|
+
recordNewRelic(response_time);
|
|
50
63
|
}
|
|
51
64
|
return response;
|
|
52
65
|
};
|
|
@@ -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;AAIvB,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAO,EAAE,2BAA2B,GACnC,UAAU,
|
|
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,CAyDZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/ts-sdk-apm",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
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,9 +9,9 @@
|
|
|
9
9
|
"private": false,
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@opentelemetry/api": "^1.4.1",
|
|
12
|
-
"@opentelemetry/auto-instrumentations-node": "^0.
|
|
13
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
14
|
-
"@opentelemetry/sdk-node": "^0.
|
|
12
|
+
"@opentelemetry/auto-instrumentations-node": "^0.57.0",
|
|
13
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.200.0",
|
|
14
|
+
"@opentelemetry/sdk-node": "^0.200.0",
|
|
15
15
|
"dd-trace": "^5.31.0",
|
|
16
16
|
"newrelic": "^12.10.0",
|
|
17
17
|
"uuid": "11.1.0"
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|