Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module.exports = {
lines: 84,
},
'packages/cli/': {
statements: 64,
statements: 63,
branches: 51,
functions: 63,
lines: 64,
functions: 62,
lines: 63,
},
'packages/respect-core/': {
statements: 79,
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/utils/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ import { deprecatedRefDocsSchema } from '@redocly/config/lib/reference-docs-conf
import { outputExtensions } from '../types';
import { version } from './update-version-notifier';
import { DESTINATION_REGEX } from '../commands/push';
import { RedoclyOAuthClient } from '../auth/oauth-client';
import { getReuniteUrl } from '../reunite/api';
import { otelTelemetry } from '../otel';

import type { Arguments } from 'yargs';
import type {
Expand Down Expand Up @@ -549,8 +547,6 @@ export function cleanColors(input: string): string {
return input.replace(/\x1b\[\d+m/g, '');
}

otelTelemetry.init();

export async function sendTelemetry(
argv: Arguments | undefined,
exit_code: ExitCode,
Expand All @@ -570,6 +566,7 @@ export async function sendTelemetry(
} = argv;
const event_time = new Date().toISOString();
const redoclyClient = new RedoclyClient();
const { RedoclyOAuthClient } = await import('../auth/oauth-client');
const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
const reuniteUrl = getReuniteUrl(argv.residency as string | undefined);
const logged_in = redoclyClient.hasTokens() || (await oauthClient.isAuthorized(reuniteUrl));
Expand All @@ -592,6 +589,8 @@ export async function sendTelemetry(
spec_keyword,
spec_full_version,
};
const { otelTelemetry } = await import('../otel');
otelTelemetry.init();
otelTelemetry.send(data.command, data);
} catch (err) {
// Do nothing.
Expand Down
Loading