2024-07-22 11:37:02 +01:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
|
import { WebSocketGraylogService } from "../socket/socket";
|
|
|
|
|
import { Span } from "@opentelemetry/sdk-trace-web";
|
2024-07-26 15:28:38 +01:00
|
|
|
import { environment } from "src/environments/environment";
|
2024-07-22 11:37:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export class OpenTelemetryLogging {
|
|
|
|
|
|
|
|
|
|
socket = new WebSocketGraylogService()
|
|
|
|
|
|
|
|
|
|
constructor() {
|
2024-07-26 15:28:38 +01:00
|
|
|
|
|
|
|
|
if(environment.apiURL != 'https://gdqas-api.oapr.gov.ao/api/') {
|
|
|
|
|
this.socket.start()
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-22 11:37:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
send(data: Object & { type: string; payload: any, spanContext:any }): void {
|
|
|
|
|
this.socket.send({
|
|
|
|
|
type: data.type,
|
|
|
|
|
payload: data.payload,
|
|
|
|
|
requestId: uuidv4(),
|
|
|
|
|
spanContext: data.spanContext
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const openTelemetryLogging = new OpenTelemetryLogging()
|