whatap 0.4.70 → 0.4.72

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.
@@ -162,6 +162,11 @@ var ConfigDefault = {
162
162
  "trace_ignore_url_prefix": str('trace_ignore_url_prefix',''),
163
163
  "_is_trace_ignore_url_prefix": false,
164
164
 
165
+ "trace_ignore_err_cls_contains": str('trace_ignore_err_cls_contains',''),
166
+ "_is_trace_ignore_err_cls_contains": false,
167
+ "trace_ignore_err_msg_contains": str('trace_ignore_err_msg_contains',''),
168
+ "_is_trace_ignore_err_msg_contains": false,
169
+
165
170
  "trace_origin_url": bool('trace_origin_url',false),
166
171
  //2019.12.12 Kubernetes
167
172
  "whatap_kubernetes_enabled": bool('whatap_kubernetes_enabled',false),
@@ -395,6 +395,23 @@ conf.on('trace_ignore_url_prefix', function(props){
395
395
  }
396
396
  });
397
397
 
398
+ conf.on('trace_ignore_err_cls_contains', function(props){
399
+ if(props && props.constructor === String && props.length > 0 ){
400
+ conf._is_trace_ignore_err_cls_contains = true;
401
+ }else{
402
+ conf._is_trace_ignore_err_cls_contains = false;
403
+ }
404
+ });
405
+
406
+ conf.on('trace_ignore_err_msg_contains', function(props){
407
+ if(props && props.constructor === String && props.length > 0 ){
408
+ conf._is_trace_ignore_err_msg_contains = true;
409
+ }else{
410
+ conf._is_trace_ignore_err_msg_contains = false;
411
+ }
412
+ });
413
+
414
+
398
415
  conf.on('mtrace_spec', function(props){
399
416
  if (!props || props.length == 0) {
400
417
  conf.mtrace_spec_hash = 0;
@@ -154,7 +154,9 @@ var SecurityMaster = {
154
154
  if(cb) cb();
155
155
  }else{
156
156
  conf.setProperty('node.clusterId', cluster.worker.id);
157
+ if(cb) cb();
157
158
  //console.log('현재 프로젝트는 ' + cluster.worker.id + ' 입니다!!!!');
159
+ /*
158
160
  ProcessSeq('whatap').accessAuth(function(pseq){
159
161
  if(!pseq){
160
162
  return;
@@ -163,6 +165,7 @@ var SecurityMaster = {
163
165
  conf.setProperty('node.clusterId', pseq);
164
166
  if(cb) cb();
165
167
  });
168
+ */
166
169
  }
167
170
 
168
171
  }
@@ -42,7 +42,7 @@ TcpSession.prototype.open = function(cb){
42
42
  }
43
43
  if(this.isOpen()) {
44
44
  ++self.reconnectCnt;
45
- if(self.reconnectCnt === 3) {
45
+ if(self.reconnectCnt >= 3) {
46
46
  self.close();
47
47
  }
48
48
  return cb(new Error('Already connected..'));
@@ -152,6 +152,7 @@ TcpSession.prototype.close = function(){
152
152
  if(this.out){
153
153
  this.out.destroy();
154
154
  this.out = null;
155
+ this.reconnectCnt = 0;
155
156
  }
156
157
  }
157
158
 
@@ -101,14 +101,16 @@ var queryHook = function (dbc_hash, agent) {
101
101
 
102
102
  if(args[0]) {
103
103
  try{
104
- sql_step.error = StatError.addError(
105
- ('Maria-'+args[0].code ),
106
- (args[0].message || 'Maria error'),
107
- ctx.service_hash,
108
- TextTypes.SQL, sql_step.hash);
109
- if(ctx.error.isZero()) {
110
- ctx.error = sql_step.error;
111
- }
104
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
105
+ sql_step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
106
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
107
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
108
+ sql_step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
109
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
110
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
111
+ sql_step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
112
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
113
+ }
112
114
  }catch(e) {
113
115
 
114
116
  }
@@ -178,10 +180,19 @@ var errorDelegate = function () {
178
180
  if(args[0].fatal) {
179
181
  // Connection Error
180
182
  step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message, ctx.service_hash); /*long*/
183
+ if (ctx.error.isZero()) { ctx.error = step.error; }
181
184
  } else {
182
- step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
185
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
186
+ step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
187
+ if (ctx.error.isZero()) { ctx.error = step.error; }
188
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
189
+ step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
190
+ if (ctx.error.isZero()) { ctx.error = step.error; }
191
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
192
+ step.error = StatError.addError( 'Maria-'+args[0].code, args[0].message || 'Maria error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
193
+ if (ctx.error.isZero()) { ctx.error = step.error; }
194
+ }
183
195
  }
184
- if (ctx.error.isZero()) { ctx.error = step.error; }
185
196
  } catch(e) {
186
197
  }
187
198
  }
@@ -85,15 +85,15 @@ MssqlObserver.prototype.inject = function (mod, modName) {
85
85
  self.aop.functionHook(args, -1, function (obj, args) {
86
86
  TraceContextManager.resume(ctx);
87
87
  if(args[0] != null) {
88
- //Error occur
89
- var err = StatError.addError('mssql',
90
- args[0].message || 'mssql error',
91
- ctx.service_hash,
92
- TextTypes.SQL,
93
- sql_step.hash);
94
- sql_step.error = err;
95
- if(ctx.error.isZero()) {
96
- ctx.error = err;
88
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
89
+ sql_step.error = StatError.addError( 'mssql-'+args[0].code, args[0].message|| 'mssql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
90
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
91
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
92
+ sql_step.error = StatError.addError( 'mssql-'+args[0].code, args[0].message|| 'mssql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
93
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
94
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
95
+ sql_step.error = StatError.addError( 'mssql-'+args[0].code, args[0].message|| 'mssql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
96
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
97
97
  }
98
98
  }
99
99
 
@@ -101,6 +101,17 @@ var queryHook = function (dbc_hash, agent) {
101
101
 
102
102
  if(args[0]) {
103
103
  try{
104
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0 ){
105
+ sql_step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message || 'mysql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
106
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
107
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0 ){
108
+ sql_step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message || 'mysql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
109
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
110
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
111
+ sql_step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message || 'mysql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
112
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
113
+ }
114
+ /*
104
115
  sql_step.error = StatError.addError(
105
116
  ('mysql-'+args[0].code ),
106
117
  (args[0].message || 'mysql error'),
@@ -109,6 +120,7 @@ var queryHook = function (dbc_hash, agent) {
109
120
  if(ctx.error.isZero()) {
110
121
  ctx.error = sql_step.error;
111
122
  }
123
+ */
112
124
  }catch(e) {
113
125
 
114
126
  }
@@ -176,12 +188,20 @@ var errorDelegate = function () {
176
188
 
177
189
  try{
178
190
  if(args[0].fatal) {
179
- // Connection Error
180
191
  step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message, ctx.service_hash); /*long*/
192
+ if (ctx.error.isZero()) { ctx.error = step.error; }
181
193
  } else {
182
- step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
194
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
195
+ step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
196
+ if (ctx.error.isZero()) { ctx.error = step.error; }
197
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
198
+ step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
199
+ if (ctx.error.isZero()) { ctx.error = step.error; }
200
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
201
+ step.error = StatError.addError( 'mysql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
202
+ if (ctx.error.isZero()) { ctx.error = step.error; }
203
+ }
183
204
  }
184
- if (ctx.error.isZero()) { ctx.error = step.error; }
185
205
  } catch(e) {
186
206
  }
187
207
  }
@@ -102,13 +102,15 @@ var queryHook = function (dbc_local, agent) {
102
102
 
103
103
  if (args[0]) {
104
104
  try {
105
- sql_step.error = StatError.addError(
106
- ("pgsql-"+args[0].code ),
107
- (args[0].message || 'pgsql error'),
108
- ctx.service_hash,
109
- TextTypes.SQL, sql_step.hash);
110
- if (ctx.error.isZero()) {
111
- ctx.error = sql_step.error;
105
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
106
+ sql_step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message|| 'pgsql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
107
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
108
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
109
+ sql_step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message|| 'pgsql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
110
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
111
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
112
+ sql_step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message|| 'pgsql error', ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
113
+ if (ctx.error.isZero()) { ctx.error = sql_step.error; }
112
114
  }
113
115
  } catch (e) {
114
116
  }
@@ -169,11 +171,18 @@ var errorDelegate = function () {
169
171
  if(args[0].fatal) {
170
172
  // Connection Error
171
173
  step.error = StatError.addError("pgsql-"+args[0].code, args[0].message, ctx.service_hash); /*long*/
174
+ if (ctx.error.isZero()) { ctx.error = step.error; }
172
175
  } else {
173
- step.error = StatError.addError("pgsql-"+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
174
- }
175
- if (ctx.error.isZero()) {
176
- ctx.error = step.error;
176
+ if(conf._is_trace_ignore_err_cls_contains === true && args[0].code.indexOf(conf.trace_ignore_err_cls_contains) < 0){
177
+ step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
178
+ if (ctx.error.isZero()) { ctx.error = step.error; }
179
+ } else if(conf._is_trace_ignore_err_msg_contains === true && args[0].message.indexOf(conf.trace_ignore_err_msg_contains) < 0){
180
+ step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
181
+ if (ctx.error.isZero()) { ctx.error = step.error; }
182
+ } else if(conf._is_trace_ignore_err_cls_contains === false && conf._is_trace_ignore_err_msg_contains === false) {
183
+ step.error = StatError.addError( 'pgsql-'+args[0].code, args[0].message, ctx.service_hash, TextTypes.SQL, step.hash); /*long*/
184
+ if (ctx.error.isZero()) { ctx.error = step.error; }
185
+ }
177
186
  }
178
187
  } catch(e) {
179
188
  Logger.printError('WHATAP-997', 'pgsql-observer (errorDelegate)', e, true);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "whatap",
3
3
  "homepage": "http://www.whatap.io",
4
- "version": "0.4.70",
5
- "releaseDate": "20230328",
4
+ "version": "0.4.72",
5
+ "releaseDate": "20230417",
6
6
  "description": "Monitoring and Profiling Service",
7
7
  "main": "index.js",
8
8
  "scripts": {},