Skip to content

Conversation

ericallam
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Oct 8, 2025

⚠️ No Changeset found

Latest commit: b02bfc2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Replaces eager instantiation of otlpExporter with a lazy singleton via singleton("otlpExporter", initializeOTLPExporter). Adds initializeOTLPExporter to construct the exporter using repositories and env flags. Changes truncateAttributes signature from KeyValue[] to Record<string, string | number | boolean | undefined> | undefined and updates callers to pass maps (e.g., truncateAttributes(convertKeyValueItemsToMap(...), maximumLength)). Introduces surrogate-safe truncation helpers (truncateAndDetectUnpairedSurrogate, smartTruncateString, hasUnpairedSurrogateAtEnd) and adds imports detectBadJsonStrings and singleton. Export flow for traces and logs remains unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is completely missing and does not follow the repository’s required template, which mandates an issue reference, checklist, testing steps, changelog entry, and optional screenshots. Without any of these sections present, the description cannot provide context or verification of the change. This absence prevents reviewers from understanding the scope, impact, and verification of the fix. Please add a complete pull request description following the provided template by including the issue number in the “Closes #” section, filling in the ✅ Checklist items, detailing the testing steps you performed, summarizing the changelog, and attaching any relevant screenshots.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the principal fix of preventing unpaired Unicode surrogate pairs from causing insert errors by referencing the added safe truncation logic, and it follows a conventional commit style with a clear scope and description. It is directly related to the main change introduced in the code, namely the new surrogate-safe truncation helpers in the OTLP exporter. Therefore, it meets the criteria for a concise, specific, and relevant pull request title.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc41b95 and b02bfc2.

📒 Files selected for processing (1)
  • apps/webapp/app/v3/otlpExporter.server.ts (4 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/webapp/app/v3/otlpExporter.server.ts (2)

32-34: Unused import: detectBadJsonStrings

Not used in this file. Remove to keep the surface clean.


775-794: truncateAttributes: solid implementation; consider broader coverage

Implementation looks good. Consider also applying the same truncation to:

  • message (currently uses .slice(0, 4096) which can split a surrogate)
  • style and metadata maps
  • span/event attribute maps in spanEventsToEventEvents

This keeps all serialized strings JSON/UTF‑8 safe.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 129dc02 and fc41b95.

⛔ Files ignored due to path filters (1)
  • references/hello-world/src/trigger/telemetry.ts is excluded by !references/**
📒 Files selected for processing (1)
  • apps/webapp/app/v3/otlpExporter.server.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/v3/otlpExporter.server.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/v3/otlpExporter.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

When importing from @trigger.dev/core in the webapp, never import the root package path; always use one of the documented subpath exports from @trigger.dev/core’s package.json

Files:

  • apps/webapp/app/v3/otlpExporter.server.ts
{apps/webapp/app/**/*.server.{ts,tsx},apps/webapp/app/routes/**/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Access environment variables only via the env export from app/env.server.ts; do not reference process.env directly

Files:

  • apps/webapp/app/v3/otlpExporter.server.ts
apps/webapp/app/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Modules intended for test consumption under apps/webapp/app/**/*.ts must not read environment variables; accept configuration via options instead

Files:

  • apps/webapp/app/v3/otlpExporter.server.ts
🧬 Code graph analysis (1)
apps/webapp/app/v3/otlpExporter.server.ts (4)
packages/core/src/v3/semanticInternalAttributes.ts (1)
  • SemanticInternalAttributes (1-67)
apps/webapp/app/services/platform.v3.server.ts (1)
  • singleton (122-122)
apps/webapp/app/v3/eventRepository/eventRepository.server.ts (1)
  • eventRepository (1475-1475)
apps/webapp/app/v3/eventRepository/clickhouseEventRepositoryInstance.server.ts (1)
  • clickhouseEventRepository (6-9)
🪛 Biome (2.1.2)
apps/webapp/app/v3/otlpExporter.server.ts

[error] 806-806: Unexpected control character in a regular expression.

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
apps/webapp/app/v3/otlpExporter.server.ts (2)

226-236: Good: surrogate-safe truncation applied to log properties

Wiring truncateAttributes(convertKeyValueItemsToMap(...), limit) here is correct and avoids unpaired surrogate tails.


307-317: Good: surrogate-safe truncation applied to span properties

Same correctness benefits as logs; this is the right place to cap attribute sizes safely.

Copy link
Collaborator

@nicktrn nicktrn left a comment

Choose a reason for hiding this comment

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

Left some code snippets, but you'd probably want to only slice by checkLength once

@ericallam ericallam merged commit be98aec into main Oct 8, 2025
4 checks passed
@ericallam ericallam deleted the ea-branch-98 branch October 8, 2025 13:32
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