Skip to content

Commit feccbe5

Browse files
committed
review comments
1 parent 9bc2c4b commit feccbe5

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ sentry = { version = "0.41.0", default-features = false, features = [
180180
] }
181181
sentry-core = "0.41.0"
182182
sentry-kafka-schemas = { version = "2.1.14", default-features = false }
183-
sentry-release-parser = { version = "1.4.0", default-features = false, features = ["semver-1"] }
183+
sentry-release-parser = { version = "1.4.0", default-features = false, features = [
184+
"semver-1",
185+
] }
184186
sentry-types = "0.41.0"
185-
sentry_protos = "0.4.2"
187+
sentry_protos = "0.4.8"
186188
serde = { version = "=1.0.228", features = ["derive", "rc"] }
187189
serde-transcode = "1.1.1"
188190
serde-vars = "0.2.0"

relay-server/src/processing/spans/store/attachment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use chrono::{DateTime, Utc};
44
use relay_event_schema::protocol::{AttachmentV2Meta, Attributes, SpanId};
55
use relay_protocol::{Annotated, IntoValue, Value};
66
use relay_quotas::Scoping;
7-
use sentry_protos::snuba::v1::{AnyValue, TraceItem, any_value};
7+
use sentry_protos::snuba::v1::{AnyValue, TraceItem, TraceItemType, any_value};
88

99
use crate::managed::{Managed, Rejected};
1010
use crate::processing::Retention;
@@ -77,7 +77,7 @@ fn attachment_to_trace_item(meta: Annotated<AttachmentV2Meta>, ctx: Context) ->
7777
span_id: ctx.span_id,
7878
};
7979

80-
let attributes = attributes.into_value()?;
80+
let attributes = attributes.into_value().unwrap_or_default();
8181

8282
let client_sample_rate = extract_client_sample_rate(&attributes).unwrap_or(1.0);
8383

@@ -86,8 +86,8 @@ fn attachment_to_trace_item(meta: Annotated<AttachmentV2Meta>, ctx: Context) ->
8686
project_id: ctx.scoping.project_id.value(),
8787
trace_id: trace_id.into_value()?.to_string(),
8888
item_id: attachment_id.into_value()?.into_bytes().to_vec(),
89-
item_type: 10, // FIXME: use enum from sentry-protos
90-
timestamp: timestamp.into_value().map(|ts| proto_timestamp(ts.0)),
89+
item_type: TraceItemType::Attachment.into(),
90+
timestamp: Some(proto_timestamp(timestamp.into_value()?.0)),
9191
attributes: convert_attributes(annotated_meta, attributes, fields),
9292
client_sample_rate,
9393
server_sample_rate: ctx.server_sample_rate.unwrap_or(1.0),

relay-server/src/services/upload.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ impl Counted for StoreAttachment {
8181
pub enum Error {
8282
#[error("timeout")]
8383
Timeout,
84+
#[error("load shed")]
85+
LoadShed,
8486
#[error("upload failed: {0}")]
8587
UploadFailed(#[from] objectstore_client::Error),
8688
#[error("UUID conversion failed: {0}")]
@@ -91,6 +93,7 @@ impl Error {
9193
fn as_str(&self) -> &'static str {
9294
match self {
9395
Error::Timeout => "timeout",
96+
Error::LoadShed => "load-shed",
9497
Error::UploadFailed(_) => "upload_failed",
9598
Error::Uuid(_) => "uuid",
9699
}
@@ -161,9 +164,14 @@ impl UploadService {
161164
result = "load_shed",
162165
type = message.ty(),
163166
);
164-
if let Upload::Envelope(envelope) = message {
165-
// for now, this will just forward to the store endpoint without uploading attachment
166-
self.inner.store.send(envelope);
167+
match message {
168+
Upload::Envelope(envelope) => {
169+
// Event attachments can still go the old route.
170+
self.inner.store.send(envelope);
171+
}
172+
Upload::Attachment(managed) => {
173+
let _ = managed.reject_err(Error::LoadShed);
174+
}
167175
}
168176
return;
169177
}

0 commit comments

Comments
 (0)