Skip to content

fix(eap): Use correct attribute names in normalize_mobile_attributes#6065

Open
loewenheim wants to merge 2 commits into
masterfrom
sebastian/fix-mobile-measurements
Open

fix(eap): Use correct attribute names in normalize_mobile_attributes#6065
loewenheim wants to merge 2 commits into
masterfrom
sebastian/fix-mobile-measurements

Conversation

@loewenheim

@loewenheim loewenheim commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

When we implemented #6007, we neglected to adjust the function normalize_mobile_attributes to the correct attribute names. This means that for standalone V2 spans, and V1 spans going through the experimental V2 standalone span pipeline, this function was essentially nonfunctional.

Before this PR:

  • V1 spans going through the legacy pipeline: this logic never existed here 👍
  • V1 spans going through the V2 pipeline: span gets converted from V1 to V2 -> measurement app_start_cold gets "smartly" turned into attribute app.vitals.start.cold.value -> normalize_mobile_attributes looks for attribute app_start_cold and doesn't find it 👎
  • V2 spans: app_start_cold gets backfilled to app.vitals.start.cold.value, so:
    • if a span is sent with the attribute app_start_cold: the function looks for app_start_cold and finds it 👍
    • if a span is sent with the attribute app.vitals.start.cold.value: the function looks for app_start_cold and doesn't find it 👎

After this PR:

  • V1 spans going through the legacy pipeline: unchanged 👍
  • V1 spans going through the V2 pipeline: span gets converted from V1 to V2 -> measurement app_start_cold gets "smartly" turned into attribute app.vitals.start.cold.value -> normalize_mobile_attributes looks for attribute app.vitals.start.cold.value and finds it 👍
  • V2 spans: app_start_cold gets backfilled to app.vitals.start.cold.value, so:
    • if a span is sent with the attribute app_start_cold: the function looks for app.vitals.start.cold.value and finds it 👍
    • if a span is sent with the attribute app.vitals.start.cold.value: the function looks for app.vitals.start.cold.value and finds it 👍

ref: INGEST-943

@loewenheim loewenheim requested a review from a team as a code owner June 9, 2026 14:59
@linear-code

linear-code Bot commented Jun 9, 2026

Copy link
Copy Markdown

INGEST-943

Comment on lines -54 to +63
if let Some(value) = attrs.get_value("app_start_cold").and_then(|v| v.as_f64())
if let Some(value) = attrs
.get_value(APP__VITALS__START__COLD__VALUE)
.and_then(|v| v.as_f64())
&& value <= MAX_DURATION_MOBILE_MS
{
attrs.insert(APP__VITALS__START__VALUE, value);
attrs.insert_if_missing(APP__VITALS__START__TYPE, || "cold".to_owned());
} else if let Some(value) = attrs.get_value("app_start_warm").and_then(|v| v.as_f64())
} else if let Some(value) = attrs
.get_value(APP__VITALS__START__WARM__VALUE)
.and_then(|v| v.as_f64())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the functional change in this PR.

Comment on lines -1549 to 1552
if event.measurement("app_start_cold").is_some() {
if event.measurement(APP_START_COLD).is_some() {
Some("cold")
} else if event.measurement("app_start_warm").is_some() {
} else if event.measurement(APP_START_WARM).is_some() {
Some("warm")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Drive-by change.

Comment on lines -1426 to +1427
("app_start_cold", Some("cold")),
("app_start_warm", Some("warm")),
(APP_START_COLD, Some("cold")),
(APP_START_WARM, Some("warm")),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Drive-by change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The change I'm making in this file would've caught the bug.

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.

1 participant