forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#9631] Receive and send it to EmptyExceptionTraceService
- Loading branch information
Showing
9 changed files
with
259 additions
and
8 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...or/src/main/java/com/navercorp/pinpoint/collector/service/EmptyExceptionTraceService.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,21 @@ | ||
package com.navercorp.pinpoint.collector.service; | ||
|
||
import com.navercorp.pinpoint.common.profiler.util.TransactionId; | ||
import com.navercorp.pinpoint.common.server.bo.exception.SpanEventExceptionBo; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
@ConditionalOnMissingBean(value = ExceptionTraceService.class, ignored = EmptyExceptionTraceService.class) | ||
@Service | ||
public class EmptyExceptionTraceService implements ExceptionTraceService { | ||
@Override | ||
public void save(List<SpanEventExceptionBo> spanEventExceptionBoList, ServiceType applicationServiceType, String applicationId, String agentId, TransactionId transactionId, long spanId) { | ||
// do nothing | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
collector/src/main/java/com/navercorp/pinpoint/collector/service/ExceptionTraceService.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,14 @@ | ||
package com.navercorp.pinpoint.collector.service; | ||
|
||
import com.navercorp.pinpoint.common.profiler.util.TransactionId; | ||
import com.navercorp.pinpoint.common.server.bo.exception.SpanEventExceptionBo; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public interface ExceptionTraceService { | ||
void save(List<SpanEventExceptionBo> spanEventExceptionBoList, ServiceType applicationServiceType, String applicationId, String agentId, TransactionId transactionId, long spanId); | ||
} |
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
58 changes: 58 additions & 0 deletions
58
...src/main/java/com/navercorp/pinpoint/common/server/bo/exception/SpanEventExceptionBo.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,58 @@ | ||
package com.navercorp.pinpoint.common.server.bo.exception; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class SpanEventExceptionBo { | ||
private String exceptionClassName; | ||
private String exceptionMessage; | ||
private List<StackTraceElementWrapperBo> stackTraceElements; | ||
private long startTime; | ||
|
||
public SpanEventExceptionBo() { | ||
} | ||
|
||
public String getExceptionClassName() { | ||
return exceptionClassName; | ||
} | ||
|
||
public void setExceptionClassName(String exceptionClassName) { | ||
this.exceptionClassName = exceptionClassName; | ||
} | ||
|
||
public String getExceptionMessage() { | ||
return exceptionMessage; | ||
} | ||
|
||
public void setExceptionMessage(String exceptionMessage) { | ||
this.exceptionMessage = exceptionMessage; | ||
} | ||
|
||
public List<StackTraceElementWrapperBo> getStackTraceElements() { | ||
return stackTraceElements; | ||
} | ||
|
||
public void setStackTraceElements(List<StackTraceElementWrapperBo> stackTraceElements) { | ||
this.stackTraceElements = stackTraceElements; | ||
} | ||
|
||
public long getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(long startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SpanEventExceptionBo{" + | ||
"exceptionClassName='" + exceptionClassName + '\'' + | ||
", exceptionMessage='" + exceptionMessage + '\'' + | ||
", stackTraceElements=" + stackTraceElements + | ||
", startTime=" + startTime + | ||
'}'; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...in/java/com/navercorp/pinpoint/common/server/bo/exception/StackTraceElementWrapperBo.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.common.server.bo.exception; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class StackTraceElementWrapperBo { | ||
private String className; | ||
private String fileName; | ||
private int lineNumber; | ||
private String methodName; | ||
|
||
public StackTraceElementWrapperBo(String className, | ||
String fileName, | ||
int lineNumber, | ||
String methodName) { | ||
this.className = Objects.requireNonNull(className, "className"); | ||
this.fileName = Objects.requireNonNull(fileName, "fileName"); | ||
this.lineNumber = lineNumber; | ||
this.methodName = Objects.requireNonNull(methodName, "methodName"); | ||
} | ||
|
||
public String getClassName() { | ||
return className; | ||
} | ||
|
||
public void setClassName(String className) { | ||
this.className = className; | ||
} | ||
|
||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public void setFileName(String fileName) { | ||
this.fileName = fileName; | ||
} | ||
|
||
public int getLineNumber() { | ||
return lineNumber; | ||
} | ||
|
||
public void setLineNumber(int lineNumber) { | ||
this.lineNumber = lineNumber; | ||
} | ||
|
||
public String getMethodName() { | ||
return methodName; | ||
} | ||
|
||
public void setMethodName(String methodName) { | ||
this.methodName = methodName; | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
.../main/java/com/navercorp/pinpoint/common/server/bo/grpc/GrpcSpanEventExceptionBinder.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,53 @@ | ||
package com.navercorp.pinpoint.common.server.bo.grpc; | ||
|
||
import com.navercorp.pinpoint.common.server.bo.exception.SpanEventExceptionBo; | ||
import com.navercorp.pinpoint.common.server.bo.exception.StackTraceElementWrapperBo; | ||
import com.navercorp.pinpoint.grpc.trace.PSpanEventException; | ||
import com.navercorp.pinpoint.grpc.trace.PStackTraceElement; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class GrpcSpanEventExceptionBinder { | ||
|
||
public GrpcSpanEventExceptionBinder() { | ||
} | ||
|
||
@Nullable | ||
public SpanEventExceptionBo bind(PSpanEventException pSpanEventException) { | ||
if (pSpanEventException == null) { | ||
return null; | ||
} | ||
SpanEventExceptionBo spanEventExceptionBo = new SpanEventExceptionBo(); | ||
|
||
spanEventExceptionBo.setExceptionClassName(pSpanEventException.getExceptionClassName()); | ||
spanEventExceptionBo.setExceptionMessage(pSpanEventException.getExceptionMessage()); | ||
|
||
spanEventExceptionBo.setStackTraceElements( | ||
getStackTraceElements(pSpanEventException.getStackTraceElementList()) | ||
); | ||
|
||
spanEventExceptionBo.setStartTime(pSpanEventException.getStartTime()); | ||
|
||
return spanEventExceptionBo; | ||
} | ||
|
||
private List<StackTraceElementWrapperBo> getStackTraceElements(List<PStackTraceElement> pStackTraceElementList) { | ||
return pStackTraceElementList.stream().map( | ||
this::getStackTraceElement | ||
).collect(Collectors.toList()); | ||
} | ||
|
||
private StackTraceElementWrapperBo getStackTraceElement(PStackTraceElement pStackTraceElement) { | ||
return new StackTraceElementWrapperBo( | ||
pStackTraceElement.getClassName(), | ||
pStackTraceElement.getFileName(), | ||
pStackTraceElement.getLineNumber(), | ||
pStackTraceElement.getMethodName() | ||
); | ||
} | ||
} |