@ogcio/o11y-sdk-node 0.1.0-beta.1 → 0.1.0-beta.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 +7 -0
- package/README.md +77 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.0-beta.2](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-node@0.1.0-beta.1...@ogcio/o11y-sdk-node@0.1.0-beta.2) (2024-11-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Add readme file inside submodule ([#27](https://github.com/ogcio/o11y/issues/27)) ([dc518d5](https://github.com/ogcio/o11y/commit/dc518d5dde573368443bc0f8619e80e331880c78))
|
|
9
|
+
|
|
3
10
|
## [0.1.0-beta.1](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-node@0.0.1-beta.1...@ogcio/o11y-sdk-node@0.1.0-beta.1) (2024-11-27)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Observability NodeJS SDK
|
|
2
|
+
|
|
3
|
+
The NodeJS observability sdk is a npm package used to setup and implement opentelemetry instrumentation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
pnpm
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm i --save @ogcio/o11y-sdk-node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
npm
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i @ogcio/o11y-sdk-node
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Setup using constructor function
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// instrumentation.ts
|
|
25
|
+
|
|
26
|
+
import("@ogcio/o11y-sdk-node/lib/index").then((sdk) =>
|
|
27
|
+
sdk.instrumentNode({
|
|
28
|
+
serviceName: "node-microservice",
|
|
29
|
+
collectorUrl: "http://localhost:4317",
|
|
30
|
+
collectorMode: "single",
|
|
31
|
+
enableFS: true,
|
|
32
|
+
diagLogLevel: "DEBUG",
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Run your node script with instrumentation
|
|
38
|
+
|
|
39
|
+
`node --import instrumentation.js server.js`
|
|
40
|
+
|
|
41
|
+
Or setup inside your package.json
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"main": "dist/index.js",
|
|
46
|
+
"type": "module",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"start": "node --env-file=.env --import ./dist/instrumentation.js dist/index.js",
|
|
49
|
+
},
|
|
50
|
+
....
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API Reference
|
|
55
|
+
|
|
56
|
+
### Shared Types
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
export type SDKLogLevel =
|
|
60
|
+
| "NONE"
|
|
61
|
+
| "ERROR"
|
|
62
|
+
| "WARN"
|
|
63
|
+
| "INFO"
|
|
64
|
+
| "DEBUG"
|
|
65
|
+
| "VERBOSE"
|
|
66
|
+
| "ALL";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Config
|
|
70
|
+
|
|
71
|
+
| Parameter | Type | Description |
|
|
72
|
+
| :-------------- | :---------------- | :------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| `collectorUrl` | `string` | **Required**. The opentelemetry collector entrypoint url, if null, instrumentation will not be activated |
|
|
74
|
+
| `serviceName` | `string` | Name of your application used for the collector to group logs |
|
|
75
|
+
| `diagLogLevel` | `SDKLogLevel` | Diagnostic log level for the internal runtime instrumentation |
|
|
76
|
+
| `collectorMode` | `single \| batch` | Signals sending mode, default is batch for performance |
|
|
77
|
+
| `enableFS` | `boolean` | Flag to enable or disable the tracing for node:fs module |
|