Skip to content

Commit

Permalink
Merge branch 'main' into armeria-5549
Browse files Browse the repository at this point in the history
  • Loading branch information
Bue-von-hon committed Jun 19, 2024
2 parents ad2c7e7 + 2219de1 commit 9a79b95
Show file tree
Hide file tree
Showing 360 changed files with 10,051 additions and 8,270 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-enterprise-postjob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
workflow_conclusion: ""
run_id: ${{ env.RUN_ID }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,37 @@ public class RoutersBenchmark {
private static final RequestTarget METHOD1_REQ_TARGET = RequestTarget.forServer(METHOD1_HEADERS.path());

static {
final String defaultLogName = "log";
final String defaultServiceName = null;
final ServiceNaming defaultServiceNaming = ServiceNaming.of("Service");
final Route route1 = Route.builder().exact("/grpc.package.Service/Method1").build();
final Route route2 = Route.builder().exact("/grpc.package.Service/Method2").build();
final Path multipartUploadsLocation = Flags.defaultMultipartUploadsLocation();
final ServiceErrorHandler serviceErrorHandler = ServerErrorHandler.ofDefault().asServiceErrorHandler();
SERVICES = ImmutableList.of(
new ServiceConfig(route1, route1,
SERVICE, defaultLogName, defaultServiceName, defaultServiceNaming, 0, 0,
false, AccessLogWriter.disabled(), CommonPools.blockingTaskExecutor(),
SuccessFunction.always(), 0, multipartUploadsLocation,
CommonPools.workerGroup(), ImmutableList.of(), HttpHeaders.of(),
ctx -> RequestId.random(), serviceErrorHandler, NOOP_CONTEXT_HOOK),
new ServiceConfig(route2, route2,
SERVICE, defaultLogName, defaultServiceName, defaultServiceNaming, 0, 0,
false, AccessLogWriter.disabled(), CommonPools.blockingTaskExecutor(),
SuccessFunction.always(), 0, multipartUploadsLocation,
CommonPools.workerGroup(), ImmutableList.of(), HttpHeaders.of(),
ctx -> RequestId.random(), serviceErrorHandler, NOOP_CONTEXT_HOOK));
FALLBACK_SERVICE = new ServiceConfig(Route.ofCatchAll(), Route.ofCatchAll(), SERVICE,
defaultLogName, defaultServiceName,
defaultServiceNaming, 0, 0, false, AccessLogWriter.disabled(),
CommonPools.blockingTaskExecutor(), SuccessFunction.always(), 0,
multipartUploadsLocation, CommonPools.workerGroup(),
ImmutableList.of(), HttpHeaders.of(), ctx -> RequestId.random(),
serviceErrorHandler, NOOP_CONTEXT_HOOK);
SERVICES = ImmutableList.of(newServiceConfig(route1), newServiceConfig(route2));
FALLBACK_SERVICE = newServiceConfig(Route.ofCatchAll());
HOST = new VirtualHost(
"localhost", "localhost", 0, null, SERVICES, FALLBACK_SERVICE, RejectedRouteHandler.DISABLED,
unused -> NOPLogger.NOP_LOGGER, defaultServiceNaming, defaultLogName, 0, 0, false,
"localhost", "localhost", 0, null,
null, SERVICES, FALLBACK_SERVICE, RejectedRouteHandler.DISABLED,
unused -> NOPLogger.NOP_LOGGER, FALLBACK_SERVICE.defaultServiceNaming(),
FALLBACK_SERVICE.defaultLogName(), 0, 0, false,
AccessLogWriter.disabled(), CommonPools.blockingTaskExecutor(), 0, SuccessFunction.ofDefault(),
multipartUploadsLocation, CommonPools.workerGroup(), ImmutableList.of(),
FALLBACK_SERVICE.multipartUploadsLocation(), MultipartRemovalStrategy.ON_RESPONSE_COMPLETION,
CommonPools.workerGroup(), ImmutableList.of(),
ctx -> RequestId.random());
ROUTER = Routers.ofVirtualHost(HOST, SERVICES, RejectedRouteHandler.DISABLED);
}

private static ServiceConfig newServiceConfig(Route route) {
final String defaultLogName = "log";
final String defaultServiceName = null;
final ServiceNaming defaultServiceNaming = ServiceNaming.of("Service");
final Path multipartUploadsLocation = Flags.defaultMultipartUploadsLocation();
final ServiceErrorHandler serviceErrorHandler = ServerErrorHandler.ofDefault().asServiceErrorHandler();
return new ServiceConfig(route, route,
SERVICE, defaultLogName, defaultServiceName, defaultServiceNaming, 0, 0,
false, AccessLogWriter.disabled(), CommonPools.blockingTaskExecutor(),
SuccessFunction.always(), 0, multipartUploadsLocation,
MultipartRemovalStrategy.ON_RESPONSE_COMPLETION,
CommonPools.workerGroup(), ImmutableList.of(), HttpHeaders.of(),
ctx -> RequestId.random(), serviceErrorHandler, NOOP_CONTEXT_HOOK);
}

@Benchmark
public Routed<ServiceConfig> exactMatch() {
final RoutingContext ctx = DefaultRoutingContext.of(HOST, "localhost", METHOD1_REQ_TARGET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.net.URI;
import java.time.Duration;

import com.linecorp.armeria.client.Endpoint;
import com.linecorp.armeria.client.endpoint.AbstractDynamicEndpointGroupBuilder;
import com.linecorp.armeria.client.endpoint.EndpointSelectionStrategy;
import com.linecorp.armeria.common.Flags;
Expand All @@ -44,7 +43,7 @@
*/
@UnstableApi
public final class ConsulEndpointGroupBuilder
extends AbstractDynamicEndpointGroupBuilder implements ConsulConfigSetters {
extends AbstractDynamicEndpointGroupBuilder<ConsulEndpointGroupBuilder> implements ConsulConfigSetters {

private static final long DEFAULT_HEALTH_CHECK_INTERVAL_MILLIS = 10_000;

Expand Down Expand Up @@ -146,29 +145,4 @@ public ConsulEndpointGroup build() {
consulClientBuilder.build(), serviceName, registryFetchIntervalMillis,
useHealthyEndpoints, datacenter, filter);
}

@Override
public ConsulEndpointGroupBuilder allowEmptyEndpoints(boolean allowEmptyEndpoints) {
return (ConsulEndpointGroupBuilder) super.allowEmptyEndpoints(allowEmptyEndpoints);
}

/**
* Sets the timeout to wait until a successful {@link Endpoint} selection.
* {@link Duration#ZERO} disables the timeout.
* If unspecified, {@link Flags#defaultResponseTimeoutMillis()} is used by default.
*/
@Override
public ConsulEndpointGroupBuilder selectionTimeout(Duration selectionTimeout) {
return (ConsulEndpointGroupBuilder) super.selectionTimeout(selectionTimeout);
}

/**
* Sets the timeout to wait until a successful {@link Endpoint} selection.
* {@code 0} disables the timeout.
* If unspecified, {@link Flags#defaultResponseTimeoutMillis()} is used by default.
*/
@Override
public ConsulEndpointGroupBuilder selectionTimeoutMillis(long selectionTimeoutMillis) {
return (ConsulEndpointGroupBuilder) super.selectionTimeoutMillis(selectionTimeoutMillis);
}
}
16 changes: 10 additions & 6 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ mrJarVersions.each { version->
options.release.set(targetJavaVersion)
}

task "testJava${version}"(type: Test, group: 'Verification', description: "Runs unit tests for Java ${version} source set") {
tasks.register("testJava${version}", Test) {
group = 'Verification'
description = "Runs unit tests for Java ${version} source set"
testClassesDirs = sourceSets."java${version}Test".output.classesDirs
classpath = sourceSets."java${version}Test".runtimeClasspath

project.ext.configureCommonTestSettings(it)
enabled = project.ext.testJavaVersion >= targetJavaVersion

check.dependsOn it
}

configurations."java${version}Implementation".extendsFrom configurations.implementation
configurations."java${version}TestImplementation".extendsFrom configurations.testImplementation
configurations."java${version}TestRuntimeClasspath".extendsFrom configurations.testRuntimeClasspath

check.dependsOn "testJava${version}"
}

tasks.withType(Jar) {
Expand All @@ -63,7 +65,7 @@ tasks.trimShadedJar.doLast {
def trimmed = tasks.trimShadedJar.outJarFiles[0].toPath()

ant.jar(destfile: trimmed.toString(), update: true, duplicate: 'fail') {
zipfileset(src: tasks.shadedJar.archivePath) {
zipfileset(src: tasks.shadedJar.archiveFile.get().asFile) {
include(name: 'META-INF/versions/**')
}

Expand Down Expand Up @@ -105,9 +107,9 @@ dependencies {

// Micrometer and other metric-related stuff
api libs.micrometer.core
optionalApi libs.micrometer.prometheus
optionalApi libs.micrometer.prometheus.legacy
optionalApi libs.dropwizard.metrics.core
optionalApi libs.prometheus
optionalApi libs.prometheus.legacy

// Netty
api libs.netty.transport
Expand Down Expand Up @@ -154,6 +156,8 @@ dependencies {
// Jetty, for testing interoperability with other servers.
testImplementation libs.jetty94.webapp

testImplementation project(':prometheus1')

// Brotli
implementation libs.brotli4j
optionalImplementation libs.brotli4j.linux
Expand Down
Loading

0 comments on commit 9a79b95

Please sign in to comment.