vtb-appit 0.1.11 → 0.1.13

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/appit.js +17 -7
  2. package/package.json +1 -1
package/appit.js CHANGED
@@ -89,10 +89,13 @@ class Appit {
89
89
 
90
90
  async exec()
91
91
  {
92
- this.log('info', 'Starting sync process');
93
- const errors = [];
92
+ return await tracer.startActiveSpan('appit-sync', async (parentSpan) => {
93
+ try {
94
+ this.log('info', 'Starting sync process');
95
+ parentSpan.addEvent('Sync process started');
96
+ const errors = [];
94
97
 
95
- await tracer.startActiveSpan('appit-login', async (span) => {
98
+ await tracer.startActiveSpan('appit-login', async (span) => {
96
99
  try {
97
100
  span.addEvent('Start login');
98
101
 
@@ -131,10 +134,7 @@ class Appit {
131
134
  }
132
135
  });
133
136
 
134
-
135
- try {
136
-
137
- if(this.options && this.options.tsData) {
137
+ if(this.options && this.options.tsData) {
138
138
  try {
139
139
  this.transformer.tsData = await this.transformer.tsGetData();
140
140
  this.log('info', 'TS data loaded successfully');
@@ -194,9 +194,14 @@ class Appit {
194
194
 
195
195
  if(errors.length === 0) {
196
196
  this.log('info', 'Sync completed successfully');
197
+ parentSpan.addEvent('Sync completed successfully');
198
+ parentSpan.setStatus({ code: SpanStatusCode.OK });
197
199
  return true;
198
200
  } else {
199
201
  this.log('warn', `Sync completed with ${errors.length} errors`, errors);
202
+ parentSpan.addEvent(`Sync completed with ${errors.length} errors`);
203
+ parentSpan.setAttributes({ 'sync.errors.count': errors.length });
204
+ parentSpan.setStatus({ code: SpanStatusCode.OK });
200
205
  return true; // Still return true as we completed what we could
201
206
  }
202
207
 
@@ -206,8 +211,13 @@ class Appit {
206
211
  this.history.criticalError = error.message;
207
212
  this.history.updatedAt = new Date().getTime();
208
213
  this.saveHistoryIncremental();
214
+ parentSpan.recordException(error);
215
+ parentSpan.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
209
216
  return false;
217
+ } finally {
218
+ parentSpan.end();
210
219
  }
220
+ });
211
221
  }
212
222
 
213
223
  async labels()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {},