-
Notifications
You must be signed in to change notification settings - Fork 8
chore(otlp): use StringBuilder in OTLP trace translation
#1150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors OTLP trace translation code to use StringBuilder instead of format! macro calls for improved performance by reducing string allocations.
Changes:
- Added
MetaString::from_interner()method to handle string interning with fallback logic - Replaced
format!macro usage withStringBuilderfor constructing operation names, resource names, and tags - Removed helper functions
intern_operation_nameandintern_resource_namethat are now obsolete
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/stringtheory/src/lib.rs | Added from_interner() method and exported Interner trait for string interning with fallback |
| lib/saluki-components/src/common/otlp/traces/translator.rs | Refactored tag construction to use StringBuilder instead of format! |
| lib/saluki-components/src/common/otlp/traces/transform.rs | Replaced all format! calls and helper functions with StringBuilder for operation names, resource names, and attribute key mapping |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| let span_kind = SpanKind::try_from(otel_span.kind).unwrap_or(SpanKind::Unspecified); | ||
| let is_client = matches!(span_kind, SpanKind::Client); | ||
| let is_server = matches!(span_kind, SpanKind::Server); |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string_builder is initialized once at the beginning of the function but cleared and reused multiple times across different conditional branches. Consider initializing it closer to where it's first used, or document this reuse pattern, as having it declared at the top with many intervening lines before first use makes the code harder to follow and increases cognitive load.
| let is_server = matches!(span_kind, SpanKind::Server); | |
| let is_server = matches!(span_kind, SpanKind::Server); | |
| // NOTE: `string_builder` is intentionally created once and reused (cleared/repopulated) | |
| // across the conditional branches below to avoid repeated allocations. |
| otel_span: &OtlpSpan, span_attributes: &[KeyValue], resource_attributes: &[KeyValue], interner: &GenericMapInterner, | ||
| ) -> MetaString { | ||
| let span_kind = SpanKind::try_from(otel_span.kind).unwrap_or(SpanKind::Unspecified); | ||
| let mut string_builder = StringBuilder::new(); |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous comment, the string_builder is declared at the top of the function but used in multiple conditional branches below. Consider initializing it closer to its first use or adding a comment explaining the reuse pattern to improve code clarity.
Binary Size Analysis (Agent Data Plane)Target: 8e261e7 (baseline) vs 25e29d5 (comparison) diff
|
| Module | File Size | Symbols |
|---|---|---|
[Unmapped] |
-2.85 KiB | 1 |
core |
+1.31 KiB | 22 |
saluki_components::common::otlp |
+934 B | 12 |
stringtheory::MetaString::from_interner |
+391 B | 1 |
saluki_components::decoders::otlp |
+311 B | 3 |
saluki_common::strings::StringBuilder<I> |
+259 B | 1 |
saluki_common::task::instrument |
+224 B | 2 |
[sections] |
-149 B | 6 |
unicode_segmentation |
-56 B | 1 |
saluki_components::sources::otlp |
+37 B | 2 |
aho_corasick |
-12 B | 1 |
std |
-4 B | 1 |
tokio |
+2 B | 29 |
agent_data_plane::internal::remote_agent |
+2 B | 1 |
saluki_core::data_model::event |
+0 B | 4 |
Detailed Symbol Changes
FILE SIZE VM SIZE
-------------- --------------
[NEW] +25.7Ki [NEW] +25.6Ki saluki_components::common::otlp::traces::transform::otel_to_dd_span_minimal::h39a1d2a06d273496
[NEW] +20.3Ki [NEW] +20.2Ki saluki_components::common::otlp::traces::transform::otel_span_to_dd_span::hdac3746e1e67a5aa
[NEW] +20.2Ki [NEW] +20.0Ki _<saluki_common::task::instrument::InstrumentedTask<F> as core::future::future::Future>::poll::h04f74a1200ab9975
[NEW] +10.9Ki [NEW] +10.7Ki <saluki_core::data_model::event::Event as core::clone::Clone>::clone.10329
[NEW] +6.82Ki [NEW] +6.69Ki saluki_components::common::otlp::traces::translator::OtlpTracesTranslator::translate_spans::ha163927cf4d550d3
[NEW] +2.86Ki [NEW] +2.72Ki saluki_components::common::otlp::traces::transform::conditionally_map_otlp_attribute_to_meta::hc7a3626227bf7a73
[NEW] +2.85Ki [NEW] +2.70Ki <saluki_core::data_model::event::metric::value::MetricValues as core::clone::Clone>::clone.10330
[NEW] +2.18Ki [NEW] +2.03Ki core::ptr::drop_in_place<saluki_components::sources::otlp::run_converter::{{closure}}>::h168433b87c3cd9e7
[NEW] +1.61Ki [NEW] +1.53Ki tokio::runtime::task::raw::poll::h0daf1c9ca32ff8b7
[NEW] +1.55Ki [NEW] +1.48Ki tokio::runtime::task::raw::poll::h42809e2d38098459
-0.1% -794 -0.1% -1.05Ki [67 Others]
[DEL] -1.61Ki [DEL] -1.53Ki tokio::runtime::task::raw::poll::had5a00e17d30ec70
[DEL] -1.97Ki [DEL] -1.82Ki core::ptr::drop_in_place<saluki_components::sources::otlp::run_converter::{{closure}}>::h3f1322f670e5b0d0
-30.2% -2.85Ki [ = ] 0 [Unmapped]
[DEL] -2.85Ki [DEL] -2.70Ki <saluki_core::data_model::event::metric::value::MetricValues as core::clone::Clone>::clone.10331
[DEL] -2.88Ki [DEL] -2.74Ki saluki_components::common::otlp::traces::transform::conditionally_map_otlp_attribute_to_meta::hcb57765e0e34df90
[DEL] -6.80Ki [DEL] -6.67Ki saluki_components::common::otlp::traces::translator::OtlpTracesTranslator::translate_spans::h810428a59aa97882
[DEL] -10.9Ki [DEL] -10.7Ki <saluki_core::data_model::event::Event as core::clone::Clone>::clone.10330
[DEL] -20.0Ki [DEL] -19.8Ki _<saluki_common::task::instrument::InstrumentedTask<F> as core::future::future::Future>::poll::hc5e1da33e8b4bd56
[DEL] -20.8Ki [DEL] -20.6Ki saluki_components::common::otlp::traces::transform::otel_span_to_dd_span::h00544139f30b5566
[DEL] -23.3Ki [DEL] -23.2Ki saluki_components::common::otlp::traces::transform::otel_to_dd_span_minimal::h914728bafd674b5e
+0.0% +360 +0.0% +2.85Ki TOTAL
Regression Detector (Agent Data Plane)Regression Detector ResultsRun ID: 8d41ffc3-ca96-4eb7-bff7-df14be668b87 Baseline: 8e261e7 ❌ Experiments with retried target crashesThis is a critical error. One or more replicates failed with a non-zero exit code. These replicates may have been retried. See Replicate Execution Details for more information.
Optimization Goals: ✅ Improvement(s) detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ❌ | otlp_ingest_logs_5mb_memory | memory utilization | +17.08 | [+16.49, +17.68] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_cpu | % cpu utilization | +1.53 | [-3.74, +6.81] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_throughput | ingress throughput | +0.02 | [-0.11, +0.16] | 1 | (metrics) (profiles) (logs) |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ❌ | otlp_ingest_logs_5mb_memory | memory utilization | +17.08 | [+16.49, +17.68] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_cpu | % cpu utilization | +6.26 | [-24.27, +36.79] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_metrics_5mb_memory | memory utilization | +4.55 | [+4.29, +4.81] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_cpu | % cpu utilization | +2.09 | [-3.75, +7.92] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_cpu | % cpu utilization | +1.53 | [-3.74, +6.81] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_cpu | % cpu utilization | +1.20 | [-52.10, +54.49] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_memory | memory utilization | +0.23 | [+0.04, +0.42] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_ultraheavy | memory utilization | +0.19 | [+0.06, +0.33] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_memory | memory utilization | +0.12 | [-0.06, +0.30] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_idle | memory utilization | +0.12 | [+0.08, +0.16] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_low | memory utilization | +0.04 | [-0.12, +0.20] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_memory | memory utilization | +0.04 | [-0.15, +0.23] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_throughput | ingress throughput | +0.04 | [-0.01, +0.09] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_metrics_5mb_throughput | ingress throughput | +0.03 | [-0.10, +0.17] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_memory | memory utilization | +0.03 | [-0.17, +0.23] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_throughput | ingress throughput | +0.02 | [-0.11, +0.16] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_throughput | ingress throughput | +0.00 | [-0.05, +0.06] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_5mb_throughput | ingress throughput | +0.00 | [-0.08, +0.08] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_throughput | ingress throughput | -0.00 | [-0.06, +0.06] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_throughput | ingress throughput | -0.02 | [-0.16, +0.13] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_memory | memory utilization | -0.24 | [-0.44, -0.04] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_heavy | memory utilization | -0.25 | [-0.37, -0.13] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_medium | memory utilization | -0.32 | [-0.52, -0.13] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_cpu | % cpu utilization | -0.56 | [-1.90, +0.78] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_throughput | ingress throughput | -0.92 | [-1.06, -0.79] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_cpu | % cpu utilization | -0.97 | [-55.88, +53.94] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_metrics_5mb_cpu | % cpu utilization | -1.09 | [-6.69, +4.51] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_5mb_memory | memory utilization | -2.43 | [-2.68, -2.17] | 1 | (metrics) (profiles) (logs) |
| ✅ | otlp_ingest_traces_5mb_cpu | % cpu utilization | -8.07 | [-10.65, -5.50] | 1 | (metrics) (profiles) (logs) |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | links |
|---|---|---|---|---|
| ✅ | quality_gates_rss_dsd_heavy | memory_usage | 10/10 | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_low | memory_usage | 10/10 | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_medium | memory_usage | 10/10 | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_ultraheavy | memory_usage | 10/10 | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_idle | memory_usage | 10/10 | (metrics) (profiles) (logs) |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Replicate Execution Details
We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.
Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.
| Experiment | Variant | Replicates | Failure | Logs | Debug Dashboard |
|---|---|---|---|---|---|
| experiment_with_failures | baseline | 0 (x8) 1 (x6) | Oom killed | Debug Dashboard |
The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.
❌ Retried Normal Replicate Execution Failures (non-profiling)
| Experiment | Variant | Replicates | Failure | Debug Dashboard |
|---|---|---|---|---|
| dsd_uds_100mb_3k_contexts_throughput | baseline | 0 | Failed to shutdown when requested | Debug Dashboard |
| otlp_ingest_logs_5mb_cpu | baseline | 4 | Failed to shutdown when requested | Debug Dashboard |
| otlp_ingest_logs_5mb_cpu | comparison | 7 | Failed to shutdown when requested | Debug Dashboard |
| otlp_ingest_logs_5mb_memory | baseline | 0 (x2) | Failed to shutdown when requested | Debug Dashboard |
| otlp_ingest_logs_5mb_throughput | comparison | 4 | Failed to shutdown when requested | Debug Dashboard |
| quality_gates_rss_dsd_ultraheavy | baseline | 6 | Failed to shutdown when requested | Debug Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// The string is inlined if possible. If it cannot be inlined, the interner is tried. If interning fails, an owned | ||
| /// string is allocated. |
Copilot
AI
Feb 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states 'If interning fails, an owned string is allocated,' but the implementation doesn't show a failure case for interning. The try_intern method returns Option<InternedString> where None indicates the string couldn't be interned (likely due to capacity), not a failure. Consider clarifying this as 'If the string cannot be interned, an owned string is allocated' to better reflect the actual behavior.
| /// The string is inlined if possible. If it cannot be inlined, the interner is tried. If interning fails, an owned | |
| /// string is allocated. | |
| /// The string is inlined if possible. If it cannot be inlined, the interner is tried. If the string cannot be | |
| /// interned, an owned string is allocated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot, c'mon dawg. 😂
fb6280d to
938e29e
Compare
## Summary <!-- Please provide a brief summary about what this PR does. This should help the reviewers give feedback faster and with higher quality. --> This pr adds `StringBuilder` to the translator to be used whenever we want to incrementally build a string in the OTLP traces translator logic. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional (chore, refactoring, docs) - [x] Performance ## How did you test this PR? <!-- Please how you tested these changes here --> Existing tests/ci ## References <!-- Please list any issues closed by this PR. --> <!-- - Closes: <issue link> --> <!-- Any other issues or PRs relevant to this PR? Feel free to list them here. --> eb64b2e
Summary
This pr adds
StringBuilderto the translator to be used whenever we want to incrementally build a string in the OTLP traces translator logic.Change Type
How did you test this PR?
Existing tests/ci
References