@@ -29,9 +29,7 @@ import { deprecatedRefDocsSchema } from '@redocly/config/lib/reference-docs-conf
2929import { outputExtensions } from '../types';
3030import { version } from './update-version-notifier';
3131import { DESTINATION_REGEX } from '../commands/push';
32- import { RedoclyOAuthClient } from '../auth/oauth-client';
3332import { getReuniteUrl } from '../reunite/api';
34- import { otelTelemetry } from '../otel';
3533
3634import type { Arguments } from 'yargs';
3735import type {
@@ -549,8 +547,6 @@ export function cleanColors(input: string): string {
549547 return input.replace(/\x1b\[\d+m/g, '');
550548}
551549
552- otelTelemetry.init();
553-
554550export async function sendTelemetry(
555551 argv: Arguments | undefined,
556552 exit_code: ExitCode,
@@ -570,6 +566,7 @@ export async function sendTelemetry(
570566 } = argv;
571567 const event_time = new Date().toISOString();
572568 const redoclyClient = new RedoclyClient();
569+ const { RedoclyOAuthClient } = await import('../auth/oauth-client');
573570 const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
574571 const reuniteUrl = getReuniteUrl(argv.residency as string | undefined);
575572 const logged_in = redoclyClient.hasTokens() || (await oauthClient.isAuthorized(reuniteUrl));
@@ -592,6 +589,8 @@ export async function sendTelemetry(
592589 spec_keyword,
593590 spec_full_version,
594591 };
592+ const { otelTelemetry } = await import('../otel');
593+ otelTelemetry.init();
595594 otelTelemetry.send(data.command, data);
596595 } catch (err) {
597596 // Do nothing.
0 commit comments