-
Notifications
You must be signed in to change notification settings - Fork 174
[backend] feat: batching injects traces (#2830) #3990
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
9f5cca9
[backend/frontend] Rework
Dimfacion efdd545
[backend] Batching inject trace execution
Dimfacion a855e0c
[backend] Batching Execution Traces
Dimfacion 722267d
[backend] Batching Execution Traces
Dimfacion 53bb1ad
[backend] Batching Execution Traces
Dimfacion f2dc738
[backend] Batching Execution Traces
Dimfacion 9214173
[backend] Batching Execution Traces
Dimfacion eb2bf5d
[backend] Batching Execution Traces
Dimfacion 2c76764
[backend] Batching Execution Traces
Dimfacion 02a5a71
[backend] Batching Execution Traces
Dimfacion 9e33f7f
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 4b14622
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion f6bee2c
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 54b5a9b
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 69ebb5d
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion fcbdd65
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion e469576
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 4944505
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 60dab13
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion d18828d
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 134b9b6
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 263077f
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 8312fbb
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion a150613
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 5220596
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 2b04268
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion cb5f227
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 9c65d77
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion d10d089
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion ed7bddb
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion b21c6f2
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 5b152d0
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 9c39c90
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion eff6a6b
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion dbf1efb
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 0e56c4d
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 4daa960
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 556ef91
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 83ad9d2
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 02b6635
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 7389f9c
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 8cfdb14
[backend] feat(engine): Batching injects traces (#2895)
Dimfacion 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 hidden or 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 hidden or 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
25 changes: 25 additions & 0 deletions
25
openaev-api/src/main/java/io/openaev/config/ThreadPoolTaskSchedulerConfig.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,17 +1,42 @@ | ||
| package io.openaev.config; | ||
|
|
||
| import java.util.concurrent.Executor; | ||
| import java.util.concurrent.ThreadPoolExecutor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
| import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; | ||
|
|
||
| @Configuration | ||
| @Slf4j | ||
| public class ThreadPoolTaskSchedulerConfig { | ||
|
|
||
| @Bean | ||
| public ThreadPoolTaskScheduler threadPoolTaskScheduler() { | ||
| ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); | ||
| threadPoolTaskScheduler.setPoolSize(20); | ||
| threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler"); | ||
| threadPoolTaskScheduler.setErrorHandler( | ||
| t -> log.error("Error during scheduled task : {}", t.getMessage(), t)); | ||
| return threadPoolTaskScheduler; | ||
| } | ||
|
|
||
| /** Dedicated executor for stream events */ | ||
| @Bean(name = "streamExecutor") | ||
| public Executor streamExecutor() { | ||
| ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
| executor.setCorePoolSize(5); | ||
| executor.setMaxPoolSize(10); | ||
| executor.setQueueCapacity(100); | ||
| executor.setThreadNamePrefix("Stream-"); | ||
|
|
||
| // If we have more event to deal with than the available size in the waiting queue, we discard | ||
| // the oldest to prevent overloading the stream. This also helps a little preventing | ||
| // overloading the tab of a user connected when having a lot of events | ||
| executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy()); | ||
|
|
||
| executor.initialize(); | ||
| return executor; | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
openaev-api/src/main/java/io/openaev/migration/V4_53__Convert_expectations_to_jsonb.java
This file contains hidden or 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,57 @@ | ||
| package io.openaev.migration; | ||
|
|
||
| import java.sql.Statement; | ||
| import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
| import org.flywaydb.core.api.migration.Context; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class V4_53__Convert_expectations_to_jsonb extends BaseJavaMigration { | ||
|
|
||
| @Override | ||
| public boolean canExecuteInTransaction() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public void migrate(Context context) throws Exception { | ||
| try (Statement select = context.getConnection().createStatement()) { | ||
| select.execute( | ||
| """ | ||
| ALTER TABLE injects_expectations | ||
| ALTER COLUMN inject_expectation_signatures | ||
| TYPE jsonb | ||
| USING inject_expectation_signatures::jsonb; | ||
| -- Transform Foreign Key to deferrable key | ||
| ALTER TABLE execution_traces | ||
| DROP CONSTRAINT execution_traces_execution_agent_id_fkey, | ||
| DROP CONSTRAINT execution_traces_execution_inject_status_id_fkey, | ||
| DROP CONSTRAINT execution_traces_execution_inject_test_status_id_fkey; | ||
|
|
||
| ALTER TABLE execution_traces | ||
| ADD CONSTRAINT execution_traces_execution_inject_status_id_fkey | ||
| FOREIGN KEY (execution_inject_status_id) | ||
| REFERENCES injects_statuses(status_id) | ||
| ON DELETE CASCADE | ||
| DEFERRABLE INITIALLY DEFERRED, | ||
|
|
||
| ADD CONSTRAINT execution_traces_execution_inject_test_status_id_fkey | ||
| FOREIGN KEY (execution_inject_test_status_id) | ||
| REFERENCES injects_tests_statuses(status_id) | ||
| ON DELETE CASCADE | ||
| DEFERRABLE INITIALLY DEFERRED, | ||
|
|
||
| ADD CONSTRAINT execution_traces_execution_agent_id_fkey | ||
| FOREIGN KEY (execution_agent_id) | ||
| REFERENCES agents(agent_id) | ||
| ON DELETE CASCADE | ||
| DEFERRABLE INITIALLY DEFERRED; | ||
| """); | ||
| select.execute( | ||
| """ | ||
| CREATE INDEX CONCURRENTLY idx_injects_expectations_inject_agent | ||
| ON injects_expectations(inject_id, agent_id); | ||
| """); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.