-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: perf result page #91
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
43 changes: 43 additions & 0 deletions
43
...rc/main/java/org/benchmarker/bmcontroller/template/service/utils/CommonDtoConversion.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,43 @@ | ||
package org.benchmarker.bmcontroller.template.service.utils; | ||
|
||
import java.time.Duration; | ||
import java.util.stream.Collectors; | ||
import org.benchmarker.bmcommon.dto.CommonTestResult; | ||
import org.benchmarker.bmcontroller.template.model.TestResult; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
/** | ||
* convert Entity to DTO | ||
*/ | ||
@Transactional(propagation = Propagation.REQUIRED, readOnly = true, rollbackFor = Exception.class) | ||
public class CommonDtoConversion { | ||
|
||
// TODO : 다량의 정보를 불러오는 만큼 캐싱 필요 | ||
public static CommonTestResult convertToCommonTestResult(TestResult testResult) { | ||
// check parent transaction or exception | ||
ParentTXCheck.IsParentTransactionActive(); | ||
|
||
return CommonTestResult.builder() | ||
.groupId(testResult.getTestExecution().getTestTemplate().getUserGroup().getId()) | ||
.testStatus(testResult.getAgentStatus()) | ||
.totalRequests(testResult.getTotalRequest()) | ||
.totalErrors(testResult.getTotalError()) | ||
.totalUsers(testResult.getTestExecution().getTestTemplate().getVuser()) | ||
.totalSuccess(testResult.getTotalSuccess()) | ||
.url(testResult.getTestExecution().getTestTemplate().getUrl()) | ||
.tpsAverage(testResult.getTpsAvg()) | ||
.mttfbAverage(testResult.getMttbfbAvg()) | ||
.startedAt(testResult.getStartedAt().toString()) | ||
.finishedAt(testResult.getFinishedAt().toString()) | ||
.totalDuration( | ||
Duration.between(testResult.getStartedAt(), testResult.getFinishedAt()).toString()) | ||
.statusCodeCount(testResult.getTestStatuses().stream().collect( | ||
Collectors.toMap((status) -> status.getCode().toString(), | ||
(status) -> status.getCount()))) | ||
// TODO : 현재 mttfb, tps percentile 정보가 저장되어있지 않고 그때그때 연산필요. | ||
// TODO : TestStatus 가 GET, POST 와 같은 정보를 저장하고 있음. 이는 맞지 않는 스키마이며 HTTP Status Code 를 저장해야함. | ||
// HTTP Status Code 는 200, 201, 400, 404, 500 등이 있음. 따라서 엔티티 내부 필드에서 int 로 저장해야함. | ||
.build(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ller/src/main/java/org/benchmarker/bmcontroller/template/service/utils/ParentTXCheck.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 org.benchmarker.bmcontroller.template.service.utils; | ||
|
||
import org.springframework.transaction.support.TransactionSynchronizationManager; | ||
|
||
/** | ||
* check parent transaction | ||
*/ | ||
public class ParentTXCheck { | ||
|
||
/** | ||
* check parent transaction | ||
* | ||
* @throws IllegalStateException if parent transaction is not active or not exist | ||
*/ | ||
public static void IsParentTransactionActive() { | ||
boolean actualTransactionActive = TransactionSynchronizationManager.isActualTransactionActive(); | ||
if (!actualTransactionActive) { | ||
throw new IllegalStateException("Parent transaction is not active"); | ||
} | ||
} | ||
} |
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
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
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
8 changes: 2 additions & 6 deletions
8
bm-controller/src/main/resources/templates/group/register.html
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스프링에선 트렌젝션을 계층 구조로 관리한다는 것과 부모의 트렌잭션 활성화 여부를 판별 할 수 있는 것도 처음알았네요 !! 👍