✨ [RUM-14244] bootstrap SDK telemetry#9
Conversation
reusing browser-core monitor utility
|
| ]; | ||
|
|
||
| async function generateTypesForSchema(config: SchemaConfig) { | ||
| console.log(`Reading schema from: ${config.schemaPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| // Write to output file | ||
| console.log('Writing types to:', OUTPUT_PATH); | ||
| fs.writeFileSync(OUTPUT_PATH, ts); | ||
| console.log(`Writing types to: ${config.outputPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| return 100; | ||
| } | ||
| if (typeof value !== 'number' || value < 0 || value > 100) { | ||
| console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100"); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| window: [ | ||
| async ({ electronApp }, use) => { | ||
| const window = await electronApp.firstWindow(); | ||
| window.on('console', (msg) => console.log('Browser console:', msg.text())); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| const schema = JSON.parse(schemaContent); | ||
|
|
||
| console.log('Generating TypeScript types...'); | ||
| console.log(`Generating TypeScript types for ${config.typeName}...`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| /** | ||
| * Whether native views are tracked (for cross platform SDKs) | ||
| */ | ||
| track_native_views?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'track_native_views' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether the available view is not active | ||
| */ | ||
| no_active_view: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'no_active_view' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether a secure session cookie is used | ||
| */ | ||
| use_secure_session_cookie?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_secure_session_cookie' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether the allowed tracing origins list is used (deprecated in favor of use_allowed_tracing_urls) | ||
| */ | ||
| use_allowed_tracing_origins?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_allowed_tracing_origins' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| import { performDraw, type Subscription } from '@datadog/browser-core'; | ||
| // These are internal browser-core exports, not part of the public API | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore TODO(RUM-14336) expose those APIs from browser-core |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Disallow `// tslint:` comments (...read more)
Correct your types instead of disabling TypeScript.
| ]; | ||
|
|
||
| async function generateTypesForSchema(config: SchemaConfig) { | ||
| console.log(`Reading schema from: ${config.schemaPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| // Write to output file | ||
| console.log('Writing types to:', OUTPUT_PATH); | ||
| fs.writeFileSync(OUTPUT_PATH, ts); | ||
| console.log(`Writing types to: ${config.outputPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| return 100; | ||
| } | ||
| if (typeof value !== 'number' || value < 0 || value > 100) { | ||
| console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100"); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| window: [ | ||
| async ({ electronApp }, use) => { | ||
| const window = await electronApp.firstWindow(); | ||
| window.on('console', (msg) => console.log('Browser console:', msg.text())); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| const schema = JSON.parse(schemaContent); | ||
|
|
||
| console.log('Generating TypeScript types...'); | ||
| console.log(`Generating TypeScript types for ${config.typeName}...`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| /** | ||
| * Whether native views are tracked (for cross platform SDKs) | ||
| */ | ||
| track_native_views?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'track_native_views' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether the available view is not active | ||
| */ | ||
| no_active_view: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'no_active_view' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether a secure session cookie is used | ||
| */ | ||
| use_secure_session_cookie?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_secure_session_cookie' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether the allowed tracing origins list is used (deprecated in favor of use_allowed_tracing_urls) | ||
| */ | ||
| use_allowed_tracing_origins?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_allowed_tracing_origins' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| import { performDraw, type Subscription } from '@datadog/browser-core'; | ||
| // These are internal browser-core exports, not part of the public API | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore TODO(RUM-14336) expose those APIs from browser-core |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Disallow `// tslint:` comments (...read more)
Correct your types instead of disabling TypeScript.
| ]; | ||
|
|
||
| async function generateTypesForSchema(config: SchemaConfig) { | ||
| console.log(`Reading schema from: ${config.schemaPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| const schema = JSON.parse(schemaContent); | ||
|
|
||
| console.log('Generating TypeScript types...'); | ||
| console.log(`Generating TypeScript types for ${config.typeName}...`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| // Write to output file | ||
| console.log('Writing types to:', OUTPUT_PATH); | ||
| fs.writeFileSync(OUTPUT_PATH, ts); | ||
| console.log(`Writing types to: ${config.outputPath}`); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| return 20; | ||
| } | ||
| if (typeof value !== 'number' || value < 0 || value > 100) { | ||
| console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100"); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| window: [ | ||
| async ({ electronApp }, use) => { | ||
| const window = await electronApp.firstWindow(); | ||
| window.on('console', (msg) => console.log('Browser console:', msg.text())); |
There was a problem hiding this comment.
🟠 Medium: Code Quality Violation
Unexpected console statement. (...read more)
Debugging with console is not considered a bad practice, but it's easy to forget about console statements and leave them in production code. There is no need to pollute production builds with debugging statements.
| /** | ||
| * Whether SwiftUI action instrumentation is enabled | ||
| */ | ||
| swiftui_action_tracking_enabled?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'swiftui_action_tracking_enabled' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether RUM events are tracked when the application is in Background | ||
| */ | ||
| track_background_events?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'track_background_events' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether the Worker is loaded from an external URL | ||
| */ | ||
| use_worker_url?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_worker_url' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether early requests are tracked | ||
| */ | ||
| track_early_requests?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'track_early_requests' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
| /** | ||
| * Whether GraphQL payload tracking is used for at least one GraphQL endpoint | ||
| */ | ||
| use_track_graph_ql_payload?: boolean; |
There was a problem hiding this comment.
🟡 Low: Code Quality Violation
Prop name 'use_track_graph_ql_payload' is not prefixed with `is` or `has` (...read more)
Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent).
Motivation
Collect telemetry on SDK execution
Changes
telemetrySampleRateinit config parameter, default to 100telemetryEvent.typesfile from rum-events-formatbrowser-coremonitoring utilitymonitorcallMonitoredaddErrorTest instructions
From the playground:
Checklist