@@ -14,83 +14,135 @@ public class RemoteEndpointPriorityTestCase
14
14
[
15
15
new ( )
16
16
{
17
- Name = "Highest priority name = net. peer.name " ,
18
- ExpectedResult = "RemoteServiceName " ,
17
+ Name = "Rank 1: Only peer.service provided " ,
18
+ ExpectedResult = "PeerService " ,
19
19
RemoteEndpointAttributes = new Dictionary < string , object >
20
20
{
21
- [ "http.host" ] = "DiscardedRemoteServiceName" ,
22
- [ "net.peer.name" ] = "RemoteServiceName" ,
23
- [ "peer.hostname" ] = "DiscardedRemoteServiceName" ,
21
+ [ SemanticConventions . AttributePeerService ] = "PeerService" ,
24
22
} ,
25
23
} ,
26
24
new ( )
27
25
{
28
- Name = "Highest priority name = SemanticConventions.AttributePeerService " ,
29
- ExpectedResult = "RemoteServiceName " ,
26
+ Name = "Rank 2: Only server.address provided " ,
27
+ ExpectedResult = "ServerAddress " ,
30
28
RemoteEndpointAttributes = new Dictionary < string , object >
31
29
{
32
- [ SemanticConventions . AttributePeerService ] = "RemoteServiceName" ,
33
- [ "http.host" ] = "DiscardedRemoteServiceName" ,
34
- [ "net.peer.name" ] = "DiscardedRemoteServiceName" ,
35
- [ "net.peer.port" ] = "1234" ,
36
- [ "peer.hostname" ] = "DiscardedRemoteServiceName" ,
30
+ [ SemanticConventions . AttributeServerAddress ] = "ServerAddress" ,
37
31
} ,
38
32
} ,
39
33
new ( )
40
34
{
41
- Name = "Only has net.peer.name and net.peer.port " ,
42
- ExpectedResult = "RemoteServiceName:1234 " ,
35
+ Name = "Rank 3: Only net.peer.name provided " ,
36
+ ExpectedResult = "NetPeerName " ,
43
37
RemoteEndpointAttributes = new Dictionary < string , object >
44
38
{
45
- [ "net.peer.name" ] = "RemoteServiceName" ,
46
- [ "net.peer.port" ] = "1234" ,
39
+ [ SemanticConventions . AttributeNetPeerName ] = "NetPeerName" ,
47
40
} ,
48
41
} ,
49
42
new ( )
50
43
{
51
- Name = "net .peer.port is an int " ,
52
- ExpectedResult = "RemoteServiceName:1234 " ,
44
+ Name = "Rank 4: network .peer.address and network.peer.port provided " ,
45
+ ExpectedResult = "1.2.3.4:5678 " ,
53
46
RemoteEndpointAttributes = new Dictionary < string , object >
54
47
{
55
- [ "net.peer.name" ] = "RemoteServiceName " ,
56
- [ "net.peer.port" ] = 1234 ,
48
+ [ SemanticConventions . AttributeNetworkPeerAddress ] = "1.2.3.4 " ,
49
+ [ SemanticConventions . AttributeNetworkPeerPort ] = "5678" ,
57
50
} ,
58
51
} ,
59
52
new ( )
60
53
{
61
- Name = "Has net.peer.name and net .peer.port " ,
62
- ExpectedResult = "RemoteServiceName:1234 " ,
54
+ Name = "Rank 4: Only network .peer.address provided " ,
55
+ ExpectedResult = "1.2.3.4 " ,
63
56
RemoteEndpointAttributes = new Dictionary < string , object >
64
57
{
65
- [ "http.host" ] = "DiscardedRemoteServiceName" ,
66
- [ "net.peer.name" ] = "RemoteServiceName" ,
67
- [ "net.peer.port" ] = "1234" ,
68
- [ "peer.hostname" ] = "DiscardedRemoteServiceName" ,
58
+ [ SemanticConventions . AttributeNetworkPeerAddress ] = "1.2.3.4" ,
69
59
} ,
70
60
} ,
71
61
new ( )
72
62
{
73
- Name = "Has net.peer.ip and net.peer.port " ,
74
- ExpectedResult = "1.2.3.4:1234 " ,
63
+ Name = "Rank 5: Only server.socket.domain provided " ,
64
+ ExpectedResult = "SocketDomain " ,
75
65
RemoteEndpointAttributes = new Dictionary < string , object >
76
66
{
77
- [ "http.host" ] = "DiscardedRemoteServiceName" ,
78
- [ "net.peer.ip" ] = "1.2.3.4" ,
79
- [ "net.peer.port" ] = "1234" ,
80
- [ "peer.hostname" ] = "DiscardedRemoteServiceName" ,
67
+ [ SemanticConventions . AttributeServerSocketDomain ] = "SocketDomain" ,
81
68
} ,
82
69
} ,
83
70
new ( )
84
71
{
85
- Name = "Has net.peer.name, net.peer.ip, and net.peer .port" ,
86
- ExpectedResult = "RemoteServiceName:1234 " ,
72
+ Name = "Rank 6: server.socket.address and server.socket .port provided " ,
73
+ ExpectedResult = "SocketAddress:4321 " ,
87
74
RemoteEndpointAttributes = new Dictionary < string , object >
88
75
{
89
- [ "http.host" ] = "DiscardedRemoteServiceName" ,
90
- [ "net.peer.name" ] = "RemoteServiceName" ,
91
- [ "net.peer.ip" ] = "1.2.3.4" ,
92
- [ "net.peer.port" ] = "1234" ,
93
- [ "peer.hostname" ] = "DiscardedRemoteServiceName" ,
76
+ [ SemanticConventions . AttributeServerSocketAddress ] = "SocketAddress" ,
77
+ [ SemanticConventions . AttributeServerSocketPort ] = "4321" ,
78
+ } ,
79
+ } ,
80
+ new ( )
81
+ {
82
+ Name = "Rank 7: Only net.sock.peer.name provided" ,
83
+ ExpectedResult = "NetSockPeerName" ,
84
+ RemoteEndpointAttributes = new Dictionary < string , object >
85
+ {
86
+ [ SemanticConventions . AttributeNetSockPeerName ] = "NetSockPeerName" ,
87
+ } ,
88
+ } ,
89
+ new ( )
90
+ {
91
+ Name = "Rank 8: net.sock.peer.addr and net.sock.peer.port provided" ,
92
+ ExpectedResult = "5.6.7.8:8765" ,
93
+ RemoteEndpointAttributes = new Dictionary < string , object >
94
+ {
95
+ [ SemanticConventions . AttributeNetSockPeerAddr ] = "5.6.7.8" ,
96
+ [ SemanticConventions . AttributeNetSockPeerPort ] = "8765" ,
97
+ } ,
98
+ } ,
99
+ new ( )
100
+ {
101
+ Name = "Rank 9: Only peer.hostname provided" ,
102
+ ExpectedResult = "PeerHostname" ,
103
+ RemoteEndpointAttributes = new Dictionary < string , object >
104
+ {
105
+ [ SemanticConventions . AttributePeerHostname ] = "PeerHostname" ,
106
+ } ,
107
+ } ,
108
+ new ( )
109
+ {
110
+ Name = "Rank 10: Only peer.address provided" ,
111
+ ExpectedResult = "PeerAddress" ,
112
+ RemoteEndpointAttributes = new Dictionary < string , object >
113
+ {
114
+ [ SemanticConventions . AttributePeerAddress ] = "PeerAddress" ,
115
+ } ,
116
+ } ,
117
+ new ( )
118
+ {
119
+ Name = "Rank 11: Only db.name provided" ,
120
+ ExpectedResult = "DbName" ,
121
+ RemoteEndpointAttributes = new Dictionary < string , object >
122
+ {
123
+ [ SemanticConventions . AttributeDbName ] = "DbName" ,
124
+ } ,
125
+ } ,
126
+ new ( )
127
+ {
128
+ Name = "Multiple attributes: highest rank wins" ,
129
+ ExpectedResult = "PeerService" ,
130
+ RemoteEndpointAttributes = new Dictionary < string , object >
131
+ {
132
+ [ SemanticConventions . AttributeDbName ] = "DbName" ,
133
+ [ SemanticConventions . AttributePeerAddress ] = "PeerAddress" ,
134
+ [ SemanticConventions . AttributePeerHostname ] = "PeerHostname" ,
135
+ [ SemanticConventions . AttributeNetSockPeerAddr ] = "5.6.7.8" ,
136
+ [ SemanticConventions . AttributeNetSockPeerPort ] = "8765" ,
137
+ [ SemanticConventions . AttributeNetSockPeerName ] = "NetSockPeerName" ,
138
+ [ SemanticConventions . AttributeServerSocketAddress ] = "SocketAddress" ,
139
+ [ SemanticConventions . AttributeServerSocketPort ] = "4321" ,
140
+ [ SemanticConventions . AttributeServerSocketDomain ] = "SocketDomain" ,
141
+ [ SemanticConventions . AttributeNetworkPeerAddress ] = "1.2.3.4" ,
142
+ [ SemanticConventions . AttributeNetworkPeerPort ] = "5678" ,
143
+ [ SemanticConventions . AttributeNetPeerName ] = "NetPeerName" ,
144
+ [ SemanticConventions . AttributeServerAddress ] = "ServerAddress" ,
145
+ [ SemanticConventions . AttributePeerService ] = "PeerService" ,
94
146
} ,
95
147
} ,
96
148
] ;
0 commit comments