@edirect/trace 10.0.0 → 11.0.26
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 +222 -206
- package/dist/README.md +381 -0
- package/dist/package.json +44 -0
- package/package.json +56 -31
- package/.editorconfig +0 -14
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -44
- package/.eslintrc.json +0 -159
- package/.prettierrc +0 -5
- package/dist/constants/headers.d.ts +0 -4
- package/dist/constants/headers.js +0 -6
- package/dist/constants/headers.js.map +0 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -9
- package/dist/constants/index.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -32
- package/dist/index.js.map +0 -1
- package/dist/middlewares/CLS.d.ts +0 -5
- package/dist/middlewares/CLS.js +0 -34
- package/dist/middlewares/CLS.js.map +0 -1
- package/dist/middlewares/body.d.ts +0 -5
- package/dist/middlewares/body.js +0 -104
- package/dist/middlewares/body.js.map +0 -1
- package/dist/middlewares/index.d.ts +0 -4
- package/dist/middlewares/index.js +0 -15
- package/dist/middlewares/index.js.map +0 -1
- package/dist/middlewares/nextjs.d.ts +0 -5
- package/dist/middlewares/nextjs.js +0 -35
- package/dist/middlewares/nextjs.js.map +0 -1
- package/dist/middlewares/trace.d.ts +0 -5
- package/dist/middlewares/trace.js +0 -27
- package/dist/middlewares/trace.js.map +0 -1
- package/dist/otel.d.ts +0 -1
- package/dist/otel.js +0 -194
- package/dist/otel.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/utils/CLS.d.ts +0 -5
- package/dist/utils/CLS.js +0 -42
- package/dist/utils/CLS.js.map +0 -1
- package/dist/utils/body-prop-tools.d.ts +0 -15
- package/dist/utils/body-prop-tools.js +0 -87
- package/dist/utils/body-prop-tools.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -13
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/json-path.d.ts +0 -9
- package/dist/utils/json-path.js +0 -33
- package/dist/utils/json-path.js.map +0 -1
- package/dist/utils/trace.d.ts +0 -5
- package/dist/utils/trace.js +0 -13
- package/dist/utils/trace.js.map +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
- package/docs/architecture.png +0 -0
- package/tsconfig.build.json +0 -9
package/README.md
CHANGED
|
@@ -7,22 +7,22 @@ Based on application logs and a sales checker service that triggers alerts on a
|
|
|
7
7
|
Due to the sheer amount of logs and complex integrations between the application microservices, it is not uncommon to find scenarios where the development team can spend hours tracing the problem back to its origin.
|
|
8
8
|
|
|
9
9
|
- Non-standard logs
|
|
10
|
-
|
|
10
|
+
- The log format and content depends on implementation and log uniformity is a challenge by itself.
|
|
11
11
|
- Logs might be outdated or absent
|
|
12
|
-
|
|
12
|
+
- As services shift, evolve and so should logs. This can be a source for inconsistencies as logs may not be updated or can be wrongly removed during the feature implementation.
|
|
13
13
|
- Logs are difficult to query and trace
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
- Even with the help of tools such Elasticsearch, querying and tracing logs can be a difficult task due to complex interactions among different services in the application.
|
|
15
|
+
- As an example, an error response from quote-engine but we only dispose of the policy number to find the root cause. The data provided is not enough for a complete investigation, which may lead to long research.
|
|
16
16
|
- Not able to trace all exception occurrences
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
- In the case shown by the previous item the error was not logged or at least not easily accessible.
|
|
18
|
+
- Sales triggers are not flexible
|
|
19
|
+
- Triggers are configured as code in the sales checker service. Any change to the logic must be implemented, tested and deployed.
|
|
20
|
+
- Sales alert do not provide insight into root causes
|
|
21
|
+
- The alert contains only the basic information necessary for an investigation to start. It contains the lead, partner, vertical and a brief description of the problem.
|
|
22
22
|
- Limited business process visibility
|
|
23
|
-
|
|
23
|
+
- As the alerts are based on sale statuses, we have limited insight into the process. With such a limited view we cannot verify which steps represent bottlenecks or are more prone to errors. Useful information for maintaining and improving the system.
|
|
24
24
|
- No concise view of the business flow
|
|
25
|
-
|
|
25
|
+
- Currently there are no dashboards or easily accessible views that can provide correlated information about the many steps that compose the Bolttech business flow.
|
|
26
26
|
|
|
27
27
|
## Detailed Design
|
|
28
28
|
|
|
@@ -41,107 +41,116 @@ Taking the requirements in consideration, the proposed solutions employs an appl
|
|
|
41
41
|
## Usage
|
|
42
42
|
|
|
43
43
|
- Tracing Apps
|
|
44
|
-
|
|
44
|
+
- Datadog
|
|
45
45
|
- Services and Observability
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
- [Service Visibility Frontend](https://bitbucket.org/gofrank/service-visibility-frontend/src/main/)
|
|
47
|
+
- [Service Visibility Backend](https://bitbucket.org/gofrank/service-visibility-backend/src/main/)
|
|
48
48
|
|
|
49
49
|
## Sample application
|
|
50
50
|
|
|
51
51
|
- [Service Visibility Samples](https://bitbucket.org/gofrank/service-visibility-samples/src/master/)
|
|
52
|
+
1. Expressjs Sample
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
https://bitbucket.org/gofrank/service-visibility-samples/src/master/samples/api/
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
2. Nest-app Sample
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
https://bitbucket.org/gofrank/service-visibility-samples/src/master/samples/quote-nestapp/
|
|
58
|
+
https://bitbucket.org/gofrank/service-visibility-samples/src/master/samples/quote-nestapp/
|
|
60
59
|
|
|
61
60
|
## NestJS Applications
|
|
62
61
|
|
|
63
|
-
NestJs applications
|
|
62
|
+
NestJs applications **should be upgraded to version 9.**
|
|
64
63
|
|
|
65
64
|
- Just the fact of upgrade the nest-app to version 9 will able the service to ship all logs to the service visibility
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
As we applied the `@edirect/trace` to the nest-app, we dont need to have the trace part of code on nest-app applications with nest-app version 9
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
In case of impossibility to upgrade, use the "Other" instructions using `@edirect/trace` directly
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
Integration Service was not able to upgrade because it uses a react-ssr that does not have compatibility with nestjs 9, so, even as a nestjs application, we implemented the "Other" way
|
|
72
71
|
|
|
73
72
|
- [@edirect/nest-app:9](https://bitbucket.org/gofrank/nest-app/src/master/)
|
|
73
|
+
1. Upgrade nest-app, all edirect dependencies and all nestjs dependencies
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
2. We should initialize our application with `otel` as a requirement for node startup command:
|
|
75
|
+
2. We should initialize our application with `otel` as a requirement for node startup command:
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
```bash
|
|
78
|
+
node --require ./node_modules/@edirect/trace/dist/otel.js dist/main
|
|
79
|
+
```
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
(dist/main or your application entrypoint)
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
3. Remove the old client initialization as we moved it to the node require
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
If the service was using old trace version
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
```js
|
|
88
|
+
const config = require('config');
|
|
89
|
+
const {
|
|
90
|
+
services: { APM },
|
|
91
|
+
middlewares: traceMiddlewares,
|
|
92
|
+
} = require('@edirect/trace');
|
|
93
|
+
const apmConfig = config.get('apm');
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
if (apmConfig.enabled) {
|
|
96
|
+
const apm = new APM(
|
|
97
|
+
apmConfig.service,
|
|
98
|
+
apmConfig.url,
|
|
99
|
+
apmConfig.traceServer,
|
|
100
|
+
);
|
|
101
|
+
apm.startTrace();
|
|
102
|
+
}
|
|
103
|
+
```
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
4. Remove the middleware usage
|
|
101
106
|
|
|
102
|
-
|
|
107
|
+
If the service was using old trace version
|
|
103
108
|
|
|
104
|
-
|
|
109
|
+
Remove it completely as we moved it to inside of `@edirect/trace`:
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
```js
|
|
112
|
+
if (apmConfig.enabled) {
|
|
113
|
+
app.use(new traceMiddlewares.Body().body);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
111
116
|
|
|
112
117
|
## NextJS Applications
|
|
113
|
-
NextJS applications __should be upgraded to version 12 or above__.
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
NextJS applications **should be upgraded to version 12 or above**.
|
|
120
|
+
|
|
121
|
+
1. Install the trace package:
|
|
122
|
+
|
|
116
123
|
```bash
|
|
117
124
|
npm install --save @edirect/trace
|
|
118
125
|
```
|
|
119
126
|
|
|
120
|
-
2.
|
|
127
|
+
2. Create a middleware
|
|
128
|
+
- When you upgrade the NextJS application to the version 12(or above) you will be able
|
|
129
|
+
to use [Middlewares](https://nextjs.org/docs/advanced-features/middleware).
|
|
121
130
|
|
|
122
|
-
|
|
123
|
-
to use [Middlewares](https://nextjs.org/docs/advanced-features/middleware).
|
|
124
|
-
|
|
125
|
-
Create a file called as `middleware.ts(or .js)` inside of the `src` folder.
|
|
131
|
+
Create a file called as `middleware.ts(or .js)` inside of the `src` folder.
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
```ts
|
|
134
|
+
import { NextResponse } from 'next/server';
|
|
135
|
+
import type { NextRequest } from 'next/server';
|
|
136
|
+
import NextJsTracer from '@edirect/trace/dist/middlewares/nextjs';
|
|
131
137
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
// This function can be marked `async` if using `await` inside
|
|
139
|
+
export function middleware(request: NextRequest) {
|
|
140
|
+
// @edirect/trace
|
|
141
|
+
new NextJsTracer().body(req as unknown as Request & Record<string, unknown>);
|
|
142
|
+
NextResponse.next();
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
3. Install dotenv and create a dotenv.config
|
|
139
147
|
|
|
140
|
-
3. Install dotenv and create a dotenv.config
|
|
141
148
|
```bash
|
|
142
149
|
npm install --save dotenv
|
|
143
150
|
```
|
|
151
|
+
|
|
144
152
|
`dotenv.config.js`
|
|
153
|
+
|
|
145
154
|
```js
|
|
146
155
|
const dotenv = require('dotenv');
|
|
147
156
|
const nodeEnv = process.env.NODE_ENV || 'development';
|
|
@@ -149,8 +158,9 @@ NextJS applications __should be upgraded to version 12 or above__.
|
|
|
149
158
|
dotenv.config({ path: `.${nodeEnv}.env` });
|
|
150
159
|
```
|
|
151
160
|
|
|
152
|
-
4.
|
|
153
|
-
|
|
161
|
+
4. Add the environment variables to your NextJS app:
|
|
162
|
+
**Example:**`.development.env`
|
|
163
|
+
|
|
154
164
|
```yml
|
|
155
165
|
## OPEN TELEMETRY
|
|
156
166
|
TRACE_TAG_OWNER=OWNER
|
|
@@ -164,101 +174,107 @@ NextJS applications __should be upgraded to version 12 or above__.
|
|
|
164
174
|
TRACE_TAG_ENV=ie-stag-broker
|
|
165
175
|
```
|
|
166
176
|
|
|
167
|
-
5.
|
|
177
|
+
5. Serve your production build on the standalone mode. Add this line to your `next.config.js` file
|
|
178
|
+
|
|
168
179
|
```js
|
|
169
180
|
module.exports = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
181
|
+
// ...myOtherSettings
|
|
182
|
+
output: 'standalone',
|
|
183
|
+
};
|
|
173
184
|
```
|
|
174
185
|
|
|
175
|
-
6.
|
|
186
|
+
6. Change the **start** and **dev** command:
|
|
176
187
|
```json
|
|
177
188
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
"scripts": {
|
|
190
|
+
"dev": "cross-env NODE_ENV=development node --require ./dotenv.config.js --require ./node_modules/@edirect/trace/dist/otel.js ./node_modules/next/dist/bin/next -p 3100",
|
|
191
|
+
"start": "cross-env NODE_ENV=production node --require ./dotenv.config.js --require ./node_modules/@edirect/trace/dist/otel.js ./build/client/standalone/server.js -p 3100"
|
|
192
|
+
}
|
|
182
193
|
}
|
|
183
194
|
```
|
|
184
195
|
|
|
185
|
-
|
|
186
196
|
## Other (Not nest-app:9)
|
|
187
197
|
|
|
188
198
|
### If you are unable to update to nest 9 or is not nest (express)
|
|
189
199
|
|
|
190
200
|
- [@edirect/trace](https://bitbucket.org/gofrank/trace/src/master/)
|
|
191
201
|
|
|
192
|
-
|
|
202
|
+
The usage of `@edirect/trace` will need your care to inject our middleware to log all requests from the app
|
|
203
|
+
1. Install the trace package
|
|
193
204
|
|
|
194
|
-
|
|
205
|
+
```bash
|
|
206
|
+
npm install --save @edirect/trace
|
|
207
|
+
```
|
|
195
208
|
|
|
196
|
-
|
|
197
|
-
npm install --save @edirect/trace
|
|
198
|
-
```
|
|
209
|
+
2. Import the trace package
|
|
199
210
|
|
|
200
|
-
|
|
211
|
+
```js
|
|
212
|
+
import { middlewares as traceMiddlewares } from '@edirect/trace';
|
|
213
|
+
```
|
|
201
214
|
|
|
202
|
-
|
|
203
|
-
import { middlewares as traceMiddlewares } from '@edirect/trace';
|
|
204
|
-
```
|
|
215
|
+
3. Add the trace middleware to your application routes
|
|
205
216
|
|
|
206
|
-
|
|
217
|
+
Express:
|
|
207
218
|
|
|
208
|
-
|
|
219
|
+
```js
|
|
220
|
+
app.use(new traceMiddlewares.Body().body);
|
|
221
|
+
```
|
|
209
222
|
|
|
210
|
-
|
|
211
|
-
app.use(new traceMiddlewares.Body().body);
|
|
212
|
-
```
|
|
223
|
+
NestJs with nest-app:
|
|
213
224
|
|
|
214
|
-
|
|
225
|
+
```js
|
|
226
|
+
consumer
|
|
227
|
+
.apply(new traceMiddlewares.Body().body)
|
|
228
|
+
.forRoutes({ path: '/**', method: RequestMethod.ALL });
|
|
229
|
+
```
|
|
215
230
|
|
|
216
|
-
|
|
217
|
-
consumer
|
|
218
|
-
.apply(new traceMiddlewares.Body().body)
|
|
219
|
-
.forRoutes({path: '/**', method: RequestMethod.ALL});
|
|
220
|
-
```
|
|
231
|
+
4. We should initialize our application with `otel` as a requirement for node startup command:
|
|
221
232
|
|
|
222
|
-
|
|
233
|
+
```bash
|
|
234
|
+
node --require ./node_modules/@edirect/trace/dist/otel.js dist/main
|
|
235
|
+
```
|
|
223
236
|
|
|
224
|
-
|
|
225
|
-
node --require ./node_modules/@edirect/trace/dist/otel.js dist/main
|
|
226
|
-
```
|
|
237
|
+
(dist/main or your application entrypoint)
|
|
227
238
|
|
|
228
|
-
|
|
239
|
+
5. Remove the old client initialization as we moved it to the node require
|
|
229
240
|
|
|
230
|
-
|
|
241
|
+
If the service was using old trace version
|
|
231
242
|
|
|
232
|
-
|
|
243
|
+
```js
|
|
244
|
+
const config = require('config');
|
|
245
|
+
const {
|
|
246
|
+
services: { APM },
|
|
247
|
+
middlewares: traceMiddlewares,
|
|
248
|
+
} = require('@edirect/trace');
|
|
249
|
+
const apmConfig = config.get('apm');
|
|
233
250
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
251
|
+
if (apmConfig.enabled) {
|
|
252
|
+
const apm = new APM(
|
|
253
|
+
apmConfig.service,
|
|
254
|
+
apmConfig.url,
|
|
255
|
+
apmConfig.traceServer,
|
|
256
|
+
);
|
|
257
|
+
apm.startTrace();
|
|
258
|
+
}
|
|
259
|
+
```
|
|
238
260
|
|
|
239
|
-
|
|
240
|
-
const apm = new APM(apmConfig.service, apmConfig.url, apmConfig.traceServer);
|
|
241
|
-
apm.startTrace();
|
|
242
|
-
}
|
|
243
|
-
```
|
|
261
|
+
6. Clean the middleware usage
|
|
244
262
|
|
|
245
|
-
|
|
263
|
+
If the service was using old trace version
|
|
246
264
|
|
|
247
|
-
|
|
265
|
+
Replace:
|
|
248
266
|
|
|
249
|
-
|
|
267
|
+
```js
|
|
268
|
+
if (apmConfig.enabled) {
|
|
269
|
+
app.use(new traceMiddlewares.Body().body);
|
|
270
|
+
}
|
|
271
|
+
```
|
|
250
272
|
|
|
251
|
-
|
|
252
|
-
if (apmConfig.enabled) {
|
|
253
|
-
app.use(new traceMiddlewares.Body().body);
|
|
254
|
-
}
|
|
255
|
-
```
|
|
273
|
+
with:
|
|
256
274
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
app.use(new traceMiddlewares.Body().body);
|
|
261
|
-
```
|
|
275
|
+
```js
|
|
276
|
+
app.use(new traceMiddlewares.Body().body);
|
|
277
|
+
```
|
|
262
278
|
|
|
263
279
|
## Applying k8s configurations (Required)
|
|
264
280
|
|
|
@@ -267,99 +283,99 @@ We created a standard way to deploy our application configurations and simplify
|
|
|
267
283
|
- Sometimes it could be already done by another team and you don't need to manage the configuration, just generate the configurations and apply it
|
|
268
284
|
- `bolttech-broker-asia\staging\config-map.yaml` (or your environment config-map)
|
|
269
285
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
286
|
+
```yaml
|
|
287
|
+
auth: #or your service
|
|
288
|
+
trace:
|
|
289
|
+
tags:
|
|
290
|
+
scope: ie #your tech center
|
|
291
|
+
env: ie-stag-broker #current k8s cluster environment
|
|
292
|
+
cluster: stag-ie #current k8s cluster
|
|
293
|
+
tenant: ${namespace}
|
|
294
|
+
service: ${name}-${namespace}
|
|
295
|
+
servicename: ${name}
|
|
296
|
+
version: '1.0.0'
|
|
297
|
+
owner: OWNER
|
|
298
|
+
server: opentelemetry-collector.stag.bolttechbroker.net #cluster opentelemetry server
|
|
299
|
+
```
|
|
284
300
|
|
|
285
301
|
Then you should generate and apply your brand new configurations:
|
|
286
302
|
|
|
287
303
|
1. Generate
|
|
288
304
|
|
|
289
|
-
|
|
305
|
+
This command will generate the new configuration files for the services.
|
|
290
306
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
```bash
|
|
308
|
+
# Staging Clusters
|
|
309
|
+
edi infra bolttech-broker-asia k8s generate <ENVIRONMENT> <SERVICE>
|
|
310
|
+
edi infra bolttech-broker-asia k8s generate stage1-vnbroker rules-engine # VN Example
|
|
295
311
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
312
|
+
# Production Clusters
|
|
313
|
+
edi infra <PRODUCTION_BROKER> k8s generate <ENVIRONMENT> <SERVICE>
|
|
314
|
+
edi infra bolttech-broker-asia-hk k8s generate live-hkbroker-a policy-issuing-service --prod # HK Example
|
|
315
|
+
```
|
|
300
316
|
|
|
301
317
|
2. Apply
|
|
302
318
|
|
|
303
|
-
|
|
319
|
+
This command will apply the new configurations and **redeploy** the service on the cluster.
|
|
304
320
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
321
|
+
```bash
|
|
322
|
+
# Staging Clusters
|
|
323
|
+
edi infra bolttech-broker-asia k8s apply staging <STAGE/RC> <SERVICE> --redeploy
|
|
324
|
+
edi infra bolttech-broker-asia k8s apply staging rc-vnbroker frontend-service --redeploy # VN Example
|
|
309
325
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
326
|
+
# Production Clusters
|
|
327
|
+
edi infra <PRODUCTION_BROKER> k8s apply <CLUSTER> <ENVIRONMENT> <SERVICE>
|
|
328
|
+
edi infra bolttech-broker-asia-hk k8s apply cluster-a live-hkbroker-a plan-service --prod --redeploy # HK Example
|
|
329
|
+
```
|
|
314
330
|
|
|
315
331
|
- Key notes when using the infrastructure repositories:
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
332
|
+
- Before running any command make sure you have completed the setup of the `edi-cli` tool and that you have all the related projects (`infrastructure` and `k8s-templates`) inside the same root folder.
|
|
333
|
+
- Make sure to have the most recent version of the `master` branch before running any commands.
|
|
334
|
+
- Remember to **ALWAYS COMMIT AND PUSH YOUR CHANGES TO THE REPOSITORIES, OTHERWISE THE NEW CONFIGURATIONS WILL NOT BE APPLIED TO SERVICES WHEN THEY ARE DEPLOYED USING THE JENKINS PIPELINES**.
|
|
335
|
+
- To make things easier, make sure to check the helper script on `edi-cli` project. Located at the `edi-cli-cli` folder.
|
|
336
|
+
- Consider hiding the folders of the brokers you will not need to work with. This will greatly improve your navigation inside the project.
|
|
321
337
|
|
|
322
338
|
## Debugging
|
|
323
339
|
|
|
324
340
|
- How to debug it on vscode:
|
|
325
341
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
342
|
+
As we don't debug using node command directly, we suggest you to use this in your `.vscode/launch.json`
|
|
343
|
+
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"version": "0.2.0",
|
|
347
|
+
"configurations": [
|
|
348
|
+
{
|
|
349
|
+
"type": "node",
|
|
350
|
+
"request": "launch",
|
|
351
|
+
"name": "Debug with OTEL",
|
|
352
|
+
"args": ["${workspaceFolder}/src/main.ts"],
|
|
353
|
+
"runtimeArgs": [
|
|
354
|
+
"--inspect",
|
|
355
|
+
"-r",
|
|
356
|
+
"./node_modules/@edirect/trace/dist/otel.js",
|
|
357
|
+
"-r",
|
|
358
|
+
"tsconfig-paths/register",
|
|
359
|
+
"-r",
|
|
360
|
+
"ts-node/register"
|
|
361
|
+
],
|
|
362
|
+
"console": "integratedTerminal",
|
|
363
|
+
"envFile": "${workspaceFolder}/.development.env"
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
and append the OTEL environment variables to your local environments file:
|
|
370
|
+
|
|
371
|
+
```conf
|
|
372
|
+
TRACE_TAG_OWNER=OWNER
|
|
373
|
+
TRACE_TAG_SCOPE=pgw
|
|
374
|
+
TRACE_TAG_SERVICENAME=payment-gateway
|
|
375
|
+
TRACE_TAG_TENANT=local-paythbroker
|
|
376
|
+
TRACE_SERVER_URL=opentelemetry-collector.stag.bolttechpay.net
|
|
377
|
+
TRACE_TAG_SERVICE=payment-gateway-local-paythbroker
|
|
378
|
+
TRACE_TAG_VERSION=1.0.0
|
|
379
|
+
TRACE_TAG_CLUSTER=localhost
|
|
380
|
+
TRACE_TAG_ENV=development
|
|
381
|
+
```
|