1212import io .opentelemetry .api .common .AttributeKey ;
1313import io .opentelemetry .api .common .Attributes ;
1414import io .opentelemetry .api .common .AttributesBuilder ;
15+ import io .opentelemetry .instrumentation .api .instrumenter .http .internal .HttpAttributes ;
16+ import io .opentelemetry .instrumentation .api .instrumenter .network .internal .NetworkAttributes ;
17+ import io .opentelemetry .instrumentation .api .instrumenter .url .internal .UrlAttributes ;
1518import io .opentelemetry .semconv .trace .attributes .SemanticAttributes ;
1619import java .util .HashSet ;
1720import java .util .Set ;
1821import java .util .function .BiConsumer ;
1922
20- // copied from OpenTelemetry Instrumentation 1.18 .0
23+ // copied from OpenTelemetry Instrumentation 1.29 .0
2124
2225// this is temporary, see
2326// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3962#issuecomment-906606325
@@ -35,7 +38,13 @@ private static Set<AttributeKey> buildDurationAlwaysInclude() {
3538 Set <AttributeKey > view = new HashSet <>();
3639 view .add (SemanticAttributes .HTTP_METHOD );
3740 view .add (SemanticAttributes .HTTP_STATUS_CODE ); // Optional
38- view .add (SemanticAttributes .HTTP_FLAVOR ); // Optional
41+ view .add (SemanticAttributes .NET_PROTOCOL_NAME ); // Optional
42+ view .add (SemanticAttributes .NET_PROTOCOL_VERSION ); // Optional
43+ // stable semconv
44+ view .add (HttpAttributes .HTTP_REQUEST_METHOD );
45+ view .add (HttpAttributes .HTTP_RESPONSE_STATUS_CODE );
46+ view .add (NetworkAttributes .NETWORK_PROTOCOL_NAME );
47+ view .add (NetworkAttributes .NETWORK_PROTOCOL_VERSION );
3948 return view ;
4049 }
4150
@@ -47,6 +56,10 @@ private static Set<AttributeKey> buildDurationClientView() {
4756 view .add (SemanticAttributes .NET_PEER_NAME );
4857 view .add (SemanticAttributes .NET_PEER_PORT );
4958 view .add (SemanticAttributes .NET_SOCK_PEER_ADDR );
59+ // stable semconv
60+ view .add (NetworkAttributes .SERVER_SOCKET_ADDRESS );
61+ view .add (NetworkAttributes .SERVER_ADDRESS );
62+ view .add (NetworkAttributes .SERVER_PORT );
5063 return view ;
5164 }
5265
@@ -61,6 +74,8 @@ private static Set<AttributeKey> buildDurationServerView() {
6174 view .add (SemanticAttributes .NET_HOST_NAME );
6275 view .add (SemanticAttributes .NET_HOST_PORT );
6376 view .add (SemanticAttributes .HTTP_ROUTE );
77+ // stable semconv
78+ view .add (UrlAttributes .URL_SCHEME );
6479 // START APPLICATION INSIGHTS MODIFICATIONS
6580 view .add (SemanticAttributes .USER_AGENT_ORIGINAL );
6681 // END APPLICATION INSIGHTS MODIFICATIONS
@@ -73,9 +88,11 @@ private static Set<AttributeKey> buildActiveRequestsView() {
7388 Set <AttributeKey > view = new HashSet <>();
7489 view .add (SemanticAttributes .HTTP_METHOD );
7590 view .add (SemanticAttributes .HTTP_SCHEME );
76- view .add (SemanticAttributes .HTTP_FLAVOR );
7791 view .add (SemanticAttributes .NET_HOST_NAME );
7892 view .add (SemanticAttributes .NET_HOST_PORT );
93+ // stable semconv
94+ view .add (HttpAttributes .HTTP_REQUEST_METHOD );
95+ view .add (UrlAttributes .URL_SCHEME );
7996 return view ;
8097 }
8198
0 commit comments