@arnob-b/observability 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +26 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @arnob-b/observability
10
10
  ## initializing observability
11
11
  ```javascript
12
12
  const { Observability } = require("@arnob-b/observability");
13
- Observability.initialize(OBSERVABILITY_CONFIG);
13
+ Observability.init(OBSERVABILITY_CONFIG);
14
14
  ```
15
15
 
16
16
  ### Sample configuration
@@ -105,6 +105,31 @@ attachHooksOnTransport("file-rotation-transport", {
105
105
  })
106
106
  ```
107
107
 
108
+ ## using tracers
109
+ ```javascript
110
+ const {startTracedExecution, traceExecution, traceAsyncExecution} = require("@arnob-b/observability");
111
+
112
+ startTracedExecution("main_execution", async () => {
113
+ logger.debug("Starting main execution block");
114
+ startTracedExecution("nested_execution", async () => {
115
+ logger.debug("Starting main execution block");
116
+ })
117
+ });
118
+
119
+ const asyncFunc = traceAsyncExecution("async_execution", async () => {
120
+ logger.debug("Starting async execution block");
121
+ await new Promise(resolve => setTimeout(resolve, 1000));
122
+ logger.debug("Finished async execution block");
123
+ });
124
+ const nonAsyncFunc = traceExecution("async_execution", async () => {
125
+ logger.debug("Starting execution block");
126
+ logger.debug("Finished execution block");
127
+ });
128
+
129
+ asyncFunc();
130
+ nonAsyncFunc();
131
+ ```
132
+
108
133
 
109
134
  # architechture
110
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arnob-b/observability",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "observability for nodejs application using winston and opentelemetry",
5
5
  "keywords": ["observability", "nodejs", "winston", "opentelemetry", "electron", "desktop application"],
6
6
  "license": "MIT",