Skip to content

Commit

Permalink
add validation check for zipkinDefaultMaxSpans
Browse files Browse the repository at this point in the history
set reasonable default so checks pass
  • Loading branch information
autata committed Dec 6, 2024
1 parent a14240d commit 4660563
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ private static void validateQueryConfig(AstraConfigs.QueryServiceConfig queryCon
queryConfig.getServerConfig().getRequestTimeoutMs()
> queryConfig.getDefaultQueryTimeoutMs(),
"QueryConfig requestTimeoutMs must be higher than defaultQueryTimeoutMs");
checkArgument(
queryConfig.getZipkinDefaultMaxSpans() >= 1000,
"QueryConfig zipkinDefaultMaxSpans cannot less than 1000");
}

private static void validateCacheConfig(AstraConfigs.CacheConfig cacheConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static AstraConfigs.AstraConfig makeAstraConfig(
.setRequestTimeoutMs(5000)
.build())
.setDefaultQueryTimeoutMs(3000)
.setZipkinDefaultMaxSpans(20000)
.build();

AstraConfigs.RecoveryConfig recoveryConfig =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ZipkinServiceTest {
private ZipkinService zipkinService;
private AstraSearch.SearchResult mockSearchResult;

private static final int defaultMaxSpans = 100;
private static final int defaultMaxSpans = 2000;

@BeforeEach
public void setup() throws IOException {
Expand Down Expand Up @@ -109,7 +109,7 @@ public void testGetTraceByTraceId_respectsMaxSpans() throws Exception {

String traceId = "test_trace_2";
when(searcher.doSearch(any())).thenReturn(mockSearchResult);
int maxSpansParam = 200;
int maxSpansParam = 10000;

zipkinService.getTraceByTraceId(
traceId, Optional.empty(), Optional.empty(), Optional.of(maxSpansParam));
Expand Down
1 change: 1 addition & 0 deletions astra/src/test/resources/test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"requestTimeoutMs": 3000
},
"defaultQueryTimeoutMs": 1500,
"zipkinDefaultMaxSpans": 20000,
"managerConnectString": "localhost:8083"
},
"metadataStoreConfig": {
Expand Down
1 change: 1 addition & 0 deletions astra/src/test/resources/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ queryConfig:
serverAddress: "1.2.3.4"
requestTimeoutMs: 3000
defaultQueryTimeoutMs: 2500
zipkinDefaultMaxSpans: 20000
managerConnectString: localhost:8083

s3Config:
Expand Down

0 comments on commit 4660563

Please sign in to comment.