exception-ignore-plugin (#5426)

This commit is contained in:
Evan 2020-09-09 15:07:01 +08:00 committed by GitHub
parent 1b5dd9b3f3
commit 29de696c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
250 changed files with 2756 additions and 249 deletions

View File

@ -47,6 +47,8 @@ jobs:
- { name: 'elasticsearch-5.x-scenario', title: 'ElasticSearch 5.x (3)' }
- { name: 'elasticsearch-6.x-scenario', title: 'ElasticSearch 6.7.1-6.8.4 (7)' }
- { name: 'elasticsearch-7.x-scenario', title: 'ElasticSearch 7.0.0-7.5.2 (14)' }
- { name: 'exception-checker-spring-scenario', title: 'SpringBoot exception checker 1.0.0 (1)' }
- { name: 'exception-checker-tomcat-scenario', title: 'Tomcat exception checker 1.0.0 (1)' }
- { name: 'feign-scenario', title: 'Feign 9.0.0-9.5.1 (8)' }
- { name: 'finagle-17.10.x-scenario', title: 'Finagle 17.10.0-20.1.0(19)' }
- { name: 'finagle-6.25.x-scenario', title: 'Finagle 6.25.0-6.43.0 (18)' }

View File

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.toolkit.trace;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* After the exception status checker activated in the agent, the span wouldn't be marked as error status if the
* exception has this annotation.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface IgnoredException {
}

View File

@ -20,7 +20,6 @@ package org.apache.skywalking.apm.agent.core.conf;
import java.util.HashMap;
import java.util.Map;
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
import org.apache.skywalking.apm.agent.core.logging.core.LogLevel;
import org.apache.skywalking.apm.agent.core.logging.core.LogOutput;
@ -268,6 +267,21 @@ public class Config {
public static String PATTERN = "%level %timestamp %thread %class : %msg %throwable";
}
public static class StatusCheck {
/**
* Listed exceptions would not be treated as an error. Because in some codes, the exception is being used as a
* way of controlling business flow.
*/
public static String IGNORED_EXCEPTIONS = "";
/**
* The max recursive depth when checking the exception traced by the agent. Typically, we don't recommend
* setting this more than 10, which could cause a performance issue. Negative value and 0 would be ignored,
* which means all exceptions would make the span tagged in error status.
*/
public static Integer MAX_RECURSIVE_DEPTH = 1;
}
public static class Plugin {
/**
* Control the length of the peer field.

View File

@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
/**
* AnnotationMatchExceptionCheckStrategy does an annotation matching check for a traced exception. If it has been
* annotated with org.apache.skywalking.apm.toolkit.trace.IgnoredException, the error status of the span wouldn't be
* changed. Because of the annotation supports integration, the subclasses would be also annotated with it.
*/
public class AnnotationMatchExceptionCheckStrategy implements ExceptionCheckStrategy {
private static final String TAG_NAME = AnnotationMatchExceptionCheckStrategy.class.getSimpleName();
@Override
public boolean isError(final Throwable e) {
return !(e instanceof EnhancedInstance) || !TAG_NAME.equals(((EnhancedInstance) e).getSkyWalkingDynamicField());
}
}

View File

@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* ExceptionCheckContext contains the exceptions that have been checked by the exceptionCheckStrategies.
*/
public enum ExceptionCheckContext {
INSTANCE;
private final Set<Class<? extends Throwable>> ignoredExceptions = ConcurrentHashMap.newKeySet(32);
private final Set<Class<? extends Throwable>> errorStatusExceptions = ConcurrentHashMap.newKeySet(128);
public boolean isChecked(Throwable throwable) {
return ignoredExceptions.contains(throwable.getClass()) || errorStatusExceptions.contains(throwable.getClass());
}
public boolean isError(Throwable throwable) {
Class<? extends Throwable> clazz = throwable.getClass();
return errorStatusExceptions.contains(clazz) || (!ignoredExceptions.contains(clazz));
}
public void registerIgnoredException(Throwable throwable) {
ignoredExceptions.add(throwable.getClass());
}
public void registerErrorStatusException(Throwable throwable) {
errorStatusExceptions.add(throwable.getClass());
}
}

View File

@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
/**
* The strategy checks the status of exception traced in a span.
*/
public interface ExceptionCheckStrategy {
boolean isError(Throwable e);
}

View File

@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
/**
* HierarchyMatchExceptionCheckStrategy does a hierarchy check for a traced exception. If it or its parent has been
* listed in org.apache.skywalking.apm.agent.core.conf.Config.StatusCheck#IGNORED_EXCEPTIONS, the error status of the
* span wouldn't be changed.
*/
public class HierarchyMatchExceptionCheckStrategy implements ExceptionCheckStrategy {
@Override
public boolean isError(final Throwable e) {
Class<? extends Throwable> clazz = e.getClass();
StatusCheckService statusTriggerService = ServiceManager.INSTANCE.findService(StatusCheckService.class);
String[] ignoredExceptionNames = statusTriggerService.getIgnoredExceptionNames();
for (final String ignoredExceptionName : ignoredExceptionNames) {
try {
Class<?> parentClazz = Class.forName(ignoredExceptionName, true, clazz.getClassLoader());
if (parentClazz.isAssignableFrom(clazz)) {
return false;
}
} catch (ClassNotFoundException ignore) {
}
}
return true;
}
}

View File

@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
/**
* All exceptions would make the span tagged as the error status.
*/
public class OffExceptionCheckStrategy implements ExceptionCheckStrategy {
@Override
public boolean isError(final Throwable e) {
return true;
}
}

View File

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Arrays;
import lombok.Getter;
import org.apache.skywalking.apm.agent.core.boot.BootService;
import org.apache.skywalking.apm.agent.core.boot.DefaultImplementor;
import org.apache.skywalking.apm.agent.core.conf.Config;
import org.apache.skywalking.apm.util.StringUtil;
import static org.apache.skywalking.apm.agent.core.context.status.StatusChecker.HIERARCHY_MATCH;
import static org.apache.skywalking.apm.agent.core.context.status.StatusChecker.OFF;
/**
* The <code>StatusCheckService</code> determines whether the span should be tagged in error status if an exception
* captured in the scope.
*/
@DefaultImplementor
public class StatusCheckService implements BootService {
@Getter
private String[] ignoredExceptionNames;
private StatusChecker statusChecker;
@Override
public void prepare() throws Throwable {
ignoredExceptionNames = Arrays.stream(Config.StatusCheck.IGNORED_EXCEPTIONS.split(","))
.filter(StringUtil::isNotEmpty)
.toArray(String[]::new);
statusChecker = Config.StatusCheck.MAX_RECURSIVE_DEPTH > 0 ? HIERARCHY_MATCH : OFF;
}
@Override
public void boot() throws Throwable {
}
@Override
public void onComplete() throws Throwable {
}
@Override
public void shutdown() throws Throwable {
}
public boolean isError(Throwable e) {
return statusChecker.checkStatus(e);
}
}

View File

@ -0,0 +1,90 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.AllArgsConstructor;
import org.apache.skywalking.apm.agent.core.conf.Config;
@AllArgsConstructor
public enum StatusChecker {
/**
* All exceptions would make the span tagged as the error status.
*/
OFF(
Collections.singletonList(new OffExceptionCheckStrategy()),
(isError, throwable) -> {
}
),
/**
* Hierarchy check the status of the traced exception.
*
* @see HierarchyMatchExceptionCheckStrategy
* @see AnnotationMatchExceptionCheckStrategy
*/
HIERARCHY_MATCH(
Arrays.asList(
new HierarchyMatchExceptionCheckStrategy(),
new AnnotationMatchExceptionCheckStrategy()
),
(isError, throwable) -> {
if (isError) {
ExceptionCheckContext.INSTANCE.registerErrorStatusException(throwable);
} else {
ExceptionCheckContext.INSTANCE.registerIgnoredException(throwable);
}
}
);
private final List<ExceptionCheckStrategy> strategies;
private final ExceptionCheckCallback callback;
public boolean checkStatus(Throwable e) {
int maxDepth = Config.StatusCheck.MAX_RECURSIVE_DEPTH;
boolean isError = true;
while (isError && Objects.nonNull(e) && maxDepth-- > 0) {
isError = check(e);
e = e.getCause();
}
return isError;
}
private boolean check(final Throwable e) {
boolean isError = ExceptionCheckContext.INSTANCE.isChecked(e)
? ExceptionCheckContext.INSTANCE.isError(e)
: strategies.stream().allMatch(item -> item.isError(e));
callback.onChecked(isError, e);
return isError;
}
/**
* The callback function would be triggered after an exception is checked by StatusChecker.
*/
@FunctionalInterface
private interface ExceptionCheckCallback {
void onChecked(Boolean isError, Throwable throwable);
}
}

View File

@ -22,8 +22,10 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.TracingContext;
import org.apache.skywalking.apm.agent.core.context.status.StatusCheckService;
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
@ -163,6 +165,9 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
if (logs == null) {
logs = new LinkedList<>();
}
if (!errorOccurred && ServiceManager.INSTANCE.findService(StatusCheckService.class).isError(t)) {
errorOccurred();
}
logs.add(new LogDataEntity.Builder().add(new KeyValuePair("event", "error"))
.add(new KeyValuePair("error.kind", t.getClass().getName()))
.add(new KeyValuePair("message", t.getMessage()))

View File

@ -30,4 +30,5 @@ org.apache.skywalking.apm.agent.core.profile.ProfileTaskChannelService
org.apache.skywalking.apm.agent.core.profile.ProfileSnapshotSender
org.apache.skywalking.apm.agent.core.profile.ProfileTaskExecutionService
org.apache.skywalking.apm.agent.core.meter.MeterService
org.apache.skywalking.apm.agent.core.meter.MeterSender
org.apache.skywalking.apm.agent.core.meter.MeterSender
org.apache.skywalking.apm.agent.core.context.status.StatusCheckService

View File

@ -58,7 +58,7 @@ public class ServiceManagerTest {
public void testServiceDependencies() throws Exception {
HashMap<Class, BootService> registryService = getFieldValue(ServiceManager.INSTANCE, "bootedServices");
assertThat(registryService.size(), is(15));
assertThat(registryService.size(), is(16));
assertTraceSegmentServiceClient(ServiceManager.INSTANCE.findService(TraceSegmentServiceClient.class));
assertContextManager(ServiceManager.INSTANCE.findService(ContextManager.class));

View File

@ -122,7 +122,6 @@ public class ContextManagerTest {
ContextCarrier injectContextCarrier = new ContextCarrier();
AbstractSpan exitSpan = ContextManager.createExitSpan("/textExitSpan", injectContextCarrier, "127.0.0.1:12800");
exitSpan.errorOccurred();
exitSpan.log(new RuntimeException("exception"));
exitSpan.setComponent(ComponentsDefine.HTTPCLIENT);
@ -238,7 +237,6 @@ public class ContextManagerTest {
ContextCarrier injectContextCarrier = new ContextCarrier();
AbstractSpan exitSpan = ContextManager.createExitSpan("/textExitSpan", injectContextCarrier, "127.0.0.1:12800");
exitSpan.errorOccurred();
exitSpan.log(new RuntimeException("exception"));
exitSpan.setComponent(ComponentsDefine.HTTPCLIENT);
SpanLayer.asHttp(exitSpan);

View File

@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Set;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
import org.apache.skywalking.apm.agent.core.conf.Config;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.support.membermodification.MemberModifier;
public class ExceptionCheckStrategyTest {
@Before
public void prepare() {
Config.StatusCheck.IGNORED_EXCEPTIONS = "org.apache.skywalking.apm.agent.core.context.status.TestNamedMatchException";
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 1;
ServiceManager.INSTANCE.boot();
}
@After
public void after() throws IllegalAccessException {
((Set) MemberModifier
.field(ExceptionCheckContext.class, "ignoredExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
((Set) MemberModifier
.field(ExceptionCheckContext.class, "errorStatusExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
}
@Test
public void checkOffExceptionCheckStrategy() {
OffExceptionCheckStrategy offExceptionCheckStrategy = new OffExceptionCheckStrategy();
Assert.assertTrue(offExceptionCheckStrategy.isError(new TestHierarchyMatchException()));
}
@Test
public void checkInheriteMatchExceptionCheckStrategy() {
HierarchyMatchExceptionCheckStrategy hierarchyMatchExceptionCheckStrategy = new HierarchyMatchExceptionCheckStrategy();
Assert.assertFalse(hierarchyMatchExceptionCheckStrategy.isError(new TestNamedMatchException()));
Assert.assertFalse(hierarchyMatchExceptionCheckStrategy.isError(new TestHierarchyMatchException()));
Assert.assertTrue(hierarchyMatchExceptionCheckStrategy.isError(new TestAnnotationMatchException()));
}
@Test
public void checkAnnotationMatchExceptionCheckStrategy() {
AnnotationMatchExceptionCheckStrategy annotationMatchExceptionCheckStrategy = new AnnotationMatchExceptionCheckStrategy();
Assert.assertFalse(annotationMatchExceptionCheckStrategy.isError(new TestAnnotationMatchException()));
Assert.assertTrue(annotationMatchExceptionCheckStrategy.isError(new TestHierarchyMatchException()));
}
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Set;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
import org.apache.skywalking.apm.agent.core.conf.Config;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.support.membermodification.MemberModifier;
public class StatusCheckServiceCheckTest {
private Exception exception1;
private Exception exception2;
private Exception exception3;
@Before
public void prepare() {
Config.StatusCheck.IGNORED_EXCEPTIONS = "org.apache.skywalking.apm.agent.core.context.status.TestNamedMatchException";
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 1;
ServiceManager.INSTANCE.boot();
exception1 = new TestNamedMatchException();
exception2 = new IllegalArgumentException(exception1);
exception3 = new IllegalArgumentException(exception2);
}
@After
public void after() throws IllegalAccessException {
((Set) MemberModifier
.field(ExceptionCheckContext.class, "ignoredExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
((Set) MemberModifier
.field(ExceptionCheckContext.class, "errorStatusExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
}
@Test
public void testDepth_1() {
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 1;
StatusCheckService service = ServiceManager.INSTANCE.findService(StatusCheckService.class);
Assert.assertFalse(service.isError(exception1));
Assert.assertTrue(service.isError(exception2));
Assert.assertTrue(service.isError(exception3));
}
@Test
public void testDepth_2() {
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 2;
StatusCheckService service = ServiceManager.INSTANCE.findService(StatusCheckService.class);
Assert.assertFalse(service.isError(exception1));
Assert.assertFalse(service.isError(exception2));
Assert.assertTrue(service.isError(exception3));
}
@Test
public void testDepth_3() {
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 3;
StatusCheckService service = ServiceManager.INSTANCE.findService(StatusCheckService.class);
Assert.assertFalse(service.isError(exception1));
Assert.assertFalse(service.isError(exception2));
Assert.assertFalse(service.isError(exception3));
}
}

View File

@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import java.util.Set;
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
import org.apache.skywalking.apm.agent.core.conf.Config;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.support.membermodification.MemberModifier;
import static org.apache.skywalking.apm.agent.core.context.status.StatusChecker.HIERARCHY_MATCH;
import static org.apache.skywalking.apm.agent.core.context.status.StatusChecker.OFF;
public class StatusCheckerTest {
@Before
public void prepare() {
Config.StatusCheck.IGNORED_EXCEPTIONS = "org.apache.skywalking.apm.agent.core.context.status.TestNamedMatchException";
Config.StatusCheck.MAX_RECURSIVE_DEPTH = 1;
ServiceManager.INSTANCE.boot();
}
@After
public void after() throws IllegalAccessException {
((Set) MemberModifier
.field(ExceptionCheckContext.class, "ignoredExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
((Set) MemberModifier
.field(ExceptionCheckContext.class, "errorStatusExceptions")
.get(ExceptionCheckContext.INSTANCE)).clear();
}
@Test
public void checkOffStatusChecker() {
Assert.assertTrue(OFF.checkStatus(new Throwable()));
Assert.assertTrue(OFF.checkStatus(new TestHierarchyMatchException()));
Assert.assertTrue(OFF.checkStatus(new TestNamedMatchException()));
Assert.assertTrue(OFF.checkStatus(new IllegalArgumentException()));
}
@Test
public void checkInheritNamedAndAnnotationMatchStatusChecker() throws IllegalAccessException {
Assert.assertTrue(HIERARCHY_MATCH.checkStatus(new Throwable()));
Assert.assertTrue(HIERARCHY_MATCH.checkStatus(new IllegalArgumentException()));
Assert.assertFalse(HIERARCHY_MATCH.checkStatus(new TestNamedMatchException()));
Assert.assertFalse(HIERARCHY_MATCH.checkStatus(new TestHierarchyMatchException()));
Assert.assertFalse(HIERARCHY_MATCH.checkStatus(new TestAnnotationMatchException()));
Set ignoredExceptions = (Set) MemberModifier
.field(ExceptionCheckContext.class, "ignoredExceptions")
.get(ExceptionCheckContext.INSTANCE);
Set errorStatusExceptions = (Set) MemberModifier
.field(ExceptionCheckContext.class, "errorStatusExceptions")
.get(ExceptionCheckContext.INSTANCE);
Assert.assertTrue(ignoredExceptions.size() > 0);
Assert.assertTrue(errorStatusExceptions.size() > 0);
}
}

View File

@ -0,0 +1,56 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
public class TestAnnotationMatchException extends RuntimeException implements EnhancedInstance {
public TestAnnotationMatchException() {
}
public TestAnnotationMatchException(final String message) {
super(message);
}
public TestAnnotationMatchException(final String message, final Throwable cause) {
super(message, cause);
}
public TestAnnotationMatchException(final Throwable cause) {
super(cause);
}
public TestAnnotationMatchException(final String message,
final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
@Override
public Object getSkyWalkingDynamicField() {
return AnnotationMatchExceptionCheckStrategy.class.getSimpleName();
}
@Override
public void setSkyWalkingDynamicField(final Object value) {
}
}

View File

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
public class TestHierarchyMatchException extends TestNamedMatchException {
public TestHierarchyMatchException() {
}
public TestHierarchyMatchException(final String message) {
super(message);
}
public TestHierarchyMatchException(final String message, final Throwable cause) {
super(message, cause);
}
public TestHierarchyMatchException(final Throwable cause) {
super(cause);
}
public TestHierarchyMatchException(final String message,
final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.agent.core.context.status;
public class TestNamedMatchException extends RuntimeException {
public TestNamedMatchException() {
}
public TestNamedMatchException(final String message) {
super(message);
}
public TestNamedMatchException(final String message, final Throwable cause) {
super(message, cause);
}
public TestNamedMatchException(final Throwable cause) {
super(cause);
}
public TestNamedMatchException(final String message,
final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -88,6 +88,6 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -80,6 +80,6 @@ public class ActiveMQProducerInterceptor implements InstanceMethodsAroundInterce
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -87,7 +87,7 @@ public class Armeria084ClientInterceptor implements InstanceMethodsAroundInterce
public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, final Throwable t) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -68,7 +68,7 @@ public class Armeria084ServerInterceptor implements InstanceMethodsAroundInterce
public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, final Throwable t) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -68,7 +68,7 @@ public class Armeria085ServerInterceptor implements InstanceMethodsAroundInterce
public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, final Throwable t) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -73,7 +73,7 @@ public abstract class ArmeriaClientInterceptor implements InstanceMethodsAroundI
public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, final Throwable t) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -64,7 +64,7 @@ public abstract class AbstractRequestInterceptor implements InstanceConstructorI
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -56,7 +56,7 @@ public class ResponderInterceptor implements InstanceConstructorInterceptor, Ins
public void handleMethodException(EnhancedInstance enhancedInstance, Method method, Object[] objects,
Class<?>[] classes, Throwable throwable) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(throwable);
ContextManager.activeSpan().log(throwable);
}
}
}

View File

@ -74,7 +74,6 @@ public class ClientInterceptor implements InstanceMethodsAroundInterceptor {
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}

View File

@ -60,7 +60,6 @@ public class ServerInterceptor implements InstanceMethodsAroundInterceptor {
if (response != null && response.getException() != null) {
AbstractSpan span = ContextManager.activeSpan();
span.log(response.getException());
span.errorOccurred();
}
ContextManager.stopSpan();
@ -71,7 +70,6 @@ public class ServerInterceptor implements InstanceMethodsAroundInterceptor {
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}

View File

@ -78,6 +78,6 @@ public class CanalInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -50,7 +50,6 @@ public class ClusterConnectInterceptor implements InstanceMethodsAroundIntercept
Class<?>[] argumentsTypes, Throwable t) {
if (ContextManager.isActive()) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}
}

View File

@ -53,7 +53,6 @@ public class DefaultResultSetFutureGetUninterruptiblyInterceptor implements Inst
Class<?>[] argumentsTypes, Throwable t) {
if (ContextManager.isActive()) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}
}

View File

@ -77,7 +77,6 @@ public class SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor imp
Class<?>[] argumentsTypes, Throwable t) {
if (ContextManager.isActive()) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}
}

View File

@ -126,7 +126,6 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
*/
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}

View File

@ -113,7 +113,6 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
*/
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}

View File

@ -61,6 +61,6 @@ public class EhcacheLockInterceptor implements InstanceMethodsAroundInterceptor
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -50,6 +50,6 @@ public class EhcacheOperateAllInterceptor implements InstanceMethodsAroundInterc
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -57,6 +57,6 @@ public class EhcacheOperateElementInterceptor implements InstanceMethodsAroundIn
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -56,6 +56,6 @@ public class EhcacheOperateObjectInterceptor implements InstanceMethodsAroundInt
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -68,6 +68,6 @@ public class JobExecutorInterceptor implements InstanceMethodsAroundInterceptor
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -55,6 +55,6 @@ public class ElasticJobExecutorInterceptor implements InstanceMethodsAroundInter
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -66,6 +66,6 @@ public class PlainListenableActionFutureInterceptor implements InstanceMethodsAr
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -71,7 +71,7 @@ public class TransportActionNodeProxyInterceptor implements InstanceConstructorI
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
@Override

View File

@ -71,7 +71,7 @@ public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceM
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
private boolean isTrace(EnhancedInstance objInst) {

View File

@ -18,8 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -31,6 +29,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class ClusterClientGetSettingsMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
@ -62,7 +62,7 @@ public class ClusterClientGetSettingsMethodsInterceptor implements InstanceMetho
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
if (restClientEnhanceInfo != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -18,8 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -31,6 +29,8 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class ClusterClientHealthMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
@ -61,7 +61,7 @@ public class ClusterClientHealthMethodsInterceptor implements InstanceMethodsAro
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
if (restClientEnhanceInfo != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -34,6 +31,9 @@ import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.common.settings.Settings;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class ClusterClientPutSettingsMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
@ -80,7 +80,7 @@ public class ClusterClientPutSettingsMethodsInterceptor implements InstanceMetho
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
if (restClientEnhanceInfo != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -33,6 +30,9 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.client.indices.CreateIndexRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class IndicesClientCreateMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -70,7 +70,7 @@ public class IndicesClientCreateMethodsInterceptor implements InstanceMethodsAro
Class<?>[] argumentsTypes, Throwable t) {
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
if (restClientEnhanceInfo != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -18,8 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
@ -33,6 +31,8 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class IndicesClientDeleteMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -66,7 +66,7 @@ public class IndicesClientDeleteMethodsInterceptor implements InstanceMethodsAro
Class<?>[] argumentsTypes, Throwable t) {
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
if (restClientEnhanceInfo != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -33,6 +30,9 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.get.GetRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class RestHighLevelClientGetMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -63,6 +63,6 @@ public class RestHighLevelClientGetMethodsInterceptor implements InstanceMethods
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -33,6 +30,9 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.index.IndexRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class RestHighLevelClientIndexMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -63,6 +63,6 @@ public class RestHighLevelClientIndexMethodsInterceptor implements InstanceMetho
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
@ -34,6 +31,9 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.search.SearchRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class RestHighLevelClientSearchMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -64,6 +64,6 @@ public class RestHighLevelClientSearchMethodsInterceptor implements InstanceMeth
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -18,9 +18,6 @@
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
import java.lang.reflect.Method;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
@ -33,6 +30,9 @@ import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
import org.elasticsearch.action.update.UpdateRequest;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
public class RestHighLevelClientUpdateMethodsInterceptor implements InstanceMethodsAroundInterceptor {
@Override
@ -63,6 +63,6 @@ public class RestHighLevelClientUpdateMethodsInterceptor implements InstanceMeth
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -71,7 +71,7 @@ public class TransportActionNodeProxyExecuteMethodsInterceptor implements Instan
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
@Override

View File

@ -165,6 +165,5 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.log(t);
activeSpan.errorOccurred();
}
}

View File

@ -63,7 +63,7 @@ public class ClientDestTracingFilterInterceptor extends AbstractInterceptor {
* there is an active span
*/
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -83,7 +83,6 @@ public class ClientTracingFilterInterceptor extends AbstractInterceptor {
@Override
public void onFailure(Throwable cause) {
finagleSpan.errorOccurred();
finagleSpan.log(cause);
finagleSpan.asyncFinish();
}
@ -94,6 +93,6 @@ public class ClientTracingFilterInterceptor extends AbstractInterceptor {
@Override
public void handleMethodExceptionImpl(EnhancedInstance enhancedInstance, Method method, Object[] objects, Class<?>[] classes, Throwable throwable) {
ContextManager.activeSpan().errorOccurred().log(throwable);
ContextManager.activeSpan().log(throwable);
}
}

View File

@ -78,7 +78,6 @@ public class ServerTracingFilterInterceptor extends AbstractInterceptor {
@Override
public void onFailure(Throwable cause) {
finagleSpan.errorOccurred();
finagleSpan.log(cause);
finagleSpan.asyncFinish();
}
@ -90,6 +89,6 @@ public class ServerTracingFilterInterceptor extends AbstractInterceptor {
@Override
public void handleMethodExceptionImpl(EnhancedInstance enhancedInstance, Method method, Object[] objects,
Class<?>[] classes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -64,7 +64,6 @@ public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}
}

View File

@ -95,7 +95,6 @@ public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}
}

View File

@ -64,7 +64,6 @@ public class GraphqlInterceptor implements InstanceMethodsAroundInterceptor {
private void dealException(Throwable throwable) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(throwable);
}
}

View File

@ -55,6 +55,6 @@ public class BlockingCallInterceptor implements StaticMethodsAroundInterceptor {
@Override
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes,
Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -93,7 +93,7 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
try {
delegate().start(new TracingClientCallListener(responseListener, snapshot), headers);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
if (blockingSpan == null) {
@ -117,7 +117,7 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
try {
super.sendMessage(message);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -134,7 +134,7 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
try {
super.halfClose();
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -155,7 +155,7 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
try {
super.cancel(message, cause);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -185,7 +185,7 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
try {
delegate().onMessage(message);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
} finally {
ContextManager.stopSpan();
}
@ -198,14 +198,14 @@ class TracingClientCall<REQUEST, RESPONSE> extends ForwardingClientCall.SimpleFo
span.setLayer(SpanLayer.RPC_FRAMEWORK);
ContextManager.continued(contextSnapshot);
if (!status.isOk()) {
span.errorOccurred().log(status.asRuntimeException());
span.log(status.asRuntimeException());
Tags.STATUS_CODE.set(span, status.getCode().name());
}
try {
delegate().onClose(status, trailers);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
} finally {
ContextManager.stopSpan();
}

View File

@ -57,7 +57,7 @@ public class TracingServerCall<REQUEST, RESPONSE> extends ForwardingServerCall.S
try {
super.sendMessage(message);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -82,9 +82,9 @@ public class TracingServerCall<REQUEST, RESPONSE> extends ForwardingServerCall.S
case UNKNOWN:
case INTERNAL:
if (status.getCause() == null) {
span.errorOccurred().log(status.asRuntimeException());
span.log(status.asRuntimeException());
} else {
span.errorOccurred().log(status.getCause());
span.log(status.getCause());
}
break;
// Other status code means some predictable error occurred in server.
@ -93,7 +93,7 @@ public class TracingServerCall<REQUEST, RESPONSE> extends ForwardingServerCall.S
default:
// But if the status still has cause exception, we will log it too.
if (status.getCause() != null) {
span.errorOccurred().log(status.getCause());
span.log(status.getCause());
}
break;
}
@ -102,7 +102,7 @@ public class TracingServerCall<REQUEST, RESPONSE> extends ForwardingServerCall.S
try {
super.close(status, trailers);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();

View File

@ -58,7 +58,7 @@ public class TracingServerCallListener<REQUEST> extends ForwardingServerCallList
try {
super.onMessage(message);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -78,7 +78,7 @@ public class TracingServerCallListener<REQUEST> extends ForwardingServerCallList
try {
super.onCancel();
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();
@ -95,7 +95,7 @@ public class TracingServerCallListener<REQUEST> extends ForwardingServerCallList
try {
super.onHalfClose();
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
ContextManager.stopSpan();

View File

@ -102,7 +102,6 @@ public class HTableInterceptor implements InstanceMethodsAroundInterceptor, Inst
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}

View File

@ -96,7 +96,6 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}

View File

@ -49,7 +49,7 @@ public class FutureCallbackWrapper<T> implements FutureCallback<T> {
public void failed(Exception e) {
CONTEXT_LOCAL.remove();
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(e);
ContextManager.activeSpan().log(e);
ContextManager.stopSpan();
}
if (callback != null) {

View File

@ -70,7 +70,7 @@ public class HttpAsyncResponseConsumerWrapper<T> implements HttpAsyncResponseCon
public void failed(Exception ex) {
CONTEXT_LOCAL.remove();
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(ex);
ContextManager.activeSpan().log(ex);
ContextManager.stopSpan();
}
consumer.failed(ex);

View File

@ -89,7 +89,7 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
@Override
public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, final Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
private String getRequestURI(URI uri) throws URIException {

View File

@ -51,6 +51,6 @@ public class HystrixCommandGetFallbackInterceptor implements InstanceMethodsArou
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -55,6 +55,6 @@ public class HystrixCommandRunInterceptor implements InstanceMethodsAroundInterc
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -92,6 +92,6 @@ public class InfluxDBMethodInterceptor implements InstanceMethodsAroundIntercept
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -62,7 +62,7 @@ public class ConnectionServiceMethodInterceptor implements InstanceMethodsAround
@Override
public final void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -42,7 +42,6 @@ public class CallableStatementTracing {
span.setComponent(connectInfo.getComponent());
return exec.exe(realStatement, sql);
} catch (SQLException e) {
span.errorOccurred();
span.log(e);
throw e;
} finally {

View File

@ -43,7 +43,6 @@ public class PreparedStatementTracing {
SpanLayer.asDB(span);
return exec.exe(realStatement, sql);
} catch (SQLException e) {
span.errorOccurred();
span.log(e);
throw e;
} finally {

View File

@ -42,7 +42,6 @@ public class StatementTracing {
return exec.exe(realStatement, sql);
} catch (SQLException e) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(e);
throw e;
} finally {

View File

@ -39,7 +39,6 @@ public class ConnectionTracing {
SpanLayer.asDB(span);
return exec.exe(realConnection, sql);
} catch (SQLException e) {
span.errorOccurred();
span.log(e);
throw e;
} finally {

View File

@ -58,7 +58,6 @@ public class JedisMethodInterceptor implements InstanceMethodsAroundInterceptor
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}
}

View File

@ -67,7 +67,7 @@ public class SyncHttpRequestSendInterceptor implements InstanceMethodsAroundInte
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
public String getHttpMethod(HttpRequest request) {

View File

@ -66,7 +66,7 @@ public class SyncHttpRequestSendInterceptor implements InstanceMethodsAroundInte
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
public String getHttpMethod(HttpRequest request) {

View File

@ -83,6 +83,6 @@ public class HandleInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -42,7 +42,7 @@ public class InterceptorMethod {
public static void handleMethodException(Throwable t) {
KafkaContext context = (KafkaContext) ContextManager.getRuntimeContext().get(Constants.KAFKA_FLAG);
if (context != null && context.isNeedStop()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -55,11 +55,11 @@ public class CallbackAdapterInterceptor implements Callback {
try {
callbackCache.getCallback().onCompletion(metadata, exception);
} catch (Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
throw t;
} finally {
if (exception != null) {
ContextManager.activeSpan().errorOccurred().log(exception);
ContextManager.activeSpan().log(exception);
}
ContextManager.stopSpan();
}

View File

@ -63,7 +63,7 @@ public class CallbackInterceptor implements InstanceMethodsAroundInterceptor {
if (null != snapshot) {
Exception exceptions = (Exception) allArguments[1];
if (exceptions != null) {
ContextManager.activeSpan().errorOccurred().log(exceptions);
ContextManager.activeSpan().log(exceptions);
}
ContextManager.stopSpan();
}
@ -74,7 +74,7 @@ public class CallbackInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
private ContextSnapshot getSnapshot(CallbackCache cache) {

View File

@ -107,7 +107,7 @@ public class KafkaConsumerInterceptor implements InstanceMethodsAroundIntercepto
* {@link #afterMethod}, before the creation of entry span, we can not ensure there is an active span
*/
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}
}

View File

@ -52,6 +52,6 @@ public class SubscribeMethodInterceptor implements InstanceMethodsAroundIntercep
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -61,6 +61,6 @@ public class AsyncCommandMethodInterceptor implements InstanceMethodsAroundInter
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -73,7 +73,6 @@ public class RedisChannelWriterInterceptor implements InstanceMethodsAroundInter
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}

View File

@ -49,7 +49,7 @@ public class SWBiConsumer<T, U> implements BiConsumer<T, U> {
ContextManager.continued(snapshot);
biConsumer.accept(t, u);
} catch (Throwable th) {
ContextManager.activeSpan().errorOccurred().log(th);
ContextManager.activeSpan().log(th);
} finally {
ContextManager.stopSpan();
}

View File

@ -49,7 +49,7 @@ public class SWConsumer<T> implements Consumer<T> {
ContextManager.continued(snapshot);
consumer.accept(t);
} catch (Throwable th) {
ContextManager.activeSpan().errorOccurred().log(th);
ContextManager.activeSpan().log(th);
} finally {
ContextManager.stopSpan();
}

View File

@ -117,7 +117,7 @@ public class HandleRequestInterceptor implements InstanceMethodsAroundIntercepto
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
private boolean isBusinessHandler(EnhancedInstance objInst) {

View File

@ -76,7 +76,7 @@ public class PreparedStatementExecuteMethodsInterceptor implements InstanceMetho
Class<?>[] argumentsTypes, Throwable t) {
StatementEnhanceInfos cacheObject = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
if (cacheObject.getConnectionInfo() != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -63,7 +63,7 @@ public class StatementExecuteMethodsInterceptor implements InstanceMethodsAround
Class<?>[] argumentsTypes, Throwable t) {
StatementEnhanceInfos cacheObject = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
if (cacheObject.getConnectionInfo() != null) {
ContextManager.activeSpan().errorOccurred().log(t);
ContextManager.activeSpan().log(t);
}
}

View File

@ -78,7 +78,6 @@ public class MongoDBCollectionMethodInterceptor implements InstanceMethodsAround
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}

View File

@ -75,7 +75,6 @@ public class MongoDBInterceptor implements InstanceMethodsAroundInterceptor, Ins
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}
}

View File

@ -58,7 +58,6 @@ public class MongoDBOperationExecutorInterceptor implements InstanceMethodsAroun
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}

View File

@ -71,7 +71,6 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
Response response = (Response) ret;
if (response != null && response.getException() != null) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(response.getException());
}
ContextManager.stopSpan();
@ -82,7 +81,6 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan span = ContextManager.activeSpan();
span.errorOccurred();
span.log(t);
}

View File

@ -63,7 +63,6 @@ public class MotanProviderInterceptor implements InstanceMethodsAroundIntercepto
if (response != null && response.getException() != null) {
AbstractSpan span = ContextManager.activeSpan();
span.log(response.getException());
span.errorOccurred();
}
ContextManager.stopSpan();
@ -74,7 +73,6 @@ public class MotanProviderInterceptor implements InstanceMethodsAroundIntercepto
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}

Some files were not shown because too many files have changed in this diff Show More