-
Notifications
You must be signed in to change notification settings - Fork 479
feat(opensearch) #34610: ES-DECOMMISSION markers, OpenSearchExceptionMapper, and neutral utility conversions #35824
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
fabrizzio-dotCMS
merged 19 commits into
main
from
feat/opensearch-es-coupling-annotation-utilities
May 29, 2026
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b9dcda1
feat(opensearch) #34610: add @ESCoupled annotation and OpenSearch exc…
fabrizzio-dotCMS 80a5c7f
feat(opensearch) #34610: remove ES quick-win imports from vendor-neut…
fabrizzio-dotCMS 025c227
refactor(opensearch) #34610: simplify @ESCoupled — drop trackedIn/pha…
fabrizzio-dotCMS fc6e2ff
feat(opensearch) #34610: remove QueryPhaseExecutionException from Wor…
fabrizzio-dotCMS 6afce85
fix(opensearch) #34610: guard HttpRequestDataUtil.getIpAddress agains…
fabrizzio-dotCMS 3f5a25a
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS 3bc0345
refactor(telemetry): replace ByteSizeValue (ES vendor) with neutral f…
fabrizzio-dotCMS 48ef818
docs(telemetry): add Javadoc to TotalSizeSiteSearchIndicesMetricType …
fabrizzio-dotCMS 9727e03
revert(opensearch) #34610: restore WorkflowAPIImpl to pre-branch state
fabrizzio-dotCMS f416061
revert(opensearch): restore WorkflowAPIImpl to main state
fabrizzio-dotCMS 51ff06e
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS 43438be
fix(opensearch) #34610: address PR #35824 review feedback
fabrizzio-dotCMS e24e62c
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS 4c0200f
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS aa6cc7b
refactor(opensearch) #34610: replace @ESCoupled annotation with ES-DE…
fabrizzio-dotCMS eec5e59
docs(opensearch) #34610: document deferred ES migration in WorkflowAP…
fabrizzio-dotCMS 43251f1
refactor(opensearch) #34610: simplify WorkflowAPIImpl catch — remove …
fabrizzio-dotCMS 634f72a
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS 6ab90a3
Merge branch 'main' into feat/opensearch-es-coupling-annotation-utili…
fabrizzio-dotCMS 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
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
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
29 changes: 29 additions & 0 deletions
29
dotCMS/src/main/java/com/dotcms/rest/exception/mapper/OpenSearchExceptionMapper.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,29 @@ | ||
| package com.dotcms.rest.exception.mapper; | ||
|
|
||
| import com.dotmarketing.util.Logger; | ||
| import java.util.Optional; | ||
| import javax.ws.rs.core.Response; | ||
| import javax.ws.rs.core.Response.Status; | ||
| import javax.ws.rs.ext.ExceptionMapper; | ||
| import javax.ws.rs.ext.Provider; | ||
| import org.opensearch.client.opensearch._types.ErrorCause; | ||
| import org.opensearch.client.opensearch._types.OpenSearchException; | ||
|
|
||
| @Provider | ||
| public class OpenSearchExceptionMapper implements ExceptionMapper<OpenSearchException> { | ||
|
|
||
| @Override | ||
| public Response toResponse(final OpenSearchException exception) { | ||
|
|
||
| Logger.warn(this.getClass(), exception.getMessage(), exception); | ||
|
|
||
| final String message = Optional.ofNullable(exception.error()) | ||
| .map(ErrorCause::reason) | ||
| .orElse(exception.getMessage()); | ||
| final String entity = ExceptionMapperUtil.getJsonErrorAsString(message); | ||
|
|
||
| final Status status = Status.fromStatusCode(exception.status()); | ||
| return ExceptionMapperUtil.createResponse(entity, message, | ||
| status != null ? status : Status.INTERNAL_SERVER_ERROR); | ||
| } | ||
| } | ||
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
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
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
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
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
100 changes: 100 additions & 0 deletions
100
.../com/dotcms/telemetry/collectors/sitesearch/TotalSizeSiteSearchIndicesMetricTypeTest.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,100 @@ | ||
| package com.dotcms.telemetry.collectors.sitesearch; | ||
|
|
||
| import com.dotcms.content.index.domain.ImmutableIndexStats; | ||
| import com.dotcms.content.index.domain.IndexStats; | ||
| import com.dotmarketing.exception.DotDataException; | ||
| import org.junit.Test; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertTrue; | ||
|
|
||
| public class TotalSizeSiteSearchIndicesMetricTypeTest { | ||
|
|
||
| private final TotalSizeSiteSearchIndicesMetricType metric = new TotalSizeSiteSearchIndicesMetricType(); | ||
|
|
||
| // -- metadata -- | ||
|
|
||
| @Test | ||
| public void testGetName() { | ||
| assertEquals("TOTAL_INDICES_SIZE", metric.getName()); | ||
| } | ||
|
|
||
| // -- formatBytes boundary cases -- | ||
|
|
||
| @Test | ||
| public void testEmpty_returnsZeroBytes() throws DotDataException { | ||
| assertEquals("0b", getValue(List.of())); | ||
| } | ||
|
|
||
| @Test | ||
| public void testBelowKb_returnsRawBytes() throws DotDataException { | ||
| assertEquals("512b", getValue(index(512))); | ||
| assertEquals("1023b", getValue(index(1023))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testExactKb_dropsDecimal() throws DotDataException { | ||
| assertEquals("1kb", getValue(index(1024))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testFractionalKb_keepsOneDecimal() throws DotDataException { | ||
| assertEquals("1.5kb", getValue(index(1536))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testExactMb_dropsDecimal() throws DotDataException { | ||
| assertEquals("1mb", getValue(index(1024L * 1024))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testFractionalGb_keepsOneDecimal() throws DotDataException { | ||
| assertEquals("1.5gb", getValue(index((long) (1.5 * 1024 * 1024 * 1024)))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testLargeMb_noDecimal() throws DotDataException { | ||
| assertEquals("128mb", getValue(index(128L * 1024 * 1024))); | ||
| } | ||
|
|
||
| @Test | ||
| public void testTruncationNotRounding() throws DotDataException { | ||
| // format1Decimal truncates (string slice), it does not round. | ||
| // 1.99 GB truncates to "1.9gb", not "2.0gb". | ||
| final long GB = 1L << 30; | ||
| assertEquals("1.9gb", getValue(index((long) (1.99 * GB)))); | ||
| } | ||
|
|
||
| // -- aggregation across multiple indices -- | ||
|
|
||
| @Test | ||
| public void testMultipleIndices_sumsCorrectly() throws DotDataException { | ||
| final IndexStats a = index(512L * 1024 * 1024); // 512 MB | ||
| final IndexStats b = index(512L * 1024 * 1024); // 512 MB → total 1 GB | ||
| assertEquals("1gb", getValue(a, b)); | ||
| } | ||
|
|
||
| // -- helpers -- | ||
|
|
||
| private String getValue(final IndexStats... indices) throws DotDataException { | ||
| return getValue(List.of(indices)); | ||
| } | ||
|
|
||
| private String getValue(final List<IndexStats> indices) throws DotDataException { | ||
| final Optional<Object> result = metric.getValue(indices); | ||
| assertTrue(result.isPresent()); | ||
| return (String) result.get(); | ||
| } | ||
|
|
||
| private static IndexStats index(final long sizeRaw) { | ||
| return ImmutableIndexStats.builder() | ||
| .indexName("test") | ||
| .documentCount(0) | ||
| .sizeRaw(sizeRaw) | ||
| .size("") | ||
| .build(); | ||
| } | ||
| } |
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.