Skip to content

Commit f33bc58

Browse files
committed
Update logger client init parameters
1 parent 36517de commit f33bc58

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/service/logger/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let logClient: LogClient | undefined;
66
let isInitializing = false;
77
let initPromise: Promise<LogClient> | undefined = undefined;
88

9-
export async function getLogClient(account: string, workspace: string): Promise<LogClient> {
9+
export async function getLogClient(account: string, workspace: string, appName: string): Promise<LogClient> {
1010

1111
if (logClient) {
1212
return logClient;
@@ -17,12 +17,12 @@ export async function getLogClient(account: string, workspace: string): Promise<
1717
}
1818

1919
isInitializing = true;
20-
initPromise = initializeClient(account, workspace);
20+
initPromise = initializeClient(account, workspace, appName);
2121

2222
return initPromise;
2323
}
2424

25-
async function initializeClient(account: string, workspace: string): Promise<LogClient> {
25+
async function initializeClient(account: string, workspace: string, appName: string): Promise<LogClient> {
2626
try {
2727
const telemetryClient = await getTelemetryClient();
2828

@@ -38,7 +38,7 @@ async function initializeClient(account: string, workspace: string): Promise<Log
3838
const logsExporter = Exporters.CreateExporter(logsConfig, 'otlp');
3939
await logsExporter.initialize();
4040

41-
const clientKey = `${account}-${workspace}`;
41+
const clientKey = `${account}-${workspace}-${appName}`;
4242
logClient = await telemetryClient.newLogsClient({
4343
exporter: logsExporter,
4444
loggerName: `node-vtex-api-${clientKey}`,

src/service/logger/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class Logger {
4343

4444
this.clientInitializing = true;
4545
try {
46-
this.logClient = await getLogClient(this.account, this.workspace);
46+
this.logClient = await getLogClient(this.account, this.workspace, APP.NAME);
4747
this.clientInitialized = true;
4848
} catch (error) {
4949
console.error('Failed to initialize log client:', error);

0 commit comments

Comments
 (0)