mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add open telemetry
This commit is contained in:
@@ -12,6 +12,8 @@ import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { EventToApproveDetailsMapper } from './mapper/EventToApproveDetailsMapper';
|
||||
import { AgendaLocalDataSourceService } from './agenda-local-data-source.service';
|
||||
import { EEventFilterStatus } from './model/enums';
|
||||
import { isHttpError } from '../../http.service';
|
||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -68,7 +70,7 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null, calendarOwnerName = '' }) {
|
||||
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null, calendarOwnerName = '' }, tracing?: TracingType) {
|
||||
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvents(userId, startDate, endDate, status, category, type).pipe(
|
||||
@@ -78,6 +80,11 @@ export class AgendaDataRepositoryService {
|
||||
)).toPromise()
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
} else {
|
||||
tracing?.setAttribute('map.error', JSON.stringify(e.error))
|
||||
}
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { EventList } from "src/app/models/entiry/agenda/eventList"
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput"
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from "../model/enums";
|
||||
import { XTracer } from "src/app/services/monitoring/opentelemetry/tracer";
|
||||
|
||||
function getTextInsideParentheses(inputString): string {
|
||||
var startIndex = inputString.indexOf('(');
|
||||
@@ -13,6 +14,7 @@ function getTextInsideParentheses(inputString): string {
|
||||
}
|
||||
|
||||
export class ListEventMapper {
|
||||
// @XTracer({name:'ListEventMapper/toDomain', log: false, bugPrint: false})
|
||||
static toDomain(dto: EventListOutputDTO, calendarOwnerName: string, userId: string): EventList {
|
||||
|
||||
return dto.map((e) => {
|
||||
@@ -23,7 +25,7 @@ export class ListEventMapper {
|
||||
} else {
|
||||
category = 'Pessoal'
|
||||
}
|
||||
|
||||
|
||||
let ownerType;
|
||||
if(e.ownerType == EEventOwnerType.PR) {
|
||||
ownerType = 'PR'
|
||||
@@ -32,15 +34,15 @@ export class ListEventMapper {
|
||||
} else if(e.ownerType == EEventOwnerType.Others) {
|
||||
ownerType = 'Other'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let type;
|
||||
if(e.type == EEventType.Meeting) {
|
||||
type = 'Meeting'
|
||||
} else if (e.type == EEventType.Travel) {
|
||||
type = 'Travel'
|
||||
}
|
||||
|
||||
|
||||
let status;
|
||||
if(e.status == EEventStatus.Pending) {
|
||||
status = 'Pending'
|
||||
@@ -52,7 +54,7 @@ export class ListEventMapper {
|
||||
status = 'Declined'
|
||||
}
|
||||
|
||||
return {
|
||||
return {
|
||||
"HasAttachments": e.hasAttachments,
|
||||
"IsAllDayEvent": e.isAllDayEvent,
|
||||
"EventId": e.id,
|
||||
|
||||
Reference in New Issue
Block a user