feat: Add service type to telemetry data

This commit is contained in:
Faruk AYDIN
2022-09-21 01:39:05 +03:00
committed by Ali BARIN
parent 4d7ee3dcca
commit 832876d711
3 changed files with 12 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ class Telemetry {
organizationId: string;
instanceId: string;
client: Analytics;
serviceType: string;
constructor() {
this.client = new Analytics(WRITE_KEY, DATA_PLANE_URL);
@@ -25,6 +26,10 @@ class Telemetry {
this.instanceId = instanceId();
}
setServiceType(type: string) {
this.serviceType = type;
}
track(name: string, properties: apiObject) {
if (!appConfig.telemetryEnabled) {
return;
@@ -131,6 +136,7 @@ class Telemetry {
this.track('diagnosticInfo', {
automatischVersion: appConfig.version,
serveWebAppSeparately: appConfig.serveWebAppSeparately,
serviceType: this.serviceType,
operatingSystem: {
type: os.type(),
version: os.version(),

View File

@@ -1,6 +1,9 @@
import app from './app';
import appConfig from './config/app';
import logger from './helpers/logger';
import telemetry from './helpers/telemetry';
telemetry.setServiceType('main');
const port = appConfig.port;

View File

@@ -1,2 +1,5 @@
import './config/orm';
export { worker } from './workers/processor';
import telemetry from './helpers/telemetry';
telemetry.setServiceType('worker');