Skip to content

Commit d3984fc

Browse files
authored
fix(otlp): propagate Resource from Span to proto (open-telemetry#366)
1 parent 6062ea2 commit d3984fc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

opentelemetry-otlp/src/transform/traces.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ impl From<Link> for Span_Link {
5656

5757
impl From<SpanData> for ResourceSpans {
5858
fn from(source_span: SpanData) -> Self {
59+
let resource_attributes: Attributes = source_span
60+
.resource
61+
.iter()
62+
.map(|(k, v)| opentelemetry::KeyValue::new(k.clone(), v.clone()))
63+
.collect::<Vec<_>>()
64+
.into();
5965
ResourceSpans {
6066
resource: SingularPtrField::from(Some(Resource {
61-
attributes: Default::default(),
67+
attributes: resource_attributes.0,
6268
dropped_attributes_count: 0,
6369
..Default::default()
6470
})),

0 commit comments

Comments
 (0)