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] Add exceptionTrace Module
- Loading branch information
Showing
47 changed files
with
2,665 additions
and
2 deletions.
There are no files selected for viewing
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); | ||
} |
70 changes: 70 additions & 0 deletions
70
...r/src/main/java/com/navercorp/pinpoint/common/server/bo/exception/ExceptionWrapperBo.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,70 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.common.server.bo.exception; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class ExceptionWrapperBo { | ||
private String exceptionClassName; | ||
private String exceptionMessage; | ||
private List<StackTraceElementWrapperBo> stackTraceElements; | ||
|
||
public ExceptionWrapperBo ( | ||
String exceptionClassName, | ||
String exceptionMessage, | ||
List<StackTraceElementWrapperBo> stackTraceElements | ||
) { | ||
this.exceptionClassName = exceptionClassName; | ||
this.exceptionMessage = exceptionMessage; | ||
this.stackTraceElements = stackTraceElements; | ||
} | ||
|
||
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; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ExceptionWrapperBo{" + | ||
"exceptionClassName='" + exceptionClassName + '\'' + | ||
", exceptionMessage='" + exceptionMessage + '\'' + | ||
", stackTraceElements=" + stackTraceElements + | ||
'}'; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...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,39 @@ | ||
package com.navercorp.pinpoint.common.server.bo.exception; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class SpanEventExceptionBo { | ||
|
||
private List<ExceptionWrapperBo> exceptionWrappers; | ||
private long startTime; | ||
|
||
public SpanEventExceptionBo() { | ||
} | ||
|
||
public List<ExceptionWrapperBo> getExceptionWrappers() { | ||
return exceptionWrappers; | ||
} | ||
|
||
public void setExceptionWrappers(List<ExceptionWrapperBo> exceptionWrappers) { | ||
this.exceptionWrappers = exceptionWrappers; | ||
} | ||
|
||
public long getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(long startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SpanEventExceptionBo{" + | ||
"exceptionWrappers=" + exceptionWrappers + | ||
", 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>pinpoint-exceptiontrace-module</artifactId> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<version>2.5.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>pinpoint-exceptiontrace-collector</artifactId> | ||
|
||
<properties> | ||
<jdk.version>11</jdk.version> | ||
<jdk.home>${env.JAVA_11_HOME}</jdk.home> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-exceptiontrace-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-commons-server</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.kafka</groupId> | ||
<artifactId>spring-kafka</artifactId> | ||
<version>2.9.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-collector</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
34 changes: 34 additions & 0 deletions
34
...n/java/com/navercorp/pinpoint/exceptiontrace/collector/ExceptionTraceCollectorConfig.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,34 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.exceptiontrace.collector; | ||
|
||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportResource; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.annotation.PropertySource; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
@Profile("metric") | ||
@Configuration | ||
@ImportResource({"classpath*:**/applicationContext-collector-metric-namespace.xml","classpath:/applicationContext-collector-exceptiontrace-pinot-kafka.xml",}) | ||
@ComponentScan({"com.navercorp.pinpoint.exceptiontrace.collector.service", "com.navercorp.pinpoint.exceptiontrace.collector.dao"}) | ||
@PropertySource({"classpath:kafka-topic.properties", "classpath:kafka-producer-factory.properties"}) | ||
public class ExceptionTraceCollectorConfig { | ||
} |
23 changes: 23 additions & 0 deletions
23
...m/navercorp/pinpoint/exceptiontrace/collector/ExceptionTraceCollectorPropertySources.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,23 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.exceptiontrace.collector; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public class ExceptionTraceCollectorPropertySources { | ||
} |
28 changes: 28 additions & 0 deletions
28
.../src/main/java/com/navercorp/pinpoint/exceptiontrace/collector/dao/ExceptionTraceDao.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,28 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.exceptiontrace.collector.dao; | ||
|
||
import com.navercorp.pinpoint.exceptiontrace.common.model.SpanEventException; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public interface ExceptionTraceDao { | ||
void insert(List<SpanEventException> spanEventException); | ||
} |
60 changes: 60 additions & 0 deletions
60
...main/java/com/navercorp/pinpoint/exceptiontrace/collector/dao/PinotExceptionTraceDao.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,60 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.exceptiontrace.collector.dao; | ||
|
||
import com.navercorp.pinpoint.exceptiontrace.collector.model.SpanEventExceptionVo; | ||
import com.navercorp.pinpoint.exceptiontrace.common.model.SpanEventException; | ||
import com.navercorp.pinpoint.exceptiontrace.common.util.StringPrecondition; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
@Repository | ||
public class PinotExceptionTraceDao implements ExceptionTraceDao { | ||
private final Logger logger = LogManager.getLogger(this.getClass()); | ||
|
||
private final KafkaTemplate<String, SpanEventExceptionVo> kafkaSpanEventExceptionTemplate; | ||
|
||
private final String topic; | ||
|
||
public PinotExceptionTraceDao(@Qualifier("kafkaSpanEventExceptionTemplate") KafkaTemplate<String, SpanEventExceptionVo> kafkaSpanEventExceptionTemplate, | ||
@Value("${kafka.exceptiontrace.topic}") String topic) { | ||
this.kafkaSpanEventExceptionTemplate = Objects.requireNonNull(kafkaSpanEventExceptionTemplate, "kafkaSpanEventExceptionTemplate"); | ||
this.topic = StringPrecondition.requireHasLength(topic, "topic"); | ||
} | ||
|
||
@Override | ||
public void insert(List<SpanEventException> spanEventExceptions) { | ||
Objects.requireNonNull(spanEventExceptions); | ||
logger.info("Pinot data insert: {}", spanEventExceptions.toString()); | ||
|
||
for (SpanEventException spanEventException : spanEventExceptions) { | ||
this.kafkaSpanEventExceptionTemplate.send( | ||
topic, SpanEventExceptionVo.valueOf(spanEventException) | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.