Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"sentry-arroyo>=2.39.2",
"sentry-conventions>=0.8.0",
"sentry-kafka-schemas>=2.1.24",
"sentry-protos>=0.8.14",
"sentry-protos>=0.17.0",
"sentry-redis-tools>=0.5.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The _ITEM_TYPE_TO_APP_FEATURE dictionary is missing the new TRACE_ITEM_TYPE_PROCESSING_ERROR variant, causing incorrect COGS attribution for these events.
Severity: MEDIUM

Suggested Fix

Add the missing entry "TRACE_ITEM_TYPE_PROCESSING_ERROR": "processing_errors" to the _ITEM_TYPE_TO_APP_FEATURE dictionary in snuba/querylog/__init__.py. This will ensure the new trace item type is correctly mapped for COGS tracking, aligning the Python code with the corresponding changes in the Rust processor.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: pyproject.toml#L35

Potential issue: The `_ITEM_TYPE_TO_APP_FEATURE` dictionary in
`snuba/querylog/__init__.py` is missing an entry for the new
`TRACE_ITEM_TYPE_PROCESSING_ERROR` enum variant. When the `_get_eap_app_feature`
function processes a request with this new item type, it fails to find a mapping and
defaults to returning `"null"`. This causes Cost of Goods Sold (COGS) to be recorded
with an incorrect `app_feature` of `"null"` instead of the expected
`"processing_errors"`. This results in silent, incorrect COGS tracking data for this
specific event type within the Events Analytics Platform (EAP) cluster.

Also affects:

  • snuba/querylog/__init__.py:22~36

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in acb1540 — added TRACE_ITEM_TYPE_PROCESSING_ERROR: "processing_errors" to _ITEM_TYPE_TO_APP_FEATURE in snuba/querylog/__init__.py.

— Claude Code

"sentry-relay>=0.9.25",
"sentry-sdk>=2.35.0",
Expand Down
6 changes: 3 additions & 3 deletions rust_snuba/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust_snuba/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sentry = { version = "0.41.0", default-features = false, features = [
] }
sentry-kafka-schemas = "2.1.24"
sentry-options = "1.0.11"
sentry_protos = "0.7.0"
sentry_protos = "0.17.0"
sentry_arroyo = { version = "2.39.2", features = ["ssl"] }
sentry_usage_accountant = { version = "0.1.2", features = ["kafka"] }
seq-macro = "0.3"
Expand Down
1 change: 1 addition & 0 deletions rust_snuba/src/processors/eap_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ fn process_eap_item(msg: KafkaPayload, config: &ProcessorConfig) -> anyhow::Resu
TraceItemType::Attachment => "attachments",
TraceItemType::Preprod => "preprod",
TraceItemType::UserSession => "sessions",
TraceItemType::ProcessingError => "processing_errors",
Comment thread
cursor[bot] marked this conversation as resolved.
TraceItemType::Unspecified => "null",
}
.to_string();
Expand Down
1 change: 1 addition & 0 deletions snuba/querylog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"TRACE_ITEM_TYPE_ATTACHMENT": "attachments",
"TRACE_ITEM_TYPE_PREPROD": "preprod",
"TRACE_ITEM_TYPE_USER_SESSION": "sessions",
"TRACE_ITEM_TYPE_PROCESSING_ERROR": "processing_errors",
"TRACE_ITEM_TYPE_UNSPECIFIED": "null",
}

Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading