@@ -938,6 +938,33 @@ func TestElasticSpanEnrich(t *testing.T) {
938938 elasticattr .SuccessCount : int64 (1 ),
939939 },
940940 },
941+ {
942+ name : "rpc_span_with_only_rpc_sevice_attr" ,
943+ input : func () ptrace.Span {
944+ span := getElasticSpan ()
945+ span .SetName ("testspan" )
946+ // rpc.service should be used as destination.service.resource
947+ // if no other attributes are present.
948+ span .Attributes ().PutStr (semconv25 .AttributeRPCService , "myService" )
949+ span .Attributes ().PutStr (semconv25 .AttributeRPCSystem , "grpc" )
950+ return span
951+ }(),
952+ config : config .Enabled ().Span ,
953+ enrichedAttrs : map [string ]any {
954+ elasticattr .TimestampUs : startTs .AsTime ().UnixMicro (),
955+ elasticattr .SpanName : "testspan" ,
956+ elasticattr .ProcessorEvent : "span" ,
957+ elasticattr .SpanRepresentativeCount : float64 (1 ),
958+ elasticattr .SpanType : "external" ,
959+ elasticattr .SpanSubtype : "grpc" ,
960+ elasticattr .SpanDurationUs : expectedDuration .Microseconds (),
961+ elasticattr .EventOutcome : "success" ,
962+ elasticattr .SuccessCount : int64 (1 ),
963+ elasticattr .ServiceTargetType : "grpc" ,
964+ elasticattr .ServiceTargetName : "myService" ,
965+ elasticattr .SpanDestinationServiceResource : "myService" ,
966+ },
967+ },
941968 } {
942969 t .Run (tc .name , func (t * testing.T ) {
943970 expectedSpan := ptrace .NewSpan ()
0 commit comments