1616import static io .opentelemetry .contrib .awsxray .AwsAttributeKeys .AWS_STREAM_NAME ;
1717import static io .opentelemetry .contrib .awsxray .AwsAttributeKeys .AWS_TABLE_NAME ;
1818import static io .opentelemetry .semconv .ServiceAttributes .SERVICE_NAME ;
19- import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_OPERATION ;
20- import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_SYSTEM ;
21- import static io .opentelemetry .semconv .incubating .FaasIncubatingAttributes .FAAS_INVOKED_NAME ;
22- import static io .opentelemetry .semconv .incubating .FaasIncubatingAttributes .FAAS_TRIGGER ;
23- import static io .opentelemetry .semconv .incubating .GraphqlIncubatingAttributes .GRAPHQL_OPERATION_TYPE ;
24- import static io .opentelemetry .semconv .incubating .HttpIncubatingAttributes .HTTP_METHOD ;
25- import static io .opentelemetry .semconv .incubating .HttpIncubatingAttributes .HTTP_TARGET ;
26- import static io .opentelemetry .semconv .incubating .HttpIncubatingAttributes .HTTP_URL ;
27- import static io .opentelemetry .semconv .incubating .MessagingIncubatingAttributes .MESSAGING_OPERATION ;
28- import static io .opentelemetry .semconv .incubating .MessagingIncubatingAttributes .MESSAGING_SYSTEM ;
29- import static io .opentelemetry .semconv .incubating .NetIncubatingAttributes .NET_PEER_NAME ;
30- import static io .opentelemetry .semconv .incubating .NetIncubatingAttributes .NET_PEER_PORT ;
31- import static io .opentelemetry .semconv .incubating .NetIncubatingAttributes .NET_SOCK_PEER_ADDR ;
32- import static io .opentelemetry .semconv .incubating .NetIncubatingAttributes .NET_SOCK_PEER_PORT ;
33- import static io .opentelemetry .semconv .incubating .PeerIncubatingAttributes .PEER_SERVICE ;
34- import static io .opentelemetry .semconv .incubating .RpcIncubatingAttributes .RPC_METHOD ;
35- import static io .opentelemetry .semconv .incubating .RpcIncubatingAttributes .RPC_SERVICE ;
3619
3720import io .opentelemetry .api .common .AttributeKey ;
3821import io .opentelemetry .api .common .Attributes ;
4124import io .opentelemetry .sdk .resources .Resource ;
4225import io .opentelemetry .sdk .trace .data .SpanData ;
4326import io .opentelemetry .semconv .ServiceAttributes ;
44- import io .opentelemetry .semconv .incubating .GraphqlIncubatingAttributes ;
4527import java .net .MalformedURLException ;
4628import java .net .URL ;
4729import java .util .Optional ;
5739 * represent "incoming" traffic, {@link SpanKind#CLIENT} and {@link SpanKind#PRODUCER} spans
5840 * represent "outgoing" traffic, and {@link SpanKind#INTERNAL} spans are ignored.
5941 */
60- @ SuppressWarnings ("deprecation" ) // uses deprecated semantic conventions
6142final class AwsMetricAttributeGenerator implements MetricAttributeGenerator {
6243
6344 private static final Logger logger =
@@ -72,6 +53,38 @@ final class AwsMetricAttributeGenerator implements MetricAttributeGenerator {
7253 private static final String UNKNOWN_REMOTE_SERVICE = "UnknownRemoteService" ;
7354 private static final String UNKNOWN_REMOTE_OPERATION = "UnknownRemoteOperation" ;
7455
56+ // copied from DbIncubatingAttributes
57+ private static final AttributeKey <String > DB_OPERATION = AttributeKey .stringKey ("db.operation" );
58+ private static final AttributeKey <String > DB_SYSTEM = AttributeKey .stringKey ("db.system" );
59+ // copied from FaasIncubatingAttributes
60+ private static final AttributeKey <String > FAAS_INVOKED_NAME =
61+ AttributeKey .stringKey ("faas.invoked_name" );
62+ private static final AttributeKey <String > FAAS_TRIGGER = AttributeKey .stringKey ("faas.trigger" );
63+ // copied from GraphqlIncubatingAttributes
64+ private static final AttributeKey <String > GRAPHQL_OPERATION_TYPE =
65+ AttributeKey .stringKey ("graphql.operation.type" );
66+ // copied from HttpIncubatingAttributes
67+ private static final AttributeKey <String > HTTP_METHOD = AttributeKey .stringKey ("http.method" );
68+ private static final AttributeKey <String > HTTP_TARGET = AttributeKey .stringKey ("http.target" );
69+ private static final AttributeKey <String > HTTP_URL = AttributeKey .stringKey ("http.url" );
70+ // copied from MessagingIncubatingAttributes
71+ private static final AttributeKey <String > MESSAGING_OPERATION =
72+ AttributeKey .stringKey ("messaging.operation" );
73+ private static final AttributeKey <String > MESSAGING_SYSTEM =
74+ AttributeKey .stringKey ("messaging.system" );
75+ // copied from NetIncubatingAttributes
76+ private static final AttributeKey <String > NET_PEER_NAME = AttributeKey .stringKey ("net.peer.name" );
77+ private static final AttributeKey <Long > NET_PEER_PORT = AttributeKey .longKey ("net.peer.port" );
78+ private static final AttributeKey <String > NET_SOCK_PEER_ADDR =
79+ AttributeKey .stringKey ("net.sock.peer.addr" );
80+ private static final AttributeKey <Long > NET_SOCK_PEER_PORT =
81+ AttributeKey .longKey ("net.sock.peer.port" );
82+ // copied from PeerIncubatingAttributes
83+ private static final AttributeKey <String > PEER_SERVICE = AttributeKey .stringKey ("peer.service" );
84+ // copied from RpcIncubatingAttributes
85+ private static final AttributeKey <String > RPC_METHOD = AttributeKey .stringKey ("rpc.method" );
86+ private static final AttributeKey <String > RPC_SERVICE = AttributeKey .stringKey ("rpc.service" );
87+
7588 @ Override
7689 public Attributes generateMetricAttributesFromSpan (SpanData span , Resource resource ) {
7790 AttributesBuilder builder = Attributes .builder ();
@@ -196,8 +209,8 @@ private static void setEgressOperation(SpanData span, AttributesBuilder builder)
196209 * <li>DB
197210 * <li>FAAS
198211 * <li>Messaging
199- * <li>GraphQL - Special case, if {@link GraphqlIncubatingAttributes #GRAPHQL_OPERATION_TYPE} is
200- * present, we use it for RemoteOperation and set RemoteService to {@link #GRAPHQL}.
212+ * <li>GraphQL - Special case, if {@link #GRAPHQL_OPERATION_TYPE} is present, we use it for
213+ * RemoteOperation and set RemoteService to {@link #GRAPHQL}.
201214 * </ul>
202215 *
203216 * <p>In each case, these span attributes were selected from the OpenTelemetry trace semantic
0 commit comments