Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#noissue] Cleanup #11989

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
this.methodDescriptor = targetMethod;

if (traceKey) {
int index = findFirstString(targetMethod);
int index = ParameterUtils.findFirstString(targetMethod, 3);

Check warning on line 57 in agent-module/plugins/arcus/src/main/java/com/navercorp/pinpoint/plugin/arcus/interceptor/ApiInterceptor.java

View check run for this annotation

Codecov / codecov/patch

agent-module/plugins/arcus/src/main/java/com/navercorp/pinpoint/plugin/arcus/interceptor/ApiInterceptor.java#L57

Added line #L57 was not covered by tests

if (index != -1) {
this.traceKey = true;
Expand All @@ -69,20 +69,6 @@
}
}

private static int findFirstString(MethodDescriptor method) {
if (method == null) {
return -1;
}
final String[] methodParams = method.getParameterTypes();
final int minIndex = Math.min(methodParams.length, 3);
for (int i = 0; i < minIndex; i++) {
if ("java.lang.String".equals(methodParams[i])) {
return i;
}
}
return -1;
}

@Override
public void before(Object target, Object[] args) {
if (isDebug) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.plugin.arcus;
package com.navercorp.pinpoint.plugin.arcus.interceptor;

import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;

/**
* @author emeroad
*/
public class ParameterUtils {

public static int findFirstString(InstrumentMethod method, int maxIndex) {
public static int findFirstString(MethodDescriptor method, int maxIndex) {
if (method == null) {
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,21 @@
Objects.requireNonNull(agentStatCollector, "agentStatCollector");


long collectionIntervalMs = monitorConfig.getProfileJvmStatCollectIntervalMs();
int numCollectionsPerBatch = monitorConfig.getProfileJvmStatBatchSendCount();
this.collectionIntervalMs = getCollectionIntervalMs(monitorConfig.getProfileJvmStatCollectIntervalMs());

if (collectionIntervalMs < MIN_COLLECTION_INTERVAL_MS) {
collectionIntervalMs = DEFAULT_COLLECTION_INTERVAL_MS;
}
if (collectionIntervalMs > MAX_COLLECTION_INTERVAL_MS) {
collectionIntervalMs = DEFAULT_COLLECTION_INTERVAL_MS;
}
int numCollectionsPerBatch = monitorConfig.getProfileJvmStatBatchSendCount();
if (numCollectionsPerBatch < 1) {
numCollectionsPerBatch = DEFAULT_NUM_COLLECTIONS_PER_SEND;
}
this.collectionIntervalMs = collectionIntervalMs;

List<Runnable> runnableList = new ArrayList<>();

Runnable statCollectingJob = new CollectJob(dataSender, agentId, agentStartTimestamp, agentStatCollector, numCollectionsPerBatch);
runnableList.add(statCollectingJob);

if (monitorConfig.isCustomMetricEnable() && customMetricRegistryService != null) {
Runnable customMetricCollectionJob = new CustomMetricCollectingJob(dataSender, new AgentCustomMetricCollector(customMetricRegistryService), numCollectionsPerBatch);
AgentCustomMetricCollector agentCustomMetricCollector = new AgentCustomMetricCollector(customMetricRegistryService);
Runnable customMetricCollectionJob = new CustomMetricCollectingJob(dataSender, agentCustomMetricCollector, numCollectionsPerBatch);

Check warning on line 92 in agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java

View check run for this annotation

Codecov / codecov/patch

agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java#L91-L92

Added lines #L91 - L92 were not covered by tests
runnableList.add(customMetricCollectionJob);
}

Expand All @@ -109,6 +103,16 @@
preLoadClass(agentId, agentStartTimestamp, agentStatCollector);
}

private long getCollectionIntervalMs(long collectionIntervalMs) {
if (collectionIntervalMs < MIN_COLLECTION_INTERVAL_MS) {
collectionIntervalMs = DEFAULT_COLLECTION_INTERVAL_MS;

Check warning on line 108 in agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java

View check run for this annotation

Codecov / codecov/patch

agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java#L108

Added line #L108 was not covered by tests
}
if (collectionIntervalMs > MAX_COLLECTION_INTERVAL_MS) {
collectionIntervalMs = DEFAULT_COLLECTION_INTERVAL_MS;

Check warning on line 111 in agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java

View check run for this annotation

Codecov / codecov/patch

agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultAgentStatMonitor.java#L111

Added line #L111 was not covered by tests
}
return collectionIntervalMs;
}

// https://github.com/naver/pinpoint/issues/2881
// #2881 AppClassLoader and PinpointUrlClassLoader Circular dependency deadlock
// prevent deadlock for JDK6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class IdValidateUtils {
@Deprecated
public static String STABLE_VERSION_PATTERN_VALUE = AgentVersionPostfix.STABLE_VERSION_PATTERN_STRING;

public static final String ID_PATTERN_VALUE = "[a-zA-Z0-9._\\-]+";;
public static final String ID_PATTERN_VALUE = "[a-zA-Z0-9._\\-]+";
private static final Pattern ID_PATTERN = Pattern.compile(ID_PATTERN_VALUE);

private IdValidateUtils() {
Expand Down
Loading