From 412150096573545954af6f57ba18d9b1211815d2 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Thu, 26 Dec 2024 10:57:44 -0300 Subject: [PATCH] refactor: move function to tracing pkg (#34818) --- apps/meteor/server/models/raw/BaseRaw.ts | 2 +- packages/core-services/src/index.ts | 1 - packages/tracing/src/index.ts | 2 ++ .../src/traceInstanceMethods.ts} | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) rename packages/{core-services/src/lib/asyncMethodCallContext.ts => tracing/src/traceInstanceMethods.ts} (95%) diff --git a/apps/meteor/server/models/raw/BaseRaw.ts b/apps/meteor/server/models/raw/BaseRaw.ts index 022576e8f490..7b79973ba14f 100644 --- a/apps/meteor/server/models/raw/BaseRaw.ts +++ b/apps/meteor/server/models/raw/BaseRaw.ts @@ -1,8 +1,8 @@ -import { traceInstanceMethods } from '@rocket.chat/core-services'; import type { RocketChatRecordDeleted } from '@rocket.chat/core-typings'; import type { IBaseModel, DefaultFields, ResultFields, FindPaginated, InsertionModel } from '@rocket.chat/model-typings'; import type { Updater } from '@rocket.chat/models'; import { getCollectionName, UpdaterImpl } from '@rocket.chat/models'; +import { traceInstanceMethods } from '@rocket.chat/tracing'; import { ObjectId } from 'mongodb'; import type { BulkWriteOptions, diff --git a/packages/core-services/src/index.ts b/packages/core-services/src/index.ts index cae8d7c77d64..2d490dfc19a8 100644 --- a/packages/core-services/src/index.ts +++ b/packages/core-services/src/index.ts @@ -51,7 +51,6 @@ import type { IVoipFreeSwitchService } from './types/IVoipFreeSwitchService'; import type { IVoipService } from './types/IVoipService'; export { asyncLocalStorage } from './lib/asyncLocalStorage'; -export { traceInstanceMethods } from './lib/asyncMethodCallContext'; export { MeteorError, isMeteorError } from './MeteorError'; export { api } from './api'; export { EventSignatures } from './events/Events'; diff --git a/packages/tracing/src/index.ts b/packages/tracing/src/index.ts index be086dec094b..1f837984f2f5 100644 --- a/packages/tracing/src/index.ts +++ b/packages/tracing/src/index.ts @@ -9,6 +9,8 @@ import { initDatabaseTracing } from './traceDatabaseCalls'; let tracer: Tracer | undefined; +export * from './traceInstanceMethods'; + export function isTracingEnabled() { return ['yes', 'true'].includes(String(process.env.TRACING_ENABLED).toLowerCase()); } diff --git a/packages/core-services/src/lib/asyncMethodCallContext.ts b/packages/tracing/src/traceInstanceMethods.ts similarity index 95% rename from packages/core-services/src/lib/asyncMethodCallContext.ts rename to packages/tracing/src/traceInstanceMethods.ts index cd9f19baf976..93fa1b145306 100644 --- a/packages/core-services/src/lib/asyncMethodCallContext.ts +++ b/packages/tracing/src/traceInstanceMethods.ts @@ -1,4 +1,4 @@ -import { tracerActiveSpan } from '@rocket.chat/tracing'; +import { tracerActiveSpan } from '.'; const getArguments = (args: any[]): any[] => { return args.map((arg) => {