@commercetools/ts-sdk-apm 3.2.0 → 3.3.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,11 @@
1
1
  # @commercetools/ts-sdk-apm
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#936](https://github.com/commercetools/commercetools-sdk-typescript/pull/936) [`f702837`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f702837c3ec7fde11641c94abb5ed4dab138acf9) Thanks [@barbara79](https://github.com/barbara79)! - updated documentation with client v3
8
+
3
9
  ## 3.2.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -26,7 +26,7 @@ Import the package and add it to the SDK client using `withTelemetryMiddleware()
26
26
 
27
27
  ```typescript
28
28
  // import the @commercetools/ts-sdk-apm package
29
- import { ClientBuilder } from '@commercetools/sdk-client-v2'
29
+ import { ClientBuilder } from '@commercetools/ts-client'
30
30
  import { createTelemetryMiddleware } from '@commercetools/ts-sdk-apm'
31
31
 
32
32
  // newrelic options
@@ -47,13 +47,19 @@ const client = new ClientBuilder()
47
47
 
48
48
  ## Using a custom (user-defined options)
49
49
 
50
- All the monitoring and tracing functionality has been implemented by default however, the `telemetryOptions` accepts three function parameters `createTelemetryMiddleware`, `apm` and `tracer`, the `createTelemetryMiddleware` and `tracer` can be custom implemented.
50
+ All monitoring and tracing functionality are implemented by default.
51
+ The `telemetryOptions` accepts four configuration options: `createTelemetryMiddleware`, `apm`, `tracer` and `customMetrics`. The `createTelemetryMiddleware` and `tracer` parameters can be custom-implemented.
52
+ Additionally, `customMetrics` can be included to record custom metrics based on available APM. For example, if we want to record and send custom metrics to Newrelic, we can set the `newrelic` field to `true` in the customMetrics configuration option same goes for datadog. For collecting custom metrics only Newrelic and Datadog are currently supported.
51
53
 
52
54
  ```typescript
53
55
  type telemetryOptions = {
54
- createTelemetryMiddleware: (options: Omit<telemetryOptions, 'createTelemetryMiddleware'>) => Middleware;
55
- apm?: () => typeof require('newrelic');
56
- tracer?: () => typeof require('/absolute-path-to-a-tracer(opentelemetry)-module')
56
+ createTelemetryMiddleware: (options: Omit<telemetryOptions, 'createTelemetryMiddleware'>) => Middleware,
57
+ apm?: () => typeof require('newrelic'),
58
+ tracer?: () => typeof require('/absolute-path-to-a-tracer(opentelemetry)-module'),
59
+ customMetrics?: {
60
+ newrelic?: true;
61
+ datadog?: false; // it can be omitted
62
+ }
57
63
  }
58
64
  ```
59
65
 
@@ -66,6 +72,9 @@ const telemetryOptions = {
66
72
  require(
67
73
  require('path').join(__dirname, '..', '..', 'custom-telemetry-module.js')
68
74
  ), // make sure the require takes in an absolute path to the custom tracer module.
75
+ customMetrics: {
76
+ datadog: true,
77
+ },
69
78
  }
70
79
  ```
71
80
 
@@ -3,7 +3,6 @@ export type MiddlewareRequest = ClientRequest
3
3
 
4
4
  export type Middleware = (next: Next) => (request: MiddlewareRequest) => Promise<MiddlewareResponse>
5
5
 
6
- // export type Dispatch = (next: Next) => (request: MiddlewareRequest) => Promise<MiddlewareResponse>
7
6
  export type Next = (request: MiddlewareRequest) => Promise<MiddlewareResponse>
8
7
 
9
8
  export type MiddlewareResponse<T = unknown> = {
@@ -33,7 +32,7 @@ export interface ClientRequest {
33
32
 
34
33
  export type ClientResponse<T = any> = {
35
34
  body: T
36
- code?: number
35
+ code?: string
37
36
  statusCode?: number
38
37
  headers?: Record<string, any>
39
38
  error?: HttpErrorType
@@ -43,7 +42,7 @@ export type ClientResponse<T = any> = {
43
42
  export type HttpErrorType = {
44
43
  name?: string
45
44
  message: string
46
- code?: number
45
+ code?: string
47
46
  status?: number
48
47
  method: MethodType
49
48
  statusCode: number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/ts-sdk-apm",
3
- "version": "3.2.0",
3
+ "version": "3.3.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",
@@ -14,7 +14,7 @@
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.5"
17
+ "uuid": "11.1.0"
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": "9.14.7"
58
+ "@types/newrelic": "9.14.8"
59
59
  }
60
60
  }