@moreapp/common-nodejs 0.7.3 → 0.7.4
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/README.md +35 -9
- package/dist/tracer.d.ts +4 -4
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
# MoreApp Common
|
|
1
|
+
# MoreApp Common Node.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This project contains common code that can be used for our Node.js projects.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Getting started
|
|
6
6
|
|
|
7
7
|
Run `yarn prepare` once to install Git hooks, doing lints and prettier formatting
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Project usage
|
|
10
|
+
|
|
11
|
+
Most code can be used as is, except for tracing, see below.
|
|
10
12
|
|
|
11
13
|
### Tracing
|
|
12
14
|
|
|
13
|
-
Tracing code should always be loaded first, before any other libraries. This is because the
|
|
14
|
-
instrumentations monkey patch libraries to add tracing.
|
|
15
|
-
|
|
15
|
+
Tracing code should always be loaded (`import`/`require`) first, before any other libraries. This is because the
|
|
16
|
+
OpenTelemetry instrumentations monkey patch libraries to add tracing. Patching has to happen first, because already
|
|
17
|
+
loaded libraries will be cached by the module system.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
The recommended way to do this, is to create a file `instrumentation.ts` with the following content (the extra
|
|
20
|
+
instrumentation is there as an example):
|
|
18
21
|
|
|
19
22
|
```
|
|
20
|
-
|
|
23
|
+
import { tracer } from "@moreapp/common-nodejs";
|
|
24
|
+
import { MongoDBInstrumentation } from "@opentelemetry/instrumentation-mongodb";
|
|
25
|
+
|
|
26
|
+
tracer("<SERVICE_NAME>", {
|
|
27
|
+
extraInstrumentations: [new MongoDBInstrumentation()],
|
|
28
|
+
});
|
|
21
29
|
```
|
|
30
|
+
|
|
31
|
+
And then use the `--require` [Node.js CLI option](https://nodejs.org/api/cli.html#-r---require-module) to load this file.
|
|
32
|
+
|
|
33
|
+
## Creating a new release
|
|
34
|
+
|
|
35
|
+
Follow the steps below to create a new release:
|
|
36
|
+
|
|
37
|
+
1. Ensure that the `master` branch has the commits you want to release
|
|
38
|
+
2. Start a new build in Bitbucket Pipelines for the `master` branch with the `create-release` pipeline
|
|
39
|
+
3. Select which type of version bump you want to do
|
|
40
|
+
4. The build will automatically create a new version and publish it to NPM
|
|
41
|
+
|
|
42
|
+
### Creating a local release
|
|
43
|
+
|
|
44
|
+
If you want to test new code in other projects, then you can link this repository using `Yarn`.
|
|
45
|
+
|
|
46
|
+
1. Run `yarn link` in this repository
|
|
47
|
+
2. Run `yarn link @moreapp/common-nodejs` in the project you want to use this repository in
|
package/dist/tracer.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as types from "@opentelemetry/instrumentation/build/src/types";
|
|
2
2
|
export declare const tracer: (serviceName: string, { http, extraInstrumentations, debug, }: {
|
|
3
|
-
http
|
|
3
|
+
http?: {
|
|
4
4
|
portsToInstrument: number[];
|
|
5
|
-
};
|
|
6
|
-
extraInstrumentations
|
|
7
|
-
debug
|
|
5
|
+
} | undefined;
|
|
6
|
+
extraInstrumentations?: types.Instrumentation[] | undefined;
|
|
7
|
+
debug?: boolean | undefined;
|
|
8
8
|
}) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moreapp/common-nodejs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,23 +22,23 @@
|
|
|
22
22
|
"@google-cloud/opentelemetry-cloud-trace-exporter": "2.0.0",
|
|
23
23
|
"@opentelemetry/api": "1.4.1",
|
|
24
24
|
"@opentelemetry/instrumentation": "0.38.0",
|
|
25
|
-
"@opentelemetry/instrumentation-dns": "0.31.
|
|
26
|
-
"@opentelemetry/instrumentation-express": "0.32.
|
|
25
|
+
"@opentelemetry/instrumentation-dns": "0.31.5",
|
|
26
|
+
"@opentelemetry/instrumentation-express": "0.32.4",
|
|
27
27
|
"@opentelemetry/instrumentation-http": "0.38.0",
|
|
28
|
-
"@opentelemetry/instrumentation-winston": "0.31.
|
|
28
|
+
"@opentelemetry/instrumentation-winston": "0.31.4",
|
|
29
29
|
"@opentelemetry/sdk-node": "0.38.0",
|
|
30
30
|
"@opentelemetry/sdk-trace-node": "1.12.0",
|
|
31
31
|
"axios": "1.4.0",
|
|
32
32
|
"content-disposition-parser": "1.0.2",
|
|
33
|
-
"date-and-time": "3.0.
|
|
33
|
+
"date-and-time": "3.0.2",
|
|
34
34
|
"winston": "3.8.2",
|
|
35
35
|
"zod": "3.21.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/jest": "29.5.
|
|
39
|
-
"@types/node": "18.16.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
41
|
-
"@typescript-eslint/parser": "5.59.
|
|
38
|
+
"@types/jest": "29.5.3",
|
|
39
|
+
"@types/node": "18.16.20",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.59.11",
|
|
41
|
+
"@typescript-eslint/parser": "5.59.11",
|
|
42
42
|
"eslint": "8.40.0",
|
|
43
43
|
"eslint-config-airbnb-typescript": "17.0.0",
|
|
44
44
|
"eslint-config-prettier": "8.8.0",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"jest": "29.5.0",
|
|
49
49
|
"jest-mock-extended": "3.0.4",
|
|
50
50
|
"jest-sonar-reporter": "2.0.0",
|
|
51
|
-
"lint-staged": "13.2.
|
|
52
|
-
"nock": "13.3.
|
|
51
|
+
"lint-staged": "13.2.3",
|
|
52
|
+
"nock": "13.3.2",
|
|
53
53
|
"prettier": "2.8.8",
|
|
54
|
-
"ts-jest": "29.1.
|
|
54
|
+
"ts-jest": "29.1.1",
|
|
55
55
|
"ts-node": "10.9.1",
|
|
56
56
|
"typescript": "5.0.4"
|
|
57
57
|
},
|