improve monitoring the solution

This commit is contained in:
Peter Maquiran
2024-07-30 15:52:07 +01:00
parent 8f0625eed4
commit edcaf951c2
11 changed files with 167 additions and 27 deletions
+44 -6
View File
@@ -144,7 +144,7 @@ export class ProfilePage implements OnInit {
return time;
}
@XTracerAsync({name:'profile/notificationClick', bugPrint: true, module:'notification'})
@XTracerAsync({name:'profile/notificationClick', bugPrint: true, module:'notification', autoFinish: false})
async notificatinsRoutes (index, item: NotificationTable, tracing?: TracingType) {
try {
@@ -152,7 +152,9 @@ export class ProfilePage implements OnInit {
this.isloading = true
if (item.service === "agenda") {
tracing.addEvent('start getEventById')
let res = await this.agendaDataRepository.getEventById(item.idObject, tracing)
tracing.addEvent('end getEventById')
if(item.idObject) {
@@ -168,9 +170,9 @@ export class ProfilePage implements OnInit {
this.deleteNotification(item);
tracing.setAttribute('outcome', 'success')
} else {
tracing.setAttribute('outcome', 'success')
tracing.setAttribute('data.exist', 'false')
tracing.setAttribute('data.exist', 'false')
tracing.setAttribute('outcome', 'success')
if (isHttpError(res.error)) {
if(res.error.status == 404) {
@@ -202,9 +204,10 @@ export class ProfilePage implements OnInit {
this.deleteNotification(item);
this.isloading = false
} else {
tracing.setAttribute('outcome', 'success')
console.log('evento não existe')
tracing.setAttribute('data.exist', 'false')
tracing.setAttribute('outcome', 'success')
this.objectRead[item.notificationId] = true
this.isloading = false
}
@@ -223,8 +226,11 @@ export class ProfilePage implements OnInit {
} else if (item.service === "gabinete-digital") {
this.isloading = true
tracing.addEvent('start getTask')
this.processesService.GetTask(item.idObject).subscribe((task) => {
tracing.addEvent('end getTask')
if (item.service === "gabinete-digital" && item.object === "expedientes") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', item.idObject, 'gabinete-digital']));
} else if (item.service === "gabinete-digital" && item.object === "despachos") {
@@ -258,9 +264,29 @@ export class ProfilePage implements OnInit {
this.deleteNotification(item);
this.isloading = false
tracing.setAttribute('outcome', 'success')
}, (error) => {
tracing.addEvent('end getTask')
tracing.log('gabinete notification not found', {
notificationObject: item
})
this.objectRead[item.notificationId] = true
this.isloading = false
if(isHttpError(error)) {
tracing.setAttribute('getTask.http.status.code', error.status?.toString())
if(error.status == 400) {
tracing.setAttribute('outcome', 'failed')
} else {
tracing.setAttribute('outcome', 'success')
}
} else {
tracing.setAttribute('outcome', 'failed')
}
})
@@ -268,10 +294,14 @@ export class ProfilePage implements OnInit {
if (item.service === "accoes" && item.idObject === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', item.idObject]));
this.deleteNotification(item);
tracing.setAttribute('outcome', 'success')
}
else if (item.service === "accoes" && item.idObject === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', item.folderId, item.idObject]));
this.deleteNotification(item);
tracing.setAttribute('outcome', 'success')
}
} else if (item.service === "chat") {
@@ -285,22 +315,30 @@ export class ProfilePage implements OnInit {
}, 200);
tracing.setAttribute('outcome', 'success')
this.deleteNotification(item);
} else {
console.log({service:item.service, Object, IdObject:item.idObject, FolderId:item.folderId})
tracing.log('click notification no route', {
notificationObject: item
})
tracing.setAttribute('notification.route', 'false')
tracing.setAttribute('outcome', 'failed')
tracing.setAttribute('parameters', JSON.stringify({Service:item.service, Object, IdObject:item.idObject, FolderId:item.folderId}))
tracing.setAttribute('outcome', 'failed')
}
} catch(error) {
console.log({service:item.service, Object, IdObject:item.idObject, FolderId: item.folderId})
tracing.setAttribute('outcome', 'failed')
tracing.log('click notification catch', {
notificationObject: item
})
tracing.setAttribute('parameters', JSON.stringify({service:item.service, Object, IdObject:item.idObject, FolderId:item.folderId}))
tracing.setAttribute('error', JSON.stringify(error))
tracing.setAttribute('outcome', 'failed')
}