src,test: preserve Latin1 strings in fastSpan APIs#450
src,test: preserve Latin1 strings in fastSpan APIs#450santigimeno wants to merge 1 commit intonode-v24.x-nsolid-v6.xfrom
Conversation
WalkthroughAdds Latin‑1 → UTF‑8 conversion for FastOneByteString in nsolid fast API calls, updates two fast API methods to use the converter and emit tracking macros, and adds/updates tests to validate Latin‑1 handling in spans and tracing flows. Changes
Sequence Diagram(s)sequenceDiagram
participant JS as App JS (tracer)
participant Binding as nsolid native binding
participant Converter as OneByteToUtf8 (simdutf)
participant Tracer as nsolid tracer internals
JS->>Binding: pushSpanDataString(FastOneByteString)
Binding->>Converter: convert_latin1_to_utf8(data)
Converter-->>Binding: utf8 bytes
Binding->>Tracer: record span attribute / name (UTF-8)
Tracer-->>JS: span updated / callbacks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/nsolid/nsolid_api.cc`:
- Around line 98-105: The helper OneByteToUtf8 should accept empty
FastOneByteString inputs: remove or guard the DCHECK that assumes actual_length
!= 0 so empty input (input.length == 0) does not trigger a debug crash;
specifically, in OneByteToUtf8 replace the unconditional
DCHECK_NE(actual_length, 0) with a conditional guard (e.g., only DCHECK when
input.length > 0) or drop it entirely, then resize out to actual_length as
already done so empty results are handled the same way as the String::Utf8Value
slow path; reference symbols: OneByteToUtf8, FastOneByteString,
simdutf::convert_latin1_to_utf8, DCHECK_NE(actual_length, 0).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5dc324e0-d8b7-4bed-838d-0ca339d1ff44
📒 Files selected for processing (5)
src/nsolid/nsolid_api.cctest/addons/nsolid-tracing/test-fast-api-string-latin1.jstest/addons/nsolid-tracing/test-otel-basic.jstest/agents/test-grpc-tracing.mjstest/common/nsolid-grpc-agent/client.js
Convert FastOneByteString inputs to UTF-8 before storing span string data so non-ASCII Latin-1 values such as ñ are emitted correctly by the N|Solid fast tracing bindings. Add tracing coverage for Latin-1 custom attributes and introduce a debug-only fast-path test that uses TRACK_V8_FAST_API_CALL to verify pushSpanDataString() and pushSpanDataString3() actually execute through the V8 fast API path.
6b47372 to
6f3ef2c
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/nsolid/nsolid_api.cc (1)
2483-2490: Minor indentation inconsistency.Lines 2487-2489 have different indentation than 2484-2486.
🧹 Suggested fix for consistent alignment
TRACK_V8_FAST_API_CALL("nsolid.pushSpanDataString3"); PushSpanDataStringImpl3(FromJSObject<BindingData>(receiver), trace_id, type, - OneByteToUtf8(val1), - OneByteToUtf8(val2), - OneByteToUtf8(val3)); + OneByteToUtf8(val1), + OneByteToUtf8(val2), + OneByteToUtf8(val3)); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/nsolid/nsolid_api.cc` around lines 2483 - 2490, Align the argument formatting for the PushSpanDataStringImpl3 call to match the surrounding calls: make the lines passing FromJSObject<BindingData>(receiver), trace_id, type, OneByteToUtf8(val1), OneByteToUtf8(val2), OneByteToUtf8(val3) use the same indentation/column alignment as the earlier block (and as TRACK_V8_FAST_API_CALL("nsolid.pushSpanDataString3") line), so arguments 2–6 line up consistently with the other multi-line call sites in this file and restore consistent indentation around PushSpanDataStringImpl3 and its parameters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/nsolid/nsolid_api.cc`:
- Around line 2483-2490: Align the argument formatting for the
PushSpanDataStringImpl3 call to match the surrounding calls: make the lines
passing FromJSObject<BindingData>(receiver), trace_id, type,
OneByteToUtf8(val1), OneByteToUtf8(val2), OneByteToUtf8(val3) use the same
indentation/column alignment as the earlier block (and as
TRACK_V8_FAST_API_CALL("nsolid.pushSpanDataString3") line), so arguments 2–6
line up consistently with the other multi-line call sites in this file and
restore consistent indentation around PushSpanDataStringImpl3 and its
parameters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 76417f12-6e6f-4e2b-b5ec-5a9e26fca40f
📒 Files selected for processing (5)
src/nsolid/nsolid_api.cctest/addons/nsolid-tracing/test-fast-api-string-latin1.jstest/addons/nsolid-tracing/test-otel-basic.jstest/agents/test-grpc-tracing.mjstest/common/nsolid-grpc-agent/client.js
✅ Files skipped from review due to trivial changes (2)
- test/addons/nsolid-tracing/test-otel-basic.js
- test/common/nsolid-grpc-agent/client.js
🚧 Files skipped from review as they are similar to previous changes (1)
- test/agents/test-grpc-tracing.mjs
Convert FastOneByteString inputs to UTF-8 before storing span string data so non-ASCII Latin-1 values such as ñ are emitted correctly by the N|Solid fast tracing bindings.
Add tracing coverage for Latin-1 custom attributes and introduce a debug-only fast-path test that uses TRACK_V8_FAST_API_CALL to verify pushSpanDataString() and pushSpanDataString3() actually execute through the V8 fast API path.
Summary by CodeRabbit
Bug Fixes
Tests