mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-16 08:16:15 +10:00
[강운덕] [LUCYSUS-1744] httpclient4 interceptor에서 cookie레코딩시 데이터 사이즈를 체크하고 레코딩하도록 함.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2527 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
+6
-2
@@ -182,7 +182,10 @@ public class HttpRequestExecuteInterceptor implements SimpleAroundInterceptor, B
|
||||
private void dumpCookie(HttpRequest request, Trace trace) {
|
||||
org.apache.http.Header[] cookies = request.getHeaders("Cookie");
|
||||
for (org.apache.http.Header header: cookies) {
|
||||
trace.recordAttribute(AnnotationKey.HTTP_COOKIE, header.getValue());
|
||||
final String value = header.getValue();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
trace.recordAttribute(AnnotationKey.HTTP_COOKIE, StringUtils.drop(value, 1024));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -190,8 +193,9 @@ public class HttpRequestExecuteInterceptor implements SimpleAroundInterceptor, B
|
||||
if (request instanceof HttpEntityEnclosingRequestBase) {
|
||||
HttpEntityEnclosingRequestBase entityRequest = (HttpEntityEnclosingRequestBase) request;
|
||||
try {
|
||||
HttpEntity entity = entityRequest.getEntity();
|
||||
final HttpEntity entity = entityRequest.getEntity();
|
||||
if (entity != null && entity.isRepeatable()) {
|
||||
// entity utils의 toString시 일정 length까지만 데이터를 읽도록하는 기능이 필요함.
|
||||
String entityString = EntityUtils.toString(entityRequest.getEntity(), "UTF8");
|
||||
trace.recordAttribute(AnnotationKey.HTTP_PARAM_ENTITY, StringUtils.drop(entityString, 1024));
|
||||
}
|
||||
|
||||
+6
-2
@@ -230,7 +230,10 @@ public class HttpUriRequestExecuteInterceptor implements SimpleAroundInterceptor
|
||||
private void dumpCookie(HttpUriRequest request, Trace trace) {
|
||||
org.apache.http.Header[] cookies = request.getHeaders("Cookie");
|
||||
for (org.apache.http.Header header: cookies) {
|
||||
trace.recordAttribute(AnnotationKey.HTTP_COOKIE, StringUtils.drop(header.getValue(), 1024));
|
||||
final String value = header.getValue();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
trace.recordAttribute(AnnotationKey.HTTP_COOKIE, StringUtils.drop(value, 1024));
|
||||
}
|
||||
// Cookie값이 2개 이상일수가 있나?
|
||||
break;
|
||||
}
|
||||
@@ -240,8 +243,9 @@ public class HttpUriRequestExecuteInterceptor implements SimpleAroundInterceptor
|
||||
if (request instanceof HttpEntityEnclosingRequestBase) {
|
||||
HttpEntityEnclosingRequestBase entityRequest = (HttpEntityEnclosingRequestBase) request;
|
||||
try {
|
||||
HttpEntity entity = entityRequest.getEntity();
|
||||
final HttpEntity entity = entityRequest.getEntity();
|
||||
if (entity != null && entity.isRepeatable() && entity.getContentLength() > 0) {
|
||||
// entity utils의 toString시 일정 length까지만 데이터를 읽도록하는 기능이 필요함.
|
||||
String entityString = EntityUtils.toString(entityRequest.getEntity(), "UTF8");
|
||||
trace.recordAttribute(AnnotationKey.HTTP_PARAM_ENTITY, StringUtils.drop(entityString, 1024));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user