@commercetools/ts-sdk-apm 1.0.2 → 3.0.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @commercetools/ts-sdk-apm
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#896](https://github.com/commercetools/commercetools-sdk-typescript/pull/896) [`f9b8cb6`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f9b8cb605d99fe5ece13bdc3c152eb4818e19b3b) Thanks [@lojzatran](https://github.com/lojzatran)! - Remove support of nodejs 16
8
+
9
+ ## 2.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#564](https://github.com/commercetools/commercetools-sdk-typescript/pull/564) [`db69db1`](https://github.com/commercetools/commercetools-sdk-typescript/commit/db69db1f2a1f6ca69858c272f3905b96b6180bd2) Thanks [@ajimae](https://github.com/ajimae)! - - remove newrelic as dependency in `@commercetools/ts-sdk-apm` package
14
+ - add useragent key with a default `typescript-sdk-apm-middleware` string
15
+ - add example express app on how to add `dynatrace` monitoring in the ts sdk
16
+
3
17
  ## 1.0.2
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -63,12 +63,9 @@ Example
63
63
  const telemetryOptions = {
64
64
  createTelemetryMiddleware, // coming from the `@commercetools/ts-sdk-apm or a custom implementation
65
65
  tracer: () =>
66
- require(require('path').join(
67
- __dirname,
68
- '..',
69
- '..',
70
- 'custom-telemetry-module.js'
71
- )), // make sure the require takes in an absolute path to the custom tracer module.
66
+ require(
67
+ require('path').join(__dirname, '..', '..', 'custom-telemetry-module.js')
68
+ ), // make sure the require takes in an absolute path to the custom tracer module.
72
69
  }
73
70
  ```
74
71
 
@@ -7,17 +7,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
  * opentelemetry tracer modules
8
8
  */
9
9
  const defaultOptions = {
10
- apm: () => require('newrelic'),
10
+ /**
11
+ * if this is to be used with newrelic, then
12
+ * pass this (apm) as an option in the `createTelemetryMiddleware`
13
+ * function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
14
+ * Note: don't forget to install newrelic agent in your project `yarn add newrelic`
15
+ */
16
+ apm: () => {},
11
17
  tracer: () => require('../opentelemetry')
12
18
  };
13
19
  function createTelemetryMiddleware(options) {
14
20
  // trace
15
21
  function trace() {
16
22
  // validate apm and tracer
17
- if (!(options !== null && options !== void 0 && options.apm && typeof options.apm == 'function')) {
23
+ if (!(options?.apm && typeof options.apm == 'function')) {
18
24
  options.apm = defaultOptions.apm;
19
25
  }
20
- if (!(options !== null && options !== void 0 && options.tracer && typeof options.tracer == 'function')) {
26
+ if (!(options?.tracer && typeof options.tracer == 'function')) {
21
27
  options.tracer = defaultOptions.tracer;
22
28
  }
23
29
  options.apm();
@@ -3,17 +3,23 @@
3
3
  * opentelemetry tracer modules
4
4
  */
5
5
  const defaultOptions = {
6
- apm: () => require('newrelic'),
6
+ /**
7
+ * if this is to be used with newrelic, then
8
+ * pass this (apm) as an option in the `createTelemetryMiddleware`
9
+ * function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
10
+ * Note: don't forget to install newrelic agent in your project `yarn add newrelic`
11
+ */
12
+ apm: () => {},
7
13
  tracer: () => require('../opentelemetry')
8
14
  };
9
15
  function createTelemetryMiddleware(options) {
10
16
  // trace
11
17
  function trace() {
12
18
  // validate apm and tracer
13
- if (!(options !== null && options !== void 0 && options.apm && typeof options.apm == 'function')) {
19
+ if (!(options?.apm && typeof options.apm == 'function')) {
14
20
  options.apm = defaultOptions.apm;
15
21
  }
16
- if (!(options !== null && options !== void 0 && options.tracer && typeof options.tracer == 'function')) {
22
+ if (!(options?.tracer && typeof options.tracer == 'function')) {
17
23
  options.tracer = defaultOptions.tracer;
18
24
  }
19
25
  options.apm();
@@ -1,2 +1,2 @@
1
- export * from "./declarations/src/index";
2
- //# sourceMappingURL=commercetools-ts-sdk-apm.cjs.d.ts.map
1
+ export * from "./declarations/src/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy10cy1zZGstYXBtLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -7,17 +7,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
  * opentelemetry tracer modules
8
8
  */
9
9
  const defaultOptions = {
10
- apm: () => require('newrelic'),
10
+ /**
11
+ * if this is to be used with newrelic, then
12
+ * pass this (apm) as an option in the `createTelemetryMiddleware`
13
+ * function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
14
+ * Note: don't forget to install newrelic agent in your project `yarn add newrelic`
15
+ */
16
+ apm: () => {},
11
17
  tracer: () => require('../opentelemetry')
12
18
  };
13
19
  function createTelemetryMiddleware(options) {
14
20
  // trace
15
21
  function trace() {
16
22
  // validate apm and tracer
17
- if (!(options !== null && options !== void 0 && options.apm && typeof options.apm == 'function')) {
23
+ if (!(options?.apm && typeof options.apm == 'function')) {
18
24
  options.apm = defaultOptions.apm;
19
25
  }
20
- if (!(options !== null && options !== void 0 && options.tracer && typeof options.tracer == 'function')) {
26
+ if (!(options?.tracer && typeof options.tracer == 'function')) {
21
27
  options.tracer = defaultOptions.tracer;
22
28
  }
23
29
  options.apm();
@@ -7,17 +7,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
  * opentelemetry tracer modules
8
8
  */
9
9
  const defaultOptions = {
10
- apm: () => require('newrelic'),
10
+ /**
11
+ * if this is to be used with newrelic, then
12
+ * pass this (apm) as an option in the `createTelemetryMiddleware`
13
+ * function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
14
+ * Note: don't forget to install newrelic agent in your project `yarn add newrelic`
15
+ */
16
+ apm: () => {},
11
17
  tracer: () => require('../opentelemetry')
12
18
  };
13
19
  function createTelemetryMiddleware(options) {
14
20
  // trace
15
21
  function trace() {
16
22
  // validate apm and tracer
17
- if (!(options !== null && options !== void 0 && options.apm && typeof options.apm == 'function')) {
23
+ if (!(options?.apm && typeof options.apm == 'function')) {
18
24
  options.apm = defaultOptions.apm;
19
25
  }
20
- if (!(options !== null && options !== void 0 && options.tracer && typeof options.tracer == 'function')) {
26
+ if (!(options?.tracer && typeof options.tracer == 'function')) {
21
27
  options.tracer = defaultOptions.tracer;
22
28
  }
23
29
  options.apm();
@@ -3,17 +3,23 @@
3
3
  * opentelemetry tracer modules
4
4
  */
5
5
  const defaultOptions = {
6
- apm: () => require('newrelic'),
6
+ /**
7
+ * if this is to be used with newrelic, then
8
+ * pass this (apm) as an option in the `createTelemetryMiddleware`
9
+ * function e.g createTelemetryMiddleware({ apm: () => require('newrelic'), ... })
10
+ * Note: don't forget to install newrelic agent in your project `yarn add newrelic`
11
+ */
12
+ apm: () => {},
7
13
  tracer: () => require('../opentelemetry')
8
14
  };
9
15
  function createTelemetryMiddleware(options) {
10
16
  // trace
11
17
  function trace() {
12
18
  // validate apm and tracer
13
- if (!(options !== null && options !== void 0 && options.apm && typeof options.apm == 'function')) {
19
+ if (!(options?.apm && typeof options.apm == 'function')) {
14
20
  options.apm = defaultOptions.apm;
15
21
  }
16
- if (!(options !== null && options !== void 0 && options.tracer && typeof options.tracer == 'function')) {
22
+ if (!(options?.tracer && typeof options.tracer == 'function')) {
17
23
  options.tracer = defaultOptions.tracer;
18
24
  }
19
25
  options.apm();
@@ -1,2 +1,3 @@
1
1
  import type { Middleware, OTelemetryMiddlewareOptions } from "../types/types.js";
2
2
  export default function createTelemetryMiddleware(options: OTelemetryMiddlewareOptions): Middleware;
3
+ //# sourceMappingURL=apm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apm.d.ts","sourceRoot":"../../../src","sources":["apm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,2BAA2B,EAC5B,0BAAsB;AAiBvB,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAO,EAAE,2BAA2B,GACnC,UAAU,CA0BZ"}
@@ -1,2 +1,3 @@
1
1
  export * from "../types/types.js";
2
2
  export { default as createTelemetryMiddleware } from "./apm.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -95,8 +95,9 @@ export type MethodType =
95
95
  | 'UNSUBSCRIBE'
96
96
 
97
97
  export type TelemetryMiddlewareOptions = {
98
- apm?: Function,
99
- tracer?: Function,
98
+ apm?: Function;
99
+ tracer?: Function;
100
+ userAgent?: string;
100
101
  createTelemetryMiddleware: (options?: OTelemetryMiddlewareOptions) => Middleware
101
102
  }
102
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/ts-sdk-apm",
3
- "version": "1.0.2",
3
+ "version": "3.0.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,17 +9,16 @@
9
9
  "private": false,
10
10
  "dependencies": {
11
11
  "@opentelemetry/api": "^1.4.1",
12
- "@opentelemetry/auto-instrumentations-node": "^0.38.0",
13
- "@opentelemetry/exporter-metrics-otlp-http": "^0.41.0",
14
- "@opentelemetry/sdk-node": "^0.41.0",
15
- "newrelic": "^10.0.0",
16
- "uuid": "9.0.0"
12
+ "@opentelemetry/auto-instrumentations-node": "^0.52.0",
13
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.54.0",
14
+ "@opentelemetry/sdk-node": "^0.54.0",
15
+ "uuid": "11.0.3"
17
16
  },
18
17
  "publishConfig": {
19
18
  "access": "public"
20
19
  },
21
20
  "engines": {
22
- "node": ">=14"
21
+ "node": ">=18"
23
22
  },
24
23
  "keywords": [
25
24
  "commercetools",
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercetools-ts-sdk-apm.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}