mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Improve telemetry
This commit is contained in:
@@ -88,3 +88,11 @@ export class AppComponent {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
window.onerror = function(message, source, lineno, colno, error) {
|
||||
if (error) message = error.stack;
|
||||
console.log('send', 'event', 'window.onerror', message, navigator.userAgent);
|
||||
}
|
||||
// ============================================================================
|
||||
|
||||
@@ -125,7 +125,15 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
||||
// new BrowserTracing({
|
||||
// tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
|
||||
// }) as Integration,
|
||||
]
|
||||
],
|
||||
beforeSend(event, hint) {
|
||||
|
||||
// Modify the event here
|
||||
// console.log('Intercepted Sentry event:', event);
|
||||
|
||||
// Optionally, return null to drop the event or return the modified event
|
||||
return event;
|
||||
}
|
||||
},
|
||||
// Forward the init method to the sibling Framework.
|
||||
SentrySibling.init
|
||||
|
||||
@@ -423,3 +423,10 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
window.onerror = function(message, source, lineno, colno, error) {
|
||||
if (error) message = error.stack;
|
||||
console.log('send', 'event', 'window.onerror', message, navigator.userAgent);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null, calendarOwnerName = '' }, tracing?: TracingType) {
|
||||
|
||||
const result = await this.agendaDataService.getEvents({userId, startDate, endDate, status, category, type})
|
||||
const result = await this.agendaDataService.getEvents({userId, startDate, endDate, status, category, type}, tracing)
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ export class EventsPage implements OnInit {
|
||||
startDate: date.toISOString(),
|
||||
endDate: new Date(end).toISOString(),
|
||||
status: EEventFilterStatus.AllToCommunicate
|
||||
})
|
||||
}, tracing)
|
||||
|
||||
if(response.isOk()) {
|
||||
this.listToPresent = response.value;
|
||||
|
||||
@@ -22,6 +22,19 @@ export class HttpService {
|
||||
const result = await this.http.post(url, body, options).toPromise()
|
||||
return ok (result as T)
|
||||
} catch (e) {
|
||||
tracing?.setAttribute('url', url)
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing?.log("bad request "+url, {
|
||||
requestPath: url,
|
||||
requestBody: body,
|
||||
requestStatusCode: e.status.toString()
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
tracing?.setAttribute('outcome', 'failed')
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
@@ -49,13 +62,18 @@ export class HttpService {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing?.setAttribute('outcome', 'failed')
|
||||
tracing?.log("bad request "+url, {
|
||||
requestPath: url,
|
||||
queryParameter: httpParamsObj,
|
||||
requestStatusCode: e.status.toString()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
//tracing?.setAttribute('map.error', 'true')
|
||||
//tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
//tracing?.setAttribute('outcome', 'failed')
|
||||
}
|
||||
tracing?.setAttribute('outcome', 'failed')
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
||||
import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
|
||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
|
||||
//import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
|
||||
import { context, trace, propagation } from '@opentelemetry/api';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
||||
// const { OTLPTraceExporter: OTLPTraceExporterProto } = require("@opentelemetry/exporter-trace-otlp-proto");
|
||||
|
||||
|
||||
function createProvider(serviceName) {
|
||||
const provider = new WebTracerProvider({
|
||||
@@ -14,15 +17,19 @@ function createProvider(serviceName) {
|
||||
});
|
||||
|
||||
// provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
||||
provider.addSpanProcessor(new SimpleSpanProcessor(new ZipkinExporter({
|
||||
//url: 'https://5-180-182-151.cloud-xip.com:85/zipkin-endpoint/api/v2/spans',
|
||||
url: 'https://185-229-224-75.cloud-xip.com:85/zipkin-endpoint/api/v2/spans',
|
||||
serviceName: serviceName,
|
||||
getExportRequestHeaders: () => {
|
||||
return {
|
||||
'Authorization': 'Basic ' + btoa('tabteste@006:tabteste@006'),
|
||||
};
|
||||
}
|
||||
// provider.addSpanProcessor(new SimpleSpanProcessor(new ZipkinExporter({
|
||||
// //url: 'https://5-180-182-151.cloud-xip.com:85/zipkin-endpoint/api/v2/spans',
|
||||
// url: 'https://185-229-224-75.cloud-xip.com:85/zipkin-endpoint/api/v2/spans',
|
||||
// serviceName: serviceName,
|
||||
// getExportRequestHeaders: () => {
|
||||
// return {
|
||||
// 'Authorization': 'Basic ' + btoa('tabteste@006:tabteste@006'),
|
||||
// };
|
||||
// }
|
||||
// })));
|
||||
|
||||
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({
|
||||
url: 'https://185-229-224-75.cloud-xip.com:85/collector2/v1/traces',
|
||||
})));
|
||||
|
||||
provider.register();
|
||||
|
||||
Reference in New Issue
Block a user