mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
add monitoring
This commit is contained in:
@@ -44,17 +44,28 @@ export class AgendaDataRepositoryService {
|
||||
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
||||
}
|
||||
|
||||
async getEventById(id: string) {
|
||||
async getEventById(id: string, tracing?: TracingType) {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
console.log('Response', response.data)
|
||||
console.log('Output', EventMapper.toDomain(response.data))
|
||||
return EventMapper.toDomain(response.data)
|
||||
EventMapper.toDomain(response)
|
||||
return EventMapper.toDomain(response)
|
||||
})
|
||||
).toPromise()
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}
|
||||
} else {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
}
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
@@ -72,7 +83,13 @@ export class AgendaDataRepositoryService {
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}
|
||||
} else {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import { SharedCalendarListOutputDTO, SharedCalendarListOutputDTOSchema } from '
|
||||
import { HttpService } from '../../http.service';
|
||||
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
|
||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||
import { EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventListOutputDTO, EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventOutputDTO } from './model/eventDTOOutput';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -48,7 +49,7 @@ export class AgendaDataService {
|
||||
}
|
||||
|
||||
// @APIReturn(EventListOutputDTOSchema, 'get/Events')
|
||||
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<any> {
|
||||
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<EventListOutputDTO> {
|
||||
let params = new HttpParams()
|
||||
.set('UserId', userId)
|
||||
|
||||
@@ -72,7 +73,7 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||
}
|
||||
|
||||
getEvent(id: string): Observable<any> {
|
||||
getEvent(id: string): Observable<EventOutputDTO> {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ export class EventMapper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
"owner": dto.owner,
|
||||
"HasAttachments": dto.hasAttachments,
|
||||
"EventComunicationId": 1682,
|
||||
"EventId": dto.id,
|
||||
|
||||
@@ -28,6 +28,11 @@ export class EventToApproveDetailsMapper {
|
||||
}
|
||||
|
||||
let color;
|
||||
if(dto.ownerType == EEventOwnerType.PR) {
|
||||
color = 'PR'
|
||||
} else {
|
||||
color = 'MDGPR'
|
||||
}
|
||||
|
||||
// if(dto.ownerType != 'PR') {
|
||||
let ownerType;
|
||||
@@ -74,6 +79,7 @@ export class EventToApproveDetailsMapper {
|
||||
|
||||
|
||||
return {
|
||||
"owner": dto.owner,
|
||||
"serialNumber": dto.id,
|
||||
"taskStatus": taskStatus,
|
||||
"originator": {
|
||||
|
||||
@@ -186,7 +186,7 @@ export class AuthService {
|
||||
this.RochetChatConnectorService.logout();
|
||||
this.RochetChatConnectorService.connect();
|
||||
this.RochetChatConnectorService.login().then((message: any) => {
|
||||
console.log('Chat login', message)
|
||||
// console.log('Chat login', message)
|
||||
|
||||
SessionStore.user.RochetChatUserId = message.result.id
|
||||
SessionStore.save()
|
||||
|
||||
@@ -420,7 +420,7 @@ export class EventsService {
|
||||
isMyEvent(event: any) {
|
||||
|
||||
const data: any = event
|
||||
return data.Organizer.Id == SessionStore.user.UserId
|
||||
return data.owner.wxUserId == SessionStore.user.UserId
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Tracer, Span } from '@opentelemetry/sdk-trace-base';
|
||||
import { OpentelemetryAgendaProvider } from './opentelemetry';
|
||||
import { Device, DeviceInfo } from '@capacitor/device';
|
||||
|
||||
|
||||
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {
|
||||
|
||||
})
|
||||
@@ -81,12 +82,18 @@ export function XTracerAsync({ name, log, bugPrint }: any, p0?: any) {
|
||||
try {
|
||||
const result = await originalMethod.apply(this, args);
|
||||
|
||||
tracing.finish()
|
||||
if(!window.location.origin.includes('https')) {
|
||||
tracing.finish()
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
} catch (e) {
|
||||
|
||||
tracing.finish()
|
||||
|
||||
if(!window.location.origin.includes('https')) {
|
||||
tracing.finish()
|
||||
}
|
||||
console.error(e);
|
||||
return false
|
||||
}
|
||||
@@ -162,12 +169,18 @@ export function XTracer({name, log, bugPrint}: any) {
|
||||
try {
|
||||
const result = originalMethod.apply(this, args);
|
||||
|
||||
tracing.finish()
|
||||
|
||||
if(!window.location.origin.includes('https')) {
|
||||
tracing.finish()
|
||||
}
|
||||
|
||||
return result
|
||||
} catch (e) {
|
||||
|
||||
tracing.finish()
|
||||
|
||||
if(!window.location.origin.includes('https')) {
|
||||
tracing.finish()
|
||||
}
|
||||
console.error(e);
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ export class TaskService {
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
status: EEventFilterStatus.Pending
|
||||
})
|
||||
}, tracing)
|
||||
|
||||
if(allEvents.isOk()) {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
Reference in New Issue
Block a user