mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
monitoring notifications
This commit is contained in:
@@ -3,6 +3,7 @@ import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { Tracer, Span } from '@opentelemetry/sdk-trace-base';
|
||||
import { OpentelemetryAgendaProvider, OpentelemetryInterceptorProvider, OpentelemetryNotificationProvider } from './opentelemetry';
|
||||
import { Device, DeviceInfo } from '@capacitor/device';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
|
||||
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {})
|
||||
@@ -58,9 +59,7 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp
|
||||
span.setAttribute(key, value);
|
||||
},
|
||||
finish: () => {
|
||||
if(!window.location.origin.includes('https')) {
|
||||
span.end();
|
||||
}
|
||||
span.end();
|
||||
|
||||
if(bugPrint && hasBug) {
|
||||
console.error(name, data)
|
||||
@@ -87,6 +86,7 @@ export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true
|
||||
|
||||
const tracing = createTracingInstance({bugPrint, name, module, autoFinish})
|
||||
|
||||
tracing.setAttribute('User', SessionStore?.user?.FullName);
|
||||
tracing.setAttribute('current.page', window.location.pathname);
|
||||
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||
|
||||
@@ -95,11 +95,17 @@ export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true
|
||||
try {
|
||||
const result = await originalMethod.apply(this, args);
|
||||
|
||||
tracing.finish()
|
||||
if(autoFinish) {
|
||||
tracing.finish()
|
||||
}
|
||||
|
||||
return result
|
||||
} catch (e) {
|
||||
tracing.setAttribute('catch', 'true')
|
||||
tracing.finish()
|
||||
|
||||
if(autoFinish) {
|
||||
tracing.finish()
|
||||
}
|
||||
console.error(e);
|
||||
return false
|
||||
}
|
||||
@@ -119,6 +125,7 @@ export function XTracer({ name, bugPrint, module, autoFinish = true }) {
|
||||
|
||||
const tracing = createTracingInstance({bugPrint, name, module, autoFinish})
|
||||
|
||||
tracing.setAttribute('User', SessionStore?.user?.FullName);
|
||||
tracing.setAttribute('current.page', window.location.pathname);
|
||||
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||
|
||||
@@ -127,12 +134,18 @@ export function XTracer({ name, bugPrint, module, autoFinish = true }) {
|
||||
try {
|
||||
const result = originalMethod.apply(this, args);
|
||||
|
||||
tracing.finish()
|
||||
|
||||
if(autoFinish) {
|
||||
tracing.finish()
|
||||
}
|
||||
return result
|
||||
} catch (e) {
|
||||
|
||||
tracing.setAttribute('catch', 'true')
|
||||
tracing.finish()
|
||||
|
||||
if(autoFinish) {
|
||||
tracing.finish()
|
||||
}
|
||||
console.error(e);
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user