fix recording url tag with wrong port (#6214)

This commit is contained in:
ralphgj 2021-01-18 19:49:33 +08:00 committed by GitHub
parent 4e43f227b4
commit ea8a4963a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -34,6 +34,7 @@ Release Notes.
* Fix duplicated `EnhancedInstance` interface added.
* Fix thread leaks caused by the elasticsearch-6.x-plugin plugin.
* Support reading segmentId and spanId with toolkit.
* Fix RestTemplate plugin recording url tag with wrong port
#### OAP-Backend

View File

@ -50,8 +50,8 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor
AbstractSpan span = ContextManager.createExitSpan(uri, contextCarrier, remotePeer);
span.setComponent(ComponentsDefine.SPRING_REST_TEMPLATE);
Tags.URL.set(span, requestURL.getScheme() + "://" + requestURL.getHost() + ":" + requestURL.getPort() + requestURL
.getPath());
Tags.URL.set(span, requestURL.getScheme() + "://" + requestURL.getHost() +
(requestURL.getPort() > 0 ? ":" + requestURL.getPort() : "") + requestURL.getPath());
Tags.HTTP.METHOD.set(span, httpMethod.toString());
SpanLayer.asHttp(span);
RestTemplateRuntimeContextHelper.addUri(uri);

View File

@ -46,8 +46,8 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor
AbstractSpan span = ContextManager.createExitSpan(formatURIPath, contextCarrier, remotePeer);
span.setComponent(ComponentsDefine.SPRING_REST_TEMPLATE);
Tags.URL.set(span, requestURL.getScheme() + "://" + requestURL.getHost() + ":" + requestURL.getPort() + requestURL
.getPath());
Tags.URL.set(span, requestURL.getScheme() + "://" + requestURL.getHost() +
(requestURL.getPort() > 0 ? ":" + requestURL.getPort() : "") + requestURL.getPath());
Tags.HTTP.METHOD.set(span, httpMethod.toString());
SpanLayer.asHttp(span);

View File

@ -48,7 +48,7 @@ segmentItems:
spanType: Exit
peer: github.com:443
tags:
- {key: url, value: 'https://github.com:-1/apache/skywalking'}
- {key: url, value: 'https://github.com/apache/skywalking'}
- {key: http.method, value: GET}
skipAnalysis: 'false'
- operationName: Threading/test.apache.skywalking.apm.testcase.jdk.threading.Application$TestController$1/run
@ -81,7 +81,7 @@ segmentItems:
spanType: Exit
peer: github.com:443
tags:
- {key: url, value: 'https://github.com:-1/apache/skywalking'}
- {key: url, value: 'https://github.com/apache/skywalking'}
- {key: http.method, value: GET}
skipAnalysis: 'false'
- operationName: Threading/test.apache.skywalking.apm.testcase.jdk.threading.Application$TestController$2/call