Skip to content

Commit d98fe65

Browse files
authored
[shipping] - add span attributes (#260)
* set span attributes * shipping span attributes
1 parent 5e95556 commit d98fe65

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ significant modifications will be credited to OpenTelemetry Authors.
5555
([#255](https://github.com/open-telemetry/opentelemetry-demo/pull/255))
5656
* Added spanmetrics processor to otelcol
5757
([#212](https://github.com/open-telemetry/opentelemetry-demo/pull/212))
58+
* Added span attributes to shipping service
59+
([#260](https://github.com/open-telemetry/opentelemetry-demo/pull/260))
5860
* Added span attributes to currency service
5961
([#265](https://github.com/open-telemetry/opentelemetry-demo/pull/265))

docs/manual_span_attributes.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,6 @@ This document contains the list of manual Span Attributes used throughout the de
8282

8383
## ShippingService
8484

85-
* None yet
85+
* `app.shipipng.cost.total`
86+
* `app.shipping.items.count`
87+
* `app.shipping.tracking.id`

src/shippingservice/src/shipping_service.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl ShippingService for ShippingServer {
9090
.start_with_context("ship-order", &parent_cx);
9191

9292
let tid = create_tracking_id();
93-
span.add_event("Tracking ID issued", vec![KeyValue::new(tid.clone(), true)]);
93+
span.set_attribute(KeyValue::new("app.shipping.tracking.id", tid.clone()));
9494
info!("Tracking ID Created: {}", tid);
9595

9696
Ok(Response::new(ShipOrderResponse { tracking_id: tid }))

src/shippingservice/src/shipping_service/quote.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ pub fn create_quote_from_count(count: u32) -> Quote {
1717
};
1818
get_active_span(|span| {
1919
let q = create_quote_from_float(f);
20-
span.add_event("Quote Issued", vec![KeyValue::new(format!("{}", q), true)]);
20+
span.set_attribute(KeyValue::new("app.shipping.items.count", count as i64));
21+
span.set_attribute(KeyValue::new("app.shipping.cost.total", format!("{}", q)));
2122
q
2223
})
2324
}

0 commit comments

Comments
 (0)