forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#10220] Add
profiler.uri.stat.collect.http.method
opti…
…on to collect uri statistics with http methods
- Loading branch information
Showing
30 changed files
with
271 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...rp/pinpoint/plugin/spring/web/jakarta/interceptor/ExposePathWithinMappingInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.navercorp.pinpoint.plugin.spring.web.jakarta.interceptor; | ||
|
||
import com.navercorp.pinpoint.bootstrap.context.SpanRecorder; | ||
import com.navercorp.pinpoint.bootstrap.context.Trace; | ||
import com.navercorp.pinpoint.bootstrap.context.TraceContext; | ||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor; | ||
import com.navercorp.pinpoint.bootstrap.logging.PLogger; | ||
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory; | ||
import com.navercorp.pinpoint.common.util.ArrayArgumentUtils; | ||
import com.navercorp.pinpoint.common.util.StringUtils; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
|
||
|
||
public class ExposePathWithinMappingInterceptor implements AroundInterceptor { | ||
private final PLogger logger = PLoggerFactory.getLogger(getClass()); | ||
private final TraceContext traceContext; | ||
private final Boolean uriStatCollectMethod; | ||
|
||
public ExposePathWithinMappingInterceptor(final TraceContext traceContext, Boolean uriStatCollectMethod) { | ||
this.traceContext = traceContext; | ||
this.uriStatCollectMethod = uriStatCollectMethod; | ||
} | ||
|
||
@Override | ||
public void before(Object target, Object[] args) { | ||
} | ||
|
||
@Override | ||
public void after(Object target, Object[] args, Object result, Throwable throwable) { | ||
final Trace trace = traceContext.currentRawTraceObject(); | ||
if (trace == null) { | ||
return; | ||
} | ||
|
||
try { | ||
final SpanRecorder spanRecorder = trace.getSpanRecorder(); | ||
final String url = ArrayArgumentUtils.getArgument(args, 0, String.class); | ||
if (StringUtils.hasLength(url)) { | ||
spanRecorder.recordUriTemplate(url); | ||
} | ||
|
||
if (uriStatCollectMethod) { | ||
final HttpServletRequest request = ArrayArgumentUtils.getArgument(args, 2, HttpServletRequest.class); | ||
final String method = request.getMethod(); | ||
if (StringUtils.hasLength(method)) { | ||
spanRecorder.recordUriHttpMethod(method); | ||
} | ||
} | ||
} catch (Throwable th) { | ||
if (logger.isWarnEnabled()) { | ||
logger.warn("AFTER error. Caused:{}", th.getMessage(), th); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.