-
Notifications
You must be signed in to change notification settings - Fork 5
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
EPMRPP-82701 || Update Search configs and naming #127
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Configuration | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class BackgroundProcessingConfiguration { | ||
|
||
public static final String LOG_MESSAGE_SAVING_QUEUE_NAME = "log_message_saving"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ | |
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Empty client to work with Elasticsearch. | ||
* Empty client to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Service | ||
public class EmptyElasticSearchClient implements ElasticSearchClient { | ||
public class EmptySearchEngineClient implements SearchEngineClient { | ||
|
||
@Override | ||
public void save(List<LogMessage> logMessageList) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ | |
import java.util.List; | ||
|
||
/** | ||
* Client interface to work with Elasticsearch. | ||
* Client interface to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
public interface ElasticSearchClient { | ||
public interface SearchEngineClient { | ||
|
||
void save(List<LogMessage> logMessageList); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,23 +19,23 @@ | |
import org.springframework.web.client.RestTemplate; | ||
|
||
/** | ||
* Simple client to work with Elasticsearch. | ||
* Simple client to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Primary | ||
@Service | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
public class SimpleElasticSearchClient implements ElasticSearchClient { | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class SimpleSearchEngineClient implements SearchEngineClient { | ||
|
||
protected final Logger LOGGER = LoggerFactory.getLogger(SimpleElasticSearchClient.class); | ||
protected final Logger LOGGER = LoggerFactory.getLogger(SimpleSearchEngineClient.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
private final String host; | ||
private final RestTemplate restTemplate; | ||
|
||
public SimpleElasticSearchClient(@Value("${rp.elasticsearch.host}") String host, | ||
@Value("${rp.elasticsearch.username:}") String username, | ||
@Value("${rp.elasticsearch.password:}") String password) { | ||
public SimpleSearchEngineClient(@Value("${rp.searchengine.host}") String host, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@Value("${rp.searchengine.username:}") String username, | ||
@Value("${rp.searchengine.password:}") String password) { | ||
restTemplate = new RestTemplate(); | ||
|
||
if (!username.isEmpty() && !password.isEmpty()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.epam.reportportal.jobs.clean; | ||
|
||
import com.epam.reportportal.analyzer.index.IndexerServiceClient; | ||
import com.epam.reportportal.elastic.ElasticSearchClient; | ||
import com.epam.reportportal.elastic.SearchEngineClient; | ||
import com.google.common.collect.Lists; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneOffset; | ||
|
@@ -35,21 +35,21 @@ public class CleanLaunchJob extends BaseCleanJob { | |
private final CleanLogJob cleanLogJob; | ||
private final IndexerServiceClient indexerServiceClient; | ||
private final ApplicationEventPublisher eventPublisher; | ||
private final ElasticSearchClient elasticSearchClient; | ||
private final SearchEngineClient searchEngineClient; | ||
|
||
public CleanLaunchJob( | ||
@Value("${rp.environment.variable.elements-counter.batch-size}") Integer batchSize, | ||
JdbcTemplate jdbcTemplate, | ||
NamedParameterJdbcTemplate namedParameterJdbcTemplate, CleanLogJob cleanLogJob, | ||
IndexerServiceClient indexerServiceClient, | ||
ApplicationEventPublisher eventPublisher, ElasticSearchClient elasticSearchClient) { | ||
ApplicationEventPublisher eventPublisher, SearchEngineClient searchEngineClient) { | ||
super(jdbcTemplate); | ||
this.batchSize = batchSize; | ||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; | ||
this.cleanLogJob = cleanLogJob; | ||
this.indexerServiceClient = indexerServiceClient; | ||
this.eventPublisher = eventPublisher; | ||
this.elasticSearchClient = elasticSearchClient; | ||
this.searchEngineClient = searchEngineClient; | ||
} | ||
|
||
@Override | ||
|
@@ -77,7 +77,7 @@ private void removeLaunches() { | |
indexerServiceClient.removeFromIndexLessThanLaunchDate(projectId, lessThanDate); | ||
LOGGER.info("Send message for deletion to analyzer for project {}", projectId); | ||
|
||
deleteLogsFromElasticsearchByLaunchIdsAndProjectId(launchIds, projectId); | ||
deleteLogsFromSearchEngineByLaunchIdsAndProjectId(launchIds, projectId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
// eventPublisher.publishEvent(new ElementsDeletedEvent(launchIds, projectId, numberOfLaunchElements)); | ||
// LOGGER.info("Send event with elements deleted number {} for project {}", deleted, projectId); | ||
|
@@ -86,10 +86,10 @@ private void removeLaunches() { | |
}); | ||
} | ||
|
||
private void deleteLogsFromElasticsearchByLaunchIdsAndProjectId(List<Long> launchIds, | ||
private void deleteLogsFromSearchEngineByLaunchIdsAndProjectId(List<Long> launchIds, | ||
Long projectId) { | ||
for (Long launchId : launchIds) { | ||
elasticSearchClient.deleteLogsByLaunchIdAndProjectId(launchId, projectId); | ||
searchEngineClient.deleteLogsByLaunchIdAndProjectId(launchId, projectId); | ||
LOGGER.info("Delete logs from ES by launch {} and project {}", launchId, projectId); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.epam.reportportal.jobs.clean; | ||
|
||
import com.epam.reportportal.analyzer.index.IndexerServiceClient; | ||
import com.epam.reportportal.elastic.ElasticSearchClient; | ||
import com.epam.reportportal.elastic.SearchEngineClient; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneOffset; | ||
import java.util.List; | ||
|
@@ -29,18 +29,18 @@ public class CleanLogJob extends BaseCleanJob { | |
private final CleanAttachmentJob cleanAttachmentJob; | ||
private final IndexerServiceClient indexerServiceClient; | ||
private final ApplicationEventPublisher eventPublisher; | ||
private final ElasticSearchClient elasticSearchClient; | ||
private final SearchEngineClient searchEngineClient; | ||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate; | ||
|
||
public CleanLogJob(JdbcTemplate jdbcTemplate, CleanAttachmentJob cleanAttachmentJob, | ||
IndexerServiceClient indexerServiceClient, ApplicationEventPublisher eventPublisher, | ||
ElasticSearchClient elasticSearchClient, | ||
SearchEngineClient searchEngineClient, | ||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) { | ||
super(jdbcTemplate); | ||
this.cleanAttachmentJob = cleanAttachmentJob; | ||
this.indexerServiceClient = indexerServiceClient; | ||
this.eventPublisher = eventPublisher; | ||
this.elasticSearchClient = elasticSearchClient; | ||
this.searchEngineClient = searchEngineClient; | ||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; | ||
} | ||
|
||
|
@@ -68,16 +68,16 @@ void removeLogs() { | |
|
||
final List<Long> launchIds = getLaunchIds(projectId, lessThanDate); | ||
if (!launchIds.isEmpty()) { | ||
deleteLogsFromElasticsearchByLaunchIdsAndProjectId(launchIds, projectId); | ||
deleteLogsFromSearchEngineByLaunchIdsAndProjectId(launchIds, projectId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
}); | ||
} | ||
|
||
private void deleteLogsFromElasticsearchByLaunchIdsAndProjectId(List<Long> launchIds, | ||
private void deleteLogsFromSearchEngineByLaunchIdsAndProjectId(List<Long> launchIds, | ||
Long projectId) { | ||
for (Long launchId : launchIds) { | ||
elasticSearchClient.deleteLogsByLaunchIdAndProjectId(launchId, projectId); | ||
searchEngineClient.deleteLogsByLaunchIdAndProjectId(launchId, projectId); | ||
LOGGER.info("Delete logs from ES by launch {} and project {}", launchId, projectId); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Service | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class SaveLogMessageJob { | ||
|
||
public static final String LOG_MESSAGE_SAVING_QUEUE_NAME = "log_message_saving"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.epam.reportportal.log; | ||
|
||
import com.epam.reportportal.calculation.BatchProcessing; | ||
import com.epam.reportportal.elastic.ElasticSearchClient; | ||
import com.epam.reportportal.elastic.SearchEngineClient; | ||
import java.util.List; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
|
@@ -15,22 +15,22 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Component | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class LogProcessing extends BatchProcessing<LogMessage> { | ||
|
||
private final ElasticSearchClient elasticSearchClient; | ||
private final SearchEngineClient searchEngineClient; | ||
|
||
public LogProcessing(ElasticSearchClient elasticSearchClient, | ||
public LogProcessing(SearchEngineClient searchEngineClient, | ||
@Value("${rp.processing.log.maxBatchSize}") int batchSize, | ||
@Value("${rp.processing.log.maxBatchTimeout}") int timeout) { | ||
super(batchSize, timeout, new DefaultManagedTaskScheduler()); | ||
this.elasticSearchClient = elasticSearchClient; | ||
this.searchEngineClient = searchEngineClient; | ||
} | ||
|
||
@Override | ||
protected void process(List<LogMessage> logMessageList) { | ||
if (!CollectionUtils.isEmpty(logMessageList)) { | ||
elasticSearchClient.save(logMessageList); | ||
searchEngineClient.save(logMessageList); | ||
} | ||
} | ||
} |
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.
Abbreviation in name 'LOGGER' must contain no more than '1' consecutive capital letters.