Skip to content

Commit b153ca6

Browse files
mottibecpuckpuck
andauthored
set rpc.method and rpc.service (open-telemetry#1690)
Co-authored-by: Pierre Tessier <pierre@pierretessier.com>
1 parent 030241f commit b153ca6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/shippingservice/src/shipping_service.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use tracking::create_tracking_id;
1919
const NANOS_MULTIPLE: i32 = 10000000i32;
2020

2121
const RPC_SYSTEM_GRPC: &'static str = "grpc";
22+
const RPC_SERVICE_SHIPPING: &'static str = "oteldemo.ShippingService";
2223
const RPC_GRPC_STATUS_CODE_OK: i64 = 0;
2324
const RPC_GRPC_STATUS_CODE_UNKNOWN: i64 = 2;
2425

@@ -75,6 +76,8 @@ impl ShippingService for ShippingServer {
7576
.with_kind(SpanKind::Server)
7677
.start_with_context(&tracer, &parent_cx);
7778
span.set_attribute(KeyValue::new(semconv::trace::RPC_SYSTEM, RPC_SYSTEM_GRPC));
79+
span.set_attribute(KeyValue::new(semconv::trace::RPC_SERVICE, RPC_SERVICE_SHIPPING));
80+
span.set_attribute(KeyValue::new(semconv::trace::RPC_METHOD, "GetQuote"));
7881

7982
span.add_event("Processing get quote request".to_string(), vec![]);
8083
span.set_attribute(KeyValue::new(
@@ -128,6 +131,8 @@ impl ShippingService for ShippingServer {
128131
.with_kind(SpanKind::Server)
129132
.start_with_context(&tracer, &parent_cx);
130133
span.set_attribute(KeyValue::new(semconv::trace::RPC_SYSTEM, RPC_SYSTEM_GRPC));
134+
span.set_attribute(KeyValue::new(semconv::trace::RPC_SERVICE, RPC_SERVICE_SHIPPING));
135+
span.set_attribute(KeyValue::new(semconv::trace::RPC_METHOD, "ShipOrder"));
131136

132137
span.add_event("Processing shipping order request".to_string(), vec![]);
133138

0 commit comments

Comments
 (0)