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

Fix agent file error #34412

Merged
merged 2 commits into from
Jan 21, 2025
Merged
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
@@ -19,24 +19,25 @@

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceMethod;
import org.apache.shardingsphere.agent.plugin.core.advice.AbstractStaticMethodAdvice;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice;
import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder;

/**
* Meta data contexts factory advice.
*/
@Slf4j
public final class MetaDataContextsFactoryAdvice extends AbstractStaticMethodAdvice {
public final class MetaDataContextsFactoryAdvice extends AbstractInstanceMethodAdvice {

private final MethodTimeRecorder methodTimeRecorder = new MethodTimeRecorder(MetaDataContextsFactoryAdvice.class);

@Override
public void beforeMethod(final Class<?> clazz, final TargetAdviceMethod method, final Object[] args, final String pluginType) {
public void beforeMethod(final TargetAdviceObject target, final TargetAdviceMethod method, final Object[] args, final String pluginType) {
methodTimeRecorder.recordNow(method);
}

@Override
public void afterMethod(final Class<?> clazz, final TargetAdviceMethod method, final Object[] args, final Object result, final String pluginType) {
public void afterMethod(final TargetAdviceObject target, final TargetAdviceMethod method, final Object[] args, final Object result, final String pluginType) {
log.info("Build meta data contexts finished, cost {} milliseconds.", methodTimeRecorder.getElapsedTimeAndClean(method));
}
}
Original file line number Diff line number Diff line change
@@ -16,15 +16,11 @@
#

advisors:
- target: org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory
- target: org.apache.shardingsphere.mode.metadata.factory.MetaDataContextsFactory
advice: org.apache.shardingsphere.agent.plugin.logging.file.advice.MetaDataContextsFactoryAdvice
pointcuts:
- name: create
type: method
params:
- index: 0
type: org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService
- index: 1
type: org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter
- index: 2
type: org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext