pinpoint
pinpoint copied to clipboard
make netty direct buffer memory metric
boolean directBufferPreferred = io.netty.util.internal.PlatformDependent.directBufferPreferred();
long usedDirectMemory = io.netty.util.internal.PlatformDependent.usedDirectMemory();
long maxDirectMemory = io.netty.util.internal.PlatformDependent.maxDirectMemory();
cf) if below option is true, directBufferPreferred value is false.
-Dio.netty.noPreferDirect=true
hi @yangbongsoo
It is impossible to develop this function under the present situation. Each data in Inspector page are based on the data that most of the agent have. Data that this function will show is depended on Netty. Therefore, Pinpoint needs to develop additional features to support this function.
I will give you the instructions you need to create it, after creating a new feature.
thanks :)
@yangbongsoo
Please record the data that needs to be collected periodically as follows.
I am not sure how to make it ideal for implementation. So, I let records save with permisson.
I have defined two AllowedSources for you.
private static final AllowedSource<LongCounter> NETTY_USED_DIRECT_MEMORY = new AllowedSource<LongCounter>("custom/netty/usedDirectMemory", LongCounter.class);
private static final AllowedSource<LongCounter> NETTY_MAX_DIRECT_MEMORY = new AllowedSource<LongCounter>("custom/netty/maxDirectMemory ", LongCounter.class);
Registration
Add CustomMetricRegistry customMetricMonitorRegistry
in constructor of Interceptor.
Ex)
- before
public StandardHostValveInvokeInterceptor(TraceContext traceContext, MethodDescriptor descriptor, RequestRecorderFactory<HttpServletRequest> requestRecorderFactory) {
- after
public StandardHostValveInvokeInterceptor(TraceContext traceContext, MethodDescriptor descriptor, RequestRecorderFactory<HttpServletRequest> requestRecorderFactory, CustomMetricRegistry customMetricMonitorRegistry) {
Implemetation
Include a method that periodically returns the value that needs to be extracted by implementing the LongCounter interface.
Ex)
private UsedDirectMemoryCounter implements LongCounter {
private final String name;
public UsedDirectMemoryCounter(String name) {
this.name = name;
}
@Override
public long getValue() {
// to make your own code.
}
@Override
public String getName() {
return name;
}
}
If you send Pull-Request, I will check it. Still, the collector and the web are being implemented, so even if you add them, the desired data may not be immediately visible.
thanks :)