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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Features**:

- Only apply non-destructive PII rules to log bodies by default. ([#5272](https://github.com/getsentry/relay/pull/5272))
- Add `sentry.origin` attribute to OTLP spans. ([#5294](https://github.com/getsentry/relay/pull/5294))

**Breaking Changes**:

Expand Down
1 change: 1 addition & 0 deletions relay-server/src/services/processor/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ mod tests {
"instrumentation.scope_key": "scope_value",
"instrumentation.version": "0.0.1",
"resource.resource_key": "resource_value",
"sentry.origin": "auto.otlp.spans",
"span_key": "span_value"
},
"exclusive_time": 0.0,
Expand Down
35 changes: 26 additions & 9 deletions relay-spans/src/otel_to_sentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ mod tests {
"instrumentation.version": "123.42",
"plugin.name": "fastify -> @fastify/multipart",
"resource.service.name": 42,
"sentry.origin": "auto.otlp.spans",
"sentry.parentSampled": true,
"sentry.sample_rate": 1,
"sentry.status.message": "test"
Expand Down Expand Up @@ -199,7 +200,8 @@ mod tests {
"status": "ok",
"description": "middleware - fastify -> @fastify/multipart",
"data": {
"sentry.name": "middleware - fastify -> @fastify/multipart"
"sentry.name": "middleware - fastify -> @fastify/multipart",
"sentry.origin": "auto.otlp.spans"
},
"links": [],
"kind": "internal"
Expand Down Expand Up @@ -234,7 +236,8 @@ mod tests {
"status": "ok",
"description": "middleware - fastify -> @fastify/multipart",
"data": {
"sentry.name": "middleware - fastify -> @fastify/multipart"
"sentry.name": "middleware - fastify -> @fastify/multipart",
"sentry.origin": "auto.otlp.spans"
},
"links": [],
"kind": "internal"
Expand Down Expand Up @@ -299,7 +302,8 @@ mod tests {
"sentry.name": "database query",
"db.name": "database",
"db.statement": "SELECT \"table\".\"col\" FROM \"table\" WHERE \"table\".\"col\" = %s",
"db.type": "sql"
"db.type": "sql",
"sentry.origin": "auto.otlp.spans"
},
"links": [],
"kind": "client"
Expand Down Expand Up @@ -363,7 +367,8 @@ mod tests {
"sentry.name": "database query",
"db.name": "database",
"db.statement": "SELECT \"table\".\"col\" FROM \"table\" WHERE \"table\".\"col\" = %s",
"db.type": "sql"
"db.type": "sql",
"sentry.origin": "auto.otlp.spans"
},
"links": [],
"kind": "client"
Expand Down Expand Up @@ -414,6 +419,7 @@ mod tests {
"data": {
"sentry.name": "http client request",
"http.request.method": "GET",
"sentry.origin": "auto.otlp.spans",
"url.path": "/api/search?q=foobar"
},
"links": [],
Expand Down Expand Up @@ -483,7 +489,8 @@ mod tests {
"data": {
"sentry.name": "cmd.run",
"process.args": "[\"node\",\"--require\",\"preflight.cjs\"]",
"process.info": "[41]"
"process.info": "[41]",
"sentry.origin": "auto.otlp.spans"
},
"links": []
}
Expand Down Expand Up @@ -645,6 +652,7 @@ mod tests {
"sentry.sdk.name": "sentry.php",
"sentry.name": "myname",
"sentry.metrics_summary.some_metric": "[]",
"sentry.origin": "auto.otlp.spans",
"sentry.status.message": "foo"
},
"links": [],
Expand Down Expand Up @@ -677,7 +685,9 @@ mod tests {
"trace_id": "89143b0763095bd9c9955e8175d1fb23",
"is_remote": true,
"status": "ok",
"data": {},
"data": {
"sentry.origin": "auto.otlp.spans"
},
"links": []
}
"#);
Expand Down Expand Up @@ -707,7 +717,9 @@ mod tests {
"trace_id": "89143b0763095bd9c9955e8175d1fb23",
"is_remote": false,
"status": "ok",
"data": {},
"data": {
"sentry.origin": "auto.otlp.spans"
},
"links": []
}
"#);
Expand Down Expand Up @@ -737,7 +749,9 @@ mod tests {
"trace_id": "89143b0763095bd9c9955e8175d1fb23",
"is_remote": false,
"status": "ok",
"data": {},
"data": {
"sentry.origin": "auto.otlp.spans"
},
"links": [],
"kind": "client"
}
Expand Down Expand Up @@ -797,7 +811,9 @@ mod tests {
"trace_id": "3c79f60c11214eb38604f4ae0781bfb2",
"is_remote": false,
"status": "ok",
"data": {},
"data": {
"sentry.origin": "auto.otlp.spans"
},
"links": [
{
"trace_id": "4c79f60c11214eb38604f4ae0781bfb2",
Expand Down Expand Up @@ -839,6 +855,7 @@ mod tests {
"is_remote": false,
"status": "internal_error",
"data": {
"sentry.origin": "auto.otlp.spans",
"sentry.status.message": "2 is the error status code"
},
"links": []
Expand Down
59 changes: 55 additions & 4 deletions relay-spans/src/otel_to_sentry_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use opentelemetry_proto::tonic::common::v1::InstrumentationScope;
use opentelemetry_proto::tonic::resource::v1::Resource;
use opentelemetry_proto::tonic::trace::v1::span::Link as OtelLink;
use opentelemetry_proto::tonic::trace::v1::span::SpanKind as OtelSpanKind;
use relay_conventions::ORIGIN;
use relay_conventions::STATUS_MESSAGE;
use relay_event_schema::protocol::{Attributes, SpanKind};
use relay_otel::otel_value_to_attribute;
Expand Down Expand Up @@ -64,6 +65,8 @@ pub fn otel_to_sentry_span(

relay_otel::otel_scope_into_attributes(&mut sentry_attributes, resource, scope);

sentry_attributes.insert(ORIGIN, "auto.otlp.spans".to_owned());

let mut name = if name.is_empty() { None } else { Some(name) };
for (key, value) in attributes.into_iter().flat_map(|attribute| {
let value = attribute.value?.value?;
Expand Down Expand Up @@ -302,6 +305,10 @@ mod tests {
"type": "double",
"value": 1000.0
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
},
"sentry.parentSampled": {
"type": "boolean",
"value": true
Expand Down Expand Up @@ -357,6 +364,10 @@ mod tests {
"sentry.exclusive_time": {
"type": "double",
"value": 3200.0
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
Expand Down Expand Up @@ -421,6 +432,10 @@ mod tests {
"db.type": {
"type": "string",
"value": "sql"
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
Expand Down Expand Up @@ -495,6 +510,10 @@ mod tests {
"sentry.description": {
"type": "string",
"value": "index view query"
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
Expand Down Expand Up @@ -546,6 +565,10 @@ mod tests {
"type": "string",
"value": "GET"
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
},
"url.path": {
"type": "string",
"value": "/api/search?q=foobar"
Expand Down Expand Up @@ -723,6 +746,10 @@ mod tests {
"type": "string",
"value": "myop"
},
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
},
"sentry.platform": {
"type": "string",
"value": "php"
Expand Down Expand Up @@ -779,7 +806,12 @@ mod tests {
"start_timestamp": 123.0,
"end_timestamp": 123.5,
"links": [],
"attributes": {}
"attributes": {
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
"#);
}
Expand Down Expand Up @@ -807,7 +839,12 @@ mod tests {
"start_timestamp": 123.0,
"end_timestamp": 123.5,
"links": [],
"attributes": {}
"attributes": {
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
"#);
}
Expand Down Expand Up @@ -836,7 +873,12 @@ mod tests {
"start_timestamp": 123.0,
"end_timestamp": 123.5,
"links": [],
"attributes": {}
"attributes": {
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
"#);
}
Expand Down Expand Up @@ -917,7 +959,12 @@ mod tests {
}
}
],
"attributes": {}
"attributes": {
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
}
}
}
"#);
}
Expand Down Expand Up @@ -945,6 +992,10 @@ mod tests {
"end_timestamp": 0.0,
"links": [],
"attributes": {
"sentry.origin": {
"type": "string",
"value": "auto.otlp.spans"
},
"sentry.status.message": {
"type": "string",
"value": "2 is the error status code"
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/test_spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ def test_span_ingestion(
"sentry.exclusive_time": {"type": "double", "value": 500.0},
"sentry.is_segment": {"type": "boolean", "value": True},
"sentry.op": {"type": "string", "value": "default"},
"sentry.origin": {"type": "string", "value": "auto.otlp.spans"},
"sentry.segment.id": {"type": "string", "value": "d342abb1214ca182"},
"sentry.status": {"type": "string", "value": "ok"},
"user_agent.original": {
Expand Down Expand Up @@ -826,6 +827,7 @@ def test_span_ingestion(
},
"sentry.exclusive_time": {"type": "double", "value": 500.0},
"sentry.op": {"type": "string", "value": "default"},
"sentry.origin": {"type": "string", "value": "auto.otlp.spans"},
"sentry.status": {"type": "string", "value": "ok"},
"ui.component_name": {"type": "string", "value": "MyComponent"},
"user_agent.original": {
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_spansv2_otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_span_ingestion(
"type": "string",
"value": time_within(ts, expect_resolution="ns"),
},
"sentry.origin": {"type": "string", "value": "auto.otlp.spans"},
"ui.component_name": {"type": "string", "value": "MyComponent"},
},
"downsampled_retention_days": 90,
Expand Down
Loading