add log for endpoints

This commit is contained in:
Peter Maquiran
2024-06-17 17:04:42 +01:00
parent 58eee3ff93
commit 157ecdd10b
10 changed files with 123 additions and 42 deletions
@@ -17,6 +17,8 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
@Component({
selector: 'app-approve-event',
@@ -95,19 +97,30 @@ export class ApproveEventPage implements OnInit {
}
async getTask() {
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true})
async getTask(tracing?: TracingType) {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
console.log(res)
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber, tracing)
if (res.isOk()) {
this.loadedEvent = res.value;
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
//
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
this.loadedAttachments = res.value.Attachments
} else {
console.log(res.error.status)
tracing.setAttribute('outcome', 'success')
} else if(isHttpError(res.error)) {
tracing.setAttribute('outcome', 'failed')
tracing.bugFlag()
this.httpErrorHandle.httpStatusHandle(res.error)
} else if(!isHttpError(res.error)) {
tracing.setAttribute('outcome', 'failed')
tracing.bugFlag()
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #12')
}
}