@@ -33,17 +33,17 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
3333 def decorator = newDecorator()
3434
3535 when :
36- decorator. onRequest(span, null , req, null )
36+ decorator. onRequest(this . span, null , req, null )
3737
3838 then :
3939 if (req) {
40- 1 * span. setTag(Tags . HTTP_METHOD , " test-method" )
41- 1 * span. setTag(DDTags . HTTP_QUERY , _)
42- 1 * span. setTag(DDTags . HTTP_FRAGMENT , _)
43- 1 * span. setTag(Tags . HTTP_URL , url)
44- 1 * span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
45- 1 * span. getRequestContext()
46- 1 * span. setResourceName({ it as String == req. method. toUpperCase() + " " + req. path }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
40+ 1 * this . span. setTag(Tags . HTTP_METHOD , " test-method" )
41+ 1 * this . span. setTag(DDTags . HTTP_QUERY , _)
42+ 1 * this . span. setTag(DDTags . HTTP_FRAGMENT , _)
43+ 1 * this . span. setTag(Tags . HTTP_URL , url)
44+ 1 * this . span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
45+ 1 * this . span. getRequestContext()
46+ 1 * this . span. setResourceName({ it as String == req. method. toUpperCase() + " " + req. path }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
4747 }
4848 0 * _
4949
@@ -63,26 +63,26 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
6363 def decorator = newDecorator()
6464
6565 when :
66- decorator. onRequest(span, null , req, null )
66+ decorator. onRequest(this . span, null , req, null )
6767
6868 then :
6969 if (expectedUrl) {
70- 1 * span. setTag(Tags . HTTP_URL , expectedUrl)
71- 1 * span. getRequestContext()
70+ 1 * this . span. setTag(Tags . HTTP_URL , expectedUrl)
71+ 1 * this . span. getRequestContext()
7272 }
7373 if (expectedUrl && tagQueryString) {
74- 1 * span. setTag(DDTags . HTTP_QUERY , expectedQuery)
75- 1 * span. setTag(DDTags . HTTP_FRAGMENT , expectedFragment)
74+ 1 * this . span. setTag(DDTags . HTTP_QUERY , expectedQuery)
75+ 1 * this . span. setTag(DDTags . HTTP_FRAGMENT , expectedFragment)
7676 }
7777 if (url != null ) {
78- 1 * span. setResourceName({ it as String == expectedPath }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
78+ 1 * this . span. setResourceName({ it as String == expectedPath }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
7979 if (req. url. host != null ) {
80- 1 * span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
80+ 1 * this . span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
8181 }
8282 } else {
83- 1 * span. setResourceName({ it as String == expectedPath })
83+ 1 * this . span. setResourceName({ it as String == expectedPath })
8484 }
85- 1 * span. setTag(Tags . HTTP_METHOD , null )
85+ 1 * this . span. setTag(Tags . HTTP_METHOD , null )
8686 0 * _
8787
8888 where :
@@ -112,16 +112,16 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
112112 def decorator = newDecorator()
113113
114114 when :
115- decorator. onRequest(span, null , req, null )
115+ decorator. onRequest(this . span, null , req, null )
116116
117117 then :
118- 1 * span. setTag(Tags . HTTP_URL , expectedUrl)
119- 1 * span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
120- 1 * span. setTag(DDTags . HTTP_QUERY , expectedQuery)
121- 1 * span. setTag(DDTags . HTTP_FRAGMENT , null )
122- 1 * span. getRequestContext()
123- 1 * span. setResourceName({ it as String == expectedResource }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
124- 1 * span. setTag(Tags . HTTP_METHOD , null )
118+ 1 * this . span. setTag(Tags . HTTP_URL , expectedUrl)
119+ 1 * this . span. setTag(Tags . HTTP_HOSTNAME , req. url. host)
120+ 1 * this . span. setTag(DDTags . HTTP_QUERY , expectedQuery)
121+ 1 * this . span. setTag(DDTags . HTTP_FRAGMENT , null )
122+ 1 * this . span. getRequestContext()
123+ 1 * this . span. setResourceName({ it as String == expectedResource }, ResourceNamePriorities . HTTP_PATH_NORMALIZER )
124+ 1 * this . span. setTag(Tags . HTTP_METHOD , null )
125125 0 * _
126126
127127 where :
@@ -140,7 +140,7 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
140140 def decorator = newDecorator()
141141
142142 when :
143- decorator. onRequest(span, conn, null , ctx)
143+ decorator. onRequest(this . span, conn, null , ctx)
144144
145145 then :
146146 _ * ctx. getForwarded() >> null
@@ -159,20 +159,20 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
159159 _ * ctx. getTrueClientIp() >> null
160160 _ * ctx. getVia() >> null
161161 if (conn) {
162- 1 * span. setTag(Tags . PEER_PORT , 555 )
162+ 1 * this . span. setTag(Tags . PEER_PORT , 555 )
163163 if (ipv4) {
164- 1 * span. setTag(Tags . PEER_HOST_IPV4 , " 10.0.0.1" )
165- 1 * span. setTag(Tags . HTTP_CLIENT_IP , " 10.0.0.1" )
164+ 1 * this . span. setTag(Tags . PEER_HOST_IPV4 , " 10.0.0.1" )
165+ 1 * this . span. setTag(Tags . HTTP_CLIENT_IP , " 10.0.0.1" )
166166 } else if (ipv4 != null ) {
167- 1 * span. setTag(Tags . PEER_HOST_IPV6 , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
168- 1 * span. setTag(Tags . HTTP_CLIENT_IP , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
167+ 1 * this . span. setTag(Tags . PEER_HOST_IPV6 , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
168+ 1 * this . span. setTag(Tags . HTTP_CLIENT_IP , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
169169 }
170170 }
171- _ * span. getRequestContext() >> null
171+ _ * this . span. getRequestContext() >> null
172172 0 * _
173173
174174 when :
175- decorator. onRequest(span, conn, null , ctx)
175+ decorator. onRequest(this . span, conn, null , ctx)
176176
177177 then :
178178 _ * ctx. getForwarded() >> " by=<identifier>;for=<identifier>;host=<host>;proto=<http|https>"
@@ -190,27 +190,27 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
190190 _ * ctx. getCustomIpHeader() >> null
191191 _ * ctx. getTrueClientIp() >> null
192192 _ * ctx. getVia() >> null
193- 1 * span. setTag(Tags . HTTP_FORWARDED , " by=<identifier>;for=<identifier>;host=<host>;proto=<http|https>" )
194- 1 * span. setTag(Tags . HTTP_FORWARDED_PROTO , " https" )
195- 1 * span. setTag(Tags . HTTP_FORWARDED_HOST , " somehost" )
193+ 1 * this . span. setTag(Tags . HTTP_FORWARDED , " by=<identifier>;for=<identifier>;host=<host>;proto=<http|https>" )
194+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_PROTO , " https" )
195+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_HOST , " somehost" )
196196 if (ipv4) {
197- 1 * span. setTag(Tags . HTTP_FORWARDED_IP , " 10.1.1.1, 192.168.1.1" )
198- 1 * span. setTag(Tags . PEER_HOST_IPV4 , " 10.0.0.1" )
197+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_IP , " 10.1.1.1, 192.168.1.1" )
198+ 1 * this . span. setTag(Tags . PEER_HOST_IPV4 , " 10.0.0.1" )
199199 } else if (conn?. ip) {
200- 1 * span. setTag(Tags . HTTP_FORWARDED_IP , " 0::1" )
201- 1 * span. setTag(Tags . PEER_HOST_IPV6 , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
200+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_IP , " 0::1" )
201+ 1 * this . span. setTag(Tags . PEER_HOST_IPV6 , " 3ffe:1900:4545:3:200:f8ff:fe21:67cf" )
202202 } else {
203- 1 * span. setTag(Tags . HTTP_FORWARDED_IP , " 0::1" )
203+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_IP , " 0::1" )
204204 }
205- 1 * span. setTag(Tags . HTTP_FORWARDED_PORT , " 123" )
205+ 1 * this . span. setTag(Tags . HTTP_FORWARDED_PORT , " 123" )
206206 if (conn) {
207- 1 * span. setTag(Tags . PEER_PORT , 555 )
207+ 1 * this . span. setTag(Tags . PEER_PORT , 555 )
208208 if (conn. ip) {
209- 1 * span. setTag(Tags . HTTP_CLIENT_IP , conn. ip)
209+ 1 * this . span. setTag(Tags . HTTP_CLIENT_IP , conn. ip)
210210 }
211211 }
212- 1 * span. setTag(Tags . HTTP_USER_AGENT , " some-user-agent" )
213- _ * span. getRequestContext() >> null
212+ 1 * this . span. setTag(Tags . HTTP_USER_AGENT , " some-user-agent" )
213+ _ * this . span. getRequestContext() >> null
214214 0 * _
215215
216216 where :
@@ -226,20 +226,20 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
226226 def decorator = newDecorator()
227227
228228 when :
229- decorator. onResponse(span, resp)
229+ decorator. onResponse(this . span, resp)
230230
231231 then :
232232 if (status) {
233- 1 * span. setHttpStatusCode(status)
233+ 1 * this . span. setHttpStatusCode(status)
234234 }
235235 if (error) {
236- 1 * span. setError(true )
236+ 1 * this . span. setError(true )
237237 }
238238 if (status == 404 ) {
239- 1 * span. setResourceName({ it as String == " 404" }, ResourceNamePriorities . HTTP_404 )
239+ 1 * this . span. setResourceName({ it as String == " 404" }, ResourceNamePriorities . HTTP_404 )
240240 }
241241 if (resp) {
242- 1 * span. getRequestContext()
242+ 1 * this . span. getRequestContext()
243243 }
244244 0 * _
245245
0 commit comments