Skip to content

Conversation

nikhilsinhaparseable
Copy link
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented Oct 16, 2025

  1. prefix SEVERITY_TEXT_ removed from severity_text in logs
  2. prefix AGGREGATION_TEMPORALITY_ removed from aggregation_temporality_description in metrics
  3. field event_duration_ms and span_duration_ms added in traces
  4. prefix STATUS_CODE_ removed from span_status_description in traces
  5. prefix SPAN_FLAGS_ removed from span_flags_description in traces
  6. prefix SPAN_KIND_ removed from span_kind_description in traces

Summary by CodeRabbit

  • New Features

    • Added span_duration_ms and event_duration_ms to trace output so spans and events include duration values.
  • Improvements

    • Cleaner severity labels in logs for more readable severity text.
    • Shorter, more user-friendly aggregation and flag labels in metrics descriptions.
1. prefix `SEVERITY_TEXT_` removed from severity_text in logs 2. prefix `AGGREGATION_TEMPORALITY_` removed from aggregation_temporality_description in metrics 3. field `event_duration_ms` and `span_duration_ms` added in traces 4. prefix `STATUS_CODE_` removed from span_status_description in traces 5. prefix `SPAN_FLAGS_` removed from span_flags_description in traces 6. prefix `SPAN_KIND_` removed from span_kind_description in traces
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Walkthrough

Adds duration fields to spans and events, expands known trace fields, changes several OTEL description strings, and strips a "SEVERITY_NUMBER_" prefix when writing log severity text. Function signature for event flattening and a public constant were updated; tests adjusted accordingly.

Changes

Cohort / File(s) Summary
Logs severity text handling
src/otel/logs.rs
Introduces severity_text local variable and inserts it after stripping a leading "SEVERITY_NUMBER_" prefix instead of using the proto-style name directly.
Metrics description literals
src/otel/metrics.rs
Replaces verbose proto-name description strings with shorter terms (e.g., AGGREGATION_TEMPORALITY_*UNSPECIFIED/DELTA/CUMULATIVE; DATA_POINT_FLAGS_*DO_NOT_USE/NO_RECORDED_VALUE_MASK).
Traces — durations, known fields, and mappings
src/otel/traces.rs, src/otel/tests/*.rs
Expands OTEL_TRACES_KNOWN_FIELD_LIST (30 → 32 entries), updates flatten_events signature to accept span_start_time_unix_nano: u64, computes and inserts event_duration_ms and span_duration_ms, updates status/kind/flags description strings, and adjusts tests to new fields and mappings.

Sequence Diagram(s)

sequenceDiagram participant Flat as flatten_span_record participant Span as Span participant Events as flatten_events participant Out as JSON output Note over Flat,Span: New/changed flow: compute span duration, pass span start to events Span->>Flat: span (start_time_unix_nano, end_time_unix_nano, events) Flat->>Flat: compute span_duration_ms = (end-start)/1_000_000 Flat->>Events: flatten_events(events, span_start_time_unix_nano) Events->>Events: for each event compute event_duration_ms = (event.time - span_start)/1_000_000 Events->>Flat: flattened events (with event_duration_ms) Flat->>Out: emit spanRecord (includes span_duration_ms and event list) 
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

for next release

Poem

🐇 I trimmed a prefix, counted time in hops,
Spans tick in millis, events mark their stops,
Notes and metrics whisper names made small,
I hop through code and tidy them all. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s template and is missing the issue reference, a descriptive “### Description” section with goals and rationale, and the required checklist confirming testing, comments, and documentation. Please update the PR description to include “Fixes #XXXX” if applicable, fill out the “### Description” section with the purpose, rationale, and key changes, and complete the checklist items at the bottom to indicate testing, comments, and documentation have been addressed.
Title Check ❓ Inconclusive The pull request title “changes to otel data” is overly generic and does not convey the primary modifications made to logs, metrics, and traces in the changeset. Please revise the title to clearly summarize the main change, for example “Strip telemetry prefixes and add duration fields to OTEL logs, metrics, and traces”.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 16, 2025
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/otel/traces.rs (2)

939-942: Critical: Status description assertion needs updating.

This assertion expects the old format with the STATUS_CODE_ prefix, which will cause the test to fail.

Apply this fix:

 assert_eq!( record.get("span_status_description").unwrap(), - &Value::String("STATUS_CODE_OK".to_string()), + &Value::String("OK".to_string()), "Should contain status description" );

946-979: Critical: Test missing new duration fields.

The expected_fields array does not include the newly added span_duration_ms and event_duration_ms fields, which will cause this test to fail.

Add the missing fields to the expected array:

 let expected_fields = [ "scope_name", "scope_version", "scope_schema_url", "scope_dropped_attributes_count", "resource_schema_url", "resource_dropped_attributes_count", "span_trace_id", "span_span_id", "span_name", "span_parent_span_id", "name", "span_kind", "span_kind_description", "span_start_time_unix_nano", "span_end_time_unix_nano", + "span_duration_ms", "event_name", "event_time_unix_nano", + "event_duration_ms", "event_dropped_attributes_count", "link_span_id", "link_trace_id", "link_dropped_attributes_count", "span_dropped_events_count", "span_dropped_links_count", "span_dropped_attributes_count", "span_trace_state", "span_flags", "span_flags_description", "span_status_code", "span_status_description", "span_status_message", ];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ba7116 and 445f013.

📒 Files selected for processing (1)
  • src/otel/traces.rs (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/otel/traces.rs (1)
src/otel/otel_utils.rs (1)
  • insert_attributes (185-190)
⏰ 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). (9)
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: coverage
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
🔇 Additional comments (5)
src/otel/traces.rs (5)

30-63: LGTM: Field list correctly updated.

The additions of span_duration_ms and event_duration_ms to the known field list are consistent with the new duration calculations added in the flattening logic.


174-208: LGTM: Event duration calculation correctly implemented.

The addition of event_duration_ms with proper overflow protection (saturating_sub) and graceful fallback for invalid f64 conversions is well-implemented. The signature change to accept span_start_time_unix_nano correctly enables computing event duration relative to span start.


351-363: LGTM: Span duration calculation correctly implemented.

The span duration calculation follows the same robust pattern as the event duration, with proper overflow protection and graceful error handling. The implementation correctly converts nanoseconds to milliseconds.


370-370: LGTM: Function call correctly updated.

The call to flatten_events properly passes the span_start_time_unix_nano parameter required by the updated signature.


556-556: LGTM: Test call correctly updated.

The test call to flatten_events properly includes the required span_start_time_unix_nano parameter.

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: 0

🧹 Nitpick comments (2)
src/otel/traces.rs (2)

556-593: Add assertions for event_duration_ms.

We now emit event_duration_ms, but this test never validates the numbers. Please assert the expected durations (0.0 ms for the first event, 1000.0 ms for the second) so regressions in the new field are caught.

 let first_event = &result[0]; @@ assert!( first_event.contains_key("service.name"), "Should contain flattened attributes" ); + assert_eq!( + first_event + .get("event_duration_ms") + .and_then(|v| v.as_f64()) + .unwrap(), + 0.0, + "First event should start at the span start time" + ); @@ let second_event = &result[1]; @@ assert_eq!( second_event.get("event_dropped_attributes_count").unwrap(), &Value::Number(0.into()), "Second event dropped count should be zero" ); + assert_eq!( + second_event + .get("event_duration_ms") + .and_then(|v| v.as_f64()) + .unwrap(), + 1000.0, + "Second event should be 1s after span start" + );

676-716: Assert span_duration_ms in the span+event+link test.

span_duration_ms is now part of every flattened record, but this test doesn't verify it. Please assert the propagated duration (1000.0 ms here) so future changes can't break the new field silently.

 assert_eq!( record.get("span_kind_description").unwrap(), &Value::String("SERVER".to_string()), "All records should contain span kind description" ); + assert_eq!( + record + .get("span_duration_ms") + .and_then(|v| v.as_f64()) + .unwrap(), + 1000.0, + "Span duration should be propagated to every record" + );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 445f013 and 22d4ef3.

📒 Files selected for processing (1)
  • src/otel/traces.rs (16 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/otel/traces.rs (1)
src/otel/otel_utils.rs (1)
  • insert_attributes (185-190)
⏰ 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). (10)
  • GitHub Check: Build Default aarch64-apple-darwin
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: coverage
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
@nitisht nitisht merged commit 5f6da2e into parseablehq:main Oct 17, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants