Skip to content

✨ [RUM-14244] bootstrap SDK telemetry#9

Merged
bcaudan merged 8 commits into
mainfrom
bcaudan/sdk-telemetry
Feb 16, 2026
Merged

✨ [RUM-14244] bootstrap SDK telemetry#9
bcaudan merged 8 commits into
mainfrom
bcaudan/sdk-telemetry

Conversation

@bcaudan

@bcaudan bcaudan commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Collect telemetry on SDK execution

Changes

  • Introduce optional telemetrySampleRate init config parameter, default to 100
  • Generate telemetryEvent.types file from rum-events-format
  • Reuse browser-core monitoring utility
    • monitor
    • callMonitored
    • addError
  • Introduce temporary API to generate telemetry for testing
  • Limit to 100 telemetry events by session
  • Use telemetry in current code
  • Playground: add a button to generate telemetry errors

Test instructions

From the playground:

Screenshot 2026-02-12 at 10 02 56

Checklist

  • Tested locally (playground)
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@bcaudan bcaudan requested a review from cdn34dd as a code owner February 12, 2026 09:04
@datadog-official

datadog-official Bot commented Feb 12, 2026

Copy link
Copy Markdown

⚠️ Code Quality    ✅ Code Vulnerabilities    ✅ Library Vulnerabilities

Fix all issues with Cursor

⚠️ Warnings

🛠️ 63 Code quality issues detected

Medium: typescript-best-practices/no-console (Fix with Cursor) Avoid leaving console debug statements View rule
scripts/generate-schema-types.ts:26
Medium: typescript-best-practices/no-console (Fix with Cursor) Avoid leaving console debug statements View rule
scripts/generate-schema-types.ts:32
Medium: typescript-best-practices/no-console (Fix with Cursor) Avoid leaving console debug statements View rule
scripts/generate-schema-types.ts:56
View all

ℹ️ Info

🛡️ No new code vulnerabilities
📚 No new vulnerable libraries detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2a01d2d | Docs | Datadog PR Page | Was this helpful? Give us feedback!

];

async function generateTypesForSchema(config: SchemaConfig) {
console.log(`Reading schema from: ${config.schemaPath}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

// Write to output file
console.log('Writing types to:', OUTPUT_PATH);
fs.writeFileSync(OUTPUT_PATH, ts);
console.log(`Writing types to: ${config.outputPath}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread src/config.ts
return 100;
}
if (typeof value !== 'number' || value < 0 || value > 100) {
console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread e2e/lib/helpers.ts
window: [
async ({ electronApp }, use) => {
const window = await electronApp.firstWindow();
window.on('console', (msg) => console.log('Browser console:', msg.text()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

const schema = JSON.parse(schemaContent);

console.log('Generating TypeScript types...');
console.log(`Generating TypeScript types for ${config.typeName}...`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether native views are tracked (for cross platform SDKs)
*/
track_native_views?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether the available view is not active
*/
no_active_view: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether a secure session cookie is used
*/
use_secure_session_cookie?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether the allowed tracing origins list is used (deprecated in favor of use_allowed_tracing_urls)
*/
use_allowed_tracing_origins?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Low: Code Quality Violation

Disallow `// tslint:` comments (...read more)

Correct your types instead of disabling TypeScript.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

];

async function generateTypesForSchema(config: SchemaConfig) {
console.log(`Reading schema from: ${config.schemaPath}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

// Write to output file
console.log('Writing types to:', OUTPUT_PATH);
fs.writeFileSync(OUTPUT_PATH, ts);
console.log(`Writing types to: ${config.outputPath}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread src/config.ts
return 100;
}
if (typeof value !== 'number' || value < 0 || value > 100) {
console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread e2e/lib/helpers.ts
window: [
async ({ electronApp }, use) => {
const window = await electronApp.firstWindow();
window.on('console', (msg) => console.log('Browser console:', msg.text()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

const schema = JSON.parse(schemaContent);

console.log('Generating TypeScript types...');
console.log(`Generating TypeScript types for ${config.typeName}...`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether native views are tracked (for cross platform SDKs)
*/
track_native_views?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether the available view is not active
*/
no_active_view: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether a secure session cookie is used
*/
use_secure_session_cookie?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether the allowed tracing origins list is used (deprecated in favor of use_allowed_tracing_urls)
*/
use_allowed_tracing_origins?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Low: Code Quality Violation

Disallow `// tslint:` comments (...read more)

Correct your types instead of disabling TypeScript.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread scripts/generate-schema-types.ts
Comment thread scripts/generate-schema-types.ts
Comment thread src/config.ts
Comment thread e2e/lib/helpers.ts
Comment thread scripts/generate-schema-types.ts
Comment thread src/domain/telemetry/telemetryEvent.types.ts
Comment thread src/domain/telemetry/telemetryEvent.types.ts
Comment thread src/domain/telemetry/telemetryEvent.types.ts
Comment thread src/domain/telemetry/telemetryEvent.types.ts
Comment thread src/domain/telemetry/telemetry.ts

@cdn34dd cdn34dd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

];

async function generateTypesForSchema(config: SchemaConfig) {
console.log(`Reading schema from: ${config.schemaPath}`);

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

const schema = JSON.parse(schemaContent);

console.log('Generating TypeScript types...');
console.log(`Generating TypeScript types for ${config.typeName}...`);

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

// Write to output file
console.log('Writing types to:', OUTPUT_PATH);
fs.writeFileSync(OUTPUT_PATH, ts);
console.log(`Writing types to: ${config.outputPath}`);

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread src/config.ts
return 20;
}
if (typeof value !== 'number' || value < 0 || value > 100) {
console.error("Configuration error: 'telemetrySampleRate' must be a number between 0 and 100");

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

Comment thread e2e/lib/helpers.ts
window: [
async ({ electronApp }, use) => {
const window = await electronApp.firstWindow();
window.on('console', (msg) => console.log('Browser console:', msg.text()));

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether SwiftUI action instrumentation is enabled
*/
swiftui_action_tracking_enabled?: boolean;

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether RUM events are tracked when the application is in Background
*/
track_background_events?: boolean;

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether the Worker is loaded from an external URL
*/
use_worker_url?: boolean;

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether early requests are tracked
*/
track_early_requests?: boolean;

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

/**
* Whether GraphQL payload tracking is used for at least one GraphQL endpoint
*/
use_track_graph_ql_payload?: boolean;

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot Feb 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Fix with Cursor

View in Datadog  Leave us feedback  Documentation

@bcaudan bcaudan merged commit 3c7c8aa into main Feb 16, 2026
10 checks passed
@bcaudan bcaudan deleted the bcaudan/sdk-telemetry branch February 16, 2026 15:20
@bcaudan bcaudan mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants