diff --git a/CHANGELOG.md b/CHANGELOG.md index 750785af29..e81b99dad2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,5 +55,7 @@ significant modifications will be credited to OpenTelemetry Authors. ([#255](https://github.com/open-telemetry/opentelemetry-demo/pull/255)) * Added spanmetrics processor to otelcol ([#212](https://github.com/open-telemetry/opentelemetry-demo/pull/212)) +* Added span attributes to shipping service +([#260](https://github.com/open-telemetry/opentelemetry-demo/pull/260)) * Added span attributes to currency service ([#265](https://github.com/open-telemetry/opentelemetry-demo/pull/265)) diff --git a/docs/manual_span_attributes.md b/docs/manual_span_attributes.md index f2c4fa5762..c9da0e5140 100644 --- a/docs/manual_span_attributes.md +++ b/docs/manual_span_attributes.md @@ -82,4 +82,6 @@ This document contains the list of manual Span Attributes used throughout the de ## ShippingService -* None yet +* `app.shipipng.cost.total` +* `app.shipping.items.count` +* `app.shipping.tracking.id` diff --git a/src/shippingservice/src/shipping_service.rs b/src/shippingservice/src/shipping_service.rs index 1936b80721..96f10e7bb1 100644 --- a/src/shippingservice/src/shipping_service.rs +++ b/src/shippingservice/src/shipping_service.rs @@ -90,7 +90,7 @@ impl ShippingService for ShippingServer { .start_with_context("ship-order", &parent_cx); let tid = create_tracking_id(); - span.add_event("Tracking ID issued", vec![KeyValue::new(tid.clone(), true)]); + span.set_attribute(KeyValue::new("app.shipping.tracking.id", tid.clone())); info!("Tracking ID Created: {}", tid); Ok(Response::new(ShipOrderResponse { tracking_id: tid })) diff --git a/src/shippingservice/src/shipping_service/quote.rs b/src/shippingservice/src/shipping_service/quote.rs index b129104389..5afb2c91c0 100644 --- a/src/shippingservice/src/shipping_service/quote.rs +++ b/src/shippingservice/src/shipping_service/quote.rs @@ -17,7 +17,8 @@ pub fn create_quote_from_count(count: u32) -> Quote { }; get_active_span(|span| { let q = create_quote_from_float(f); - span.add_event("Quote Issued", vec![KeyValue::new(format!("{}", q), true)]); + span.set_attribute(KeyValue::new("app.shipping.items.count", count as i64)); + span.set_attribute(KeyValue::new("app.shipping.cost.total", format!("{}", q))); q }) }