add tracing tags

This commit is contained in:
Peter Maquiran
2024-07-31 09:35:35 +01:00
parent edcaf951c2
commit 2d2f00cb4c
9 changed files with 51 additions and 53 deletions
@@ -3,6 +3,7 @@ import { HttpService } from 'src/app/services/http.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { IProfilePictureInputDTO } from '../dto/profilePictureInputDTO'; import { IProfilePictureInputDTO } from '../dto/profilePictureInputDTO';
import { HttpHeaders } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http';
import { TracingType } from 'src/app/services/monitoring/opentelemetry/tracer';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -13,14 +14,14 @@ export class UserRemoteRepositoryService {
private httpService: HttpService private httpService: HttpService
) { } ) { }
getUserProfilePhoto(guid: string) { getUserProfilePhoto(guid: string, tracing?: TracingType) {
const geturl = environment.apiURL + 'UserAuthentication/GetPhoto'; const geturl = environment.apiURL + 'UserAuthentication/GetPhoto';
const params = { const params = {
UserPhoto: guid UserPhoto: guid
} }
return this.httpService.get<string>(`${geturl}`, params); return this.httpService.get<string>(`${geturl}`, params, tracing);
} }
addUserProfilePhoto(data: IProfilePictureInputDTO) { addUserProfilePhoto(data: IProfilePictureInputDTO) {
@@ -33,7 +34,7 @@ export class UserRemoteRepositoryService {
let options = { let options = {
headers: http headers: http
}; };
return this.httpService.post<string>(`${geturl}`, data, options); return this.httpService.post<string>(`${geturl}`, data, options);
} }
} }
@@ -15,7 +15,7 @@ export class UserRepositoryService {
) { } ) { }
async getUserProfilePhoto(guid: string , tracing?: TracingType) { async getUserProfilePhoto(guid: string , tracing?: TracingType) {
const result = await this.remote.getUserProfilePhoto(guid) const result = await this.remote.getUserProfilePhoto(guid, tracing)
if(result.isOk()) { if(result.isOk()) {
this.local.addProfilePicture({base64: 'data:image/jpeg;base64,' + result.value}) this.local.addProfilePicture({base64: 'data:image/jpeg;base64,' + result.value})
@@ -6,6 +6,8 @@ import { ThemeService } from 'src/app/services/theme.service'
import { LoginUserRespose } from 'src/app/models/user.model'; import { LoginUserRespose } from 'src/app/models/user.model';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
@Component({ @Component({
selector: 'app-attendees', selector: 'app-attendees',
@@ -25,18 +27,16 @@ export class AttendeesPageModal implements OnInit {
taskParticipants:EventPerson[] = []; taskParticipants:EventPerson[] = [];
taskParticipantsCc:EventPerson[] = []; taskParticipantsCc:EventPerson[] = [];
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
@Input() loggedAttendSon: boolean;
hideExternalDomain = true; hideExternalDomain = true;
taskType: any; taskType: any;
constructor( constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService,
private navParams: NavParams, private navParams: NavParams,
private modalController: ModalController, private modalController: ModalController,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private router: Router,) { private router: Router,
private ContactRepositoryService: ContactRepositoryService) {
this.adding = this.navParams.get('adding'); this.adding = this.navParams.get('adding');
this.taskParticipants = this.navParams.get('taskParticipants'); this.taskParticipants = this.navParams.get('taskParticipants');
@@ -49,7 +49,6 @@ export class AttendeesPageModal implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log('Pesquisa de contactos current path1',this.router.url)
this.fetchContacts(""); this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined){ if(this.taskParticipants == null || this.taskParticipants == undefined){
@@ -136,7 +135,10 @@ export class AttendeesPageModal implements OnInit {
async fetchContacts(filter: string) { async fetchContacts(filter: string) {
this.showLoader = true; this.showLoader = true;
this.contactsService.getContacts(filter).subscribe(_result => { const RequestResult = await this.ContactRepositoryService.getUsersMap();
if(RequestResult.isOk()) {
const _result = RequestResult.value
let result = _result.filter( e => e.UserType == 'GD' && e.EmailAddress.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) let result = _result.filter( e => e.UserType == 'GD' && e.EmailAddress.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
@@ -152,26 +154,19 @@ export class AttendeesPageModal implements OnInit {
}); });
} }
if(this.loggedAttendSon) { this.contacts = result as any;
this.contacts = result;
this.showLoader = false;
} else {
this.contacts = result;
// console.log('Attendes Email',this.loggeduser.Email) // console.log('Attendes Email',this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase()) let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase())
if(this.taskType == 0 || this.taskType == 1){ if(this.taskType == 0 || this.taskType == 1){
filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false) filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false)
} }
// console.log('Attendes Email', filterLoggedUserEmail) // console.log('Attendes Email', filterLoggedUserEmail)
let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "") let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
this.contacts = filterEmptyEmail; this.contacts = filterEmptyEmail;
//console.log('Attendes Email', this.contacts) //console.log('Attendes Email', this.contacts)
this.showLoader = false; this.showLoader = false;
}
}
}
);
} }
@@ -27,6 +27,7 @@ import { DocumentViewerOptionService } from "src/app/services/document-viewer-op
import { fromEvent, merge, interval, Subscription } from 'rxjs'; import { fromEvent, merge, interval, Subscription } from 'rxjs';
import { takeUntil, filter, switchMap, take } from 'rxjs/operators'; import { takeUntil, filter, switchMap, take } from 'rxjs/operators';
import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page'; import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
@Component({ @Component({
selector: 'app-despacho', selector: 'app-despacho',
@@ -214,10 +215,15 @@ export class DespachoPage implements OnInit {
this.mergedArray.push(docObject); this.mergedArray.push(docObject);
}); });
} }
getDraft(split_stringDraft: string[]) {
@XTracerAsync({name:'task/getDraft', bugPrint: true})
getDraft(split_stringDraft: string[], tracing?: TracingType) {
split_stringDraft.forEach(element => { split_stringDraft.forEach(element => {
// console.log('List of ids', element) // console.log('List of ids', element)
tracing.addEvent('start GetDraftByID')
this.processes.GetDraftByID(element).subscribe((resd) => { this.processes.GetDraftByID(element).subscribe((resd) => {
tracing.addEvent('end GetDraftByID')
tracing.setAttribute('sdfsdf', 'asdfsfd');
let object = { let object = {
"ApplicationId": "", "ApplicationId": "",
"Assunto": resd.data.description, "Assunto": resd.data.description,
@@ -235,6 +241,8 @@ export class DespachoPage implements OnInit {
} }
this.mergedArray.push(object) this.mergedArray.push(object)
// console.log('List of draff', resd) // console.log('List of draff', resd)
}, (error) => {
console.log(error)
}) })
}); });
@@ -22,6 +22,7 @@ import { TaskService } from 'src/app/services/task.service'
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page'; import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
import { DespachosPrOptionsPage } from 'src/app/shared/popover/despachos-pr-options/despachos-pr-options.page'; import { DespachosPrOptionsPage } from 'src/app/shared/popover/despachos-pr-options/despachos-pr-options.page';
import { DiplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page'; import { DiplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
@Component({ @Component({
@@ -541,7 +542,9 @@ export class DiplomaPage implements OnInit {
this.mergedArray.push(docObject); this.mergedArray.push(docObject);
}); });
} }
async getDraft(split_stringDraft: string[]) {
@XTracerAsync({name:'task/getDraft', bugPrint: true})
async getDraft(split_stringDraft: string[], tracing?: TracingType) {
this.DraftNames = "" this.DraftNames = ""
for(const strg of split_stringDraft) { for(const strg of split_stringDraft) {
+2 -1
View File
@@ -45,15 +45,16 @@ export class HttpService {
return ok (result as T) return ok (result as T)
} catch (e) { } catch (e) {
tracing?.setAttribute('url', url)
if(isHttpError(e)) { if(isHttpError(e)) {
tracing?.setAttribute('status.code', e.status.toString()) tracing?.setAttribute('status.code', e.status.toString())
if (e.status == 400) { if (e.status == 400) {
tracing?.setAttribute('outcome', 'failed') tracing?.setAttribute('outcome', 'failed')
} }
} else { } else {
tracing.setAttribute('outcome', 'failed')
tracing?.setAttribute('map.error', 'true') tracing?.setAttribute('map.error', 'true')
tracing?.setAttribute('map.error.context', JSON.stringify(e)) tracing?.setAttribute('map.error.context', JSON.stringify(e))
tracing.setAttribute('outcome', 'failed')
} }
return err(e as HttpErrorResponse) return err(e as HttpErrorResponse)
} }
@@ -36,7 +36,6 @@ export class AttendeePage implements OnInit {
@Input() taskParticipants: EventPerson[] = []; @Input() taskParticipants: EventPerson[] = [];
@Input() taskParticipantsCc: EventPerson[] = []; @Input() taskParticipantsCc: EventPerson[] = [];
@Input() loggedAttendSon: boolean;
@Input() footer: boolean; @Input() footer: boolean;
@@ -67,7 +66,6 @@ export class AttendeePage implements OnInit {
ngOnChanges() { ngOnChanges() {
this.LtaskParticipants = removeDuplicate(this.taskParticipants); this.LtaskParticipants = removeDuplicate(this.taskParticipants);
this.LtaskParticipantsCc = removeDuplicate(this.taskParticipantsCc); this.LtaskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
console.log('PARTE PARTE', this.loggedAttendSon)
} }
currentPath = window.location.pathname; currentPath = window.location.pathname;
@@ -75,11 +73,6 @@ export class AttendeePage implements OnInit {
ngOnInit() { ngOnInit() {
console.log('TASK TYPE',this.taskType); console.log('TASK TYPE',this.taskType);
console.log('Pesquisa de contactos current path3', this.router.url)
setTimeout(() => {
console.log('PARTE PARTE', this.loggedAttendSon)
});
this.fetchContacts(""); this.fetchContacts("");
if (this.LtaskParticipants == null || this.LtaskParticipants == undefined) { if (this.LtaskParticipants == null || this.LtaskParticipants == undefined) {
@@ -253,23 +246,19 @@ export class AttendeePage implements OnInit {
}); });
} }
if (this.loggedAttendSon) { this.contacts = this.sort(result as any);
this.contacts = this.sort(result as any); // console.log('Attendes Email', this.loggeduser.Email)
this.showLoader = false; let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase())
} else { if(this.taskType == 0 || this.taskType == 1){
this.contacts = this.sort(result as any); filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false)
// console.log('Attendes Email', this.loggeduser.Email) }
let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase()) // console.log('Attendes Email', filterLoggedUserEmail)
if(this.taskType == 0 || this.taskType == 1){ let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false) this.contacts = filterEmptyEmail;
} // console.log('Attendes Email', this.contacts)
// console.log('Attendes Email', filterLoggedUserEmail) this.showLoader = false;
let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
this.contacts = filterEmptyEmail;
// console.log('Attendes Email', this.contacts)
this.showLoader = false;
}
} else { } else {
+1
View File
@@ -142,6 +142,7 @@ export class HeaderPage implements OnInit {
this.profilePicture = 'data:image/jpeg;base64,' + base.value; this.profilePicture = 'data:image/jpeg;base64,' + base.value;
tracing.setAttribute("picture.save", "true") tracing.setAttribute("picture.save", "true")
tracing.setAttribute("outcome", "success")
} else { } else {
if(!isHttpError(base.error)) { if(!isHttpError(base.error)) {
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = { export let versionData = {
"shortSHA": "8f0625eed", "shortSHA": "edcaf951c",
"SHA": "8f0625eed4612d4f1564895de23a9ec633f54ca0", "SHA": "edcaf951c2d85b037c7a00583fc3fc2634fdae89",
"branch": "feature/agenda-api-peter", "branch": "feature/agenda-api-peter",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Jul 29 17:36:35 2024 +0100'", "lastCommitTime": "'Tue Jul 30 15:52:07 2024 +0100'",
"lastCommitMessage": "expand click area", "lastCommitMessage": "improve monitoring the solution",
"lastCommitNumber": "5894", "lastCommitNumber": "5895",
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is up to date with 'origin/feature/agenda-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/services/decorator/api-validate-schema.decorator.ts\n\tmodified: src/app/services/monitoring/opentelemetry/tracer.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/main.ts", "changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/module/user/data/datasource/user-remote-repository.service.ts\n\tmodified: src/app/module/user/data/user-repository.service.ts\n\tmodified: src/app/pages/events/attendees/attendees.page.ts\n\tmodified: src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts\n\tmodified: src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts\n\tmodified: src/app/services/http.service.ts\n\tmodified: src/app/shared/event/attendee-modal/attendee-modal.page.ts\n\tmodified: src/app/shared/header/header.page.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran" "changeAuthor": "peter.maquiran"
} }