Skip to content

Commit dc7c915

Browse files
chore: replace generating id with crypto with ulid
1 parent 84c8a87 commit dc7c915

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/cli/src/utils/otel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic
55
import { version } from './package.js';
66
import { OTEL_TRACES_URL, DEFAULT_FETCH_TIMEOUT } from './constants.js';
77
import { isDefined } from '../../../core/src/utils/is-defined.js';
8+
import { ulid } from 'ulid';
89

910
import type { CloudEvents } from '@redocly/cli-opentelemetry';
1011

@@ -16,7 +17,7 @@ export class OtelServerTelemetry {
1617
resource: resourceFromAttributes({
1718
[ATTR_SERVICE_NAME]: `redocly-cli`,
1819
[ATTR_SERVICE_VERSION]: `@redocly/cli@${version}`,
19-
session_id: `ses_${crypto.randomUUID()}`,
20+
session_id: `ses_${ulid()}`,
2021
}),
2122
spanProcessors: [
2223
new SimpleSpanProcessor(

packages/cli/src/utils/telemetry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export async function sendTelemetry({
8989
};
9090

9191
const cloudEvent: CloudEvents.CommandRanMessage = {
92-
id: crypto.randomUUID(),
92+
id: ulid(),
9393
time: new Date().toISOString(),
9494
type: 'command.ran',
9595
object: 'event',
@@ -98,7 +98,7 @@ export async function sendTelemetry({
9898
source: 'redocly-cli://telemetry',
9999
origin: 'redocly-cli',
100100
productType: 'redocly-cli',
101-
sessionId: `ses_${crypto.randomUUID()}`,
101+
sessionId: `ses_${ulid()}`,
102102
sourceDetails: {
103103
anonymous_id,
104104
},

0 commit comments

Comments
 (0)