Skip to content

Commit

Permalink
set rpc.method and rpc.service (open-telemetry#1690)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Tessier <pierre@pierretessier.com>
  • Loading branch information
mottibec and puckpuck authored Jul 31, 2024
1 parent 030241f commit b153ca6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/shippingservice/src/shipping_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use tracking::create_tracking_id;
const NANOS_MULTIPLE: i32 = 10000000i32;

const RPC_SYSTEM_GRPC: &'static str = "grpc";
const RPC_SERVICE_SHIPPING: &'static str = "oteldemo.ShippingService";
const RPC_GRPC_STATUS_CODE_OK: i64 = 0;
const RPC_GRPC_STATUS_CODE_UNKNOWN: i64 = 2;

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

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

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

Expand Down

0 comments on commit b153ca6

Please sign in to comment.