Skip to content

Commit

Permalink
Updates to Armeria 1.27.1 and fixes Eureka VIP registration bug (#3715)
Browse files Browse the repository at this point in the history
This updates to latest Armeria 1.27.0, which removes some tech debt.
This also fixes a bug in the default behavior of Armeria, which is that
it sets a `host:port` value for the VIP address in Eureka. While the
`instanceId` needs to be qualified with port, the VIP address must not,
as there's already a port field.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
codefromthecrypt authored Feb 7, 2024
1 parent 2a4cbdb commit d22f91f
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 337 deletions.
5 changes: 0 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,3 @@ This product contains a modified part of Okio, distributed by Square:

* License: Apache License v2.0
* Homepage: https://github.com/square/okio

This product contains a modified part of Armeria, distributed by LINE Corporation:

* License: Apache License v2.0
* Homepage: https://github.com/line/armeria
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@

<!-- This allows you to test feature branches with jitpack -->
<armeria.groupId>com.linecorp.armeria</armeria.groupId>
<armeria.version>1.26.4</armeria.version>
<armeria.version>1.27.1</armeria.version>
<!-- Match Armeria version to avoid conflicts including running tests in the IDE -->
<netty.version>4.1.100.Final</netty.version>
<netty.version>4.1.106.Final</netty.version>

<!-- It's easy for Jackson dependencies to get misaligned, so we manage it ourselves. -->
<jackson.version>2.16.1</jackson.version>
Expand Down Expand Up @@ -564,8 +564,6 @@
<exclude>build-bin/configure_test</exclude>
<exclude>build-bin/deploy</exclude>
<exclude>build-bin/test</exclude>
<!-- temporarily patched file from line/armeria#5391 -->
<exclude>**/HttpFile.java</exclude>
</excludes>
<strictCheck>true</strictCheck>
</configuration>
Expand Down
14 changes: 7 additions & 7 deletions zipkin-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,13 @@ Zipkin can register itself in [Eureka](https://github.com/Netflix/eureka), allow
to discover its listen address and health state. This is enabled when `EUREKA_SERVICE_URL` is set to
a valid v2 endpoint of the [Eureka REST API](https://github.com/Netflix/eureka/wiki/Eureka-REST-operations).

| Variable | Instance field | Description |
|----------------------------|----------------|------------------------------------------------------------------------------------------------|
| `DISCOVERY_EUREKA_ENABLED` | N/A | `false` disables Eureka registration. Defaults to `true`. |
| `EUREKA_SERVICE_URL` | N/A | v2 endpoint of Eureka, e.g. `https://eureka-prod/eureka/v2`. No default |
| `EUREKA_APP_NAME` | .app | The application this instance registers to. Defaults to `zipkin` |
| `EUREKA_HOSTNAME` | .hostName | The hostname used with `${QUERY_PORT}` to build the instance `vipAddress`. Defaults to detect. |
| `EUREKA_INSTANCE_ID` | .instanceId | Defaults to `${EUREKA_HOSTNAME}:${EUREKA_APP_NAME}:${QUERY_PORT}`. |
| Variable | Instance field | Description |
|----------------------------|----------------|-------------------------------------------------------------------------|
| `DISCOVERY_EUREKA_ENABLED` | N/A | `false` disables Eureka registration. Defaults to `true`. |
| `EUREKA_SERVICE_URL` | N/A | v2 endpoint of Eureka, e.g. `https://eureka-prod/eureka/v2`. No default |
| `EUREKA_APP_NAME` | .app | The application this instance registers to. Defaults to `zipkin` |
| `EUREKA_HOSTNAME` | .hostName | The instance `hostName` and `vipAddress`. Defaults to detect. |
| `EUREKA_INSTANCE_ID` | .instanceId | Defaults to `${EUREKA_HOSTNAME}:${EUREKA_APP_NAME}:${QUERY_PORT}`. |

Example usage:

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package zipkin2.server.internal.eureka;

import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.eureka.EurekaUpdatingListener;
import com.linecorp.armeria.spring.ArmeriaServerConfigurator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
package zipkin2.server.internal.eureka;

import com.linecorp.armeria.common.auth.BasicToken;
import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.eureka.EurekaUpdatingListener;
import com.linecorp.armeria.server.eureka.EurekaUpdatingListenerBuilder;
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import org.springframework.boot.context.properties.ConfigurationProperties;
import zipkin2.storage.cassandra.internal.HostAndPort;

/**
* Settings for Eureka registration.
Expand Down Expand Up @@ -105,11 +107,17 @@ public void setHostname(String hostname) {
}

EurekaUpdatingListenerBuilder toBuilder() {
EurekaUpdatingListenerBuilder result = EurekaUpdatingListener.builder(serviceUrl);
EurekaUpdatingListenerBuilder result = EurekaUpdatingListener.builder(serviceUrl)
.healthCheckUrlPath("/health");
if (auth != null) result.auth(auth);
if (appName != null) result.appName(appName);
if (instanceId != null) result.instanceId(instanceId);
if (hostname != null) result.hostname(hostname);
if (hostname != null) {
result.hostname(hostname);
// Armeria defaults the vipAddress incorrectly to include the port. This is redundant with
// the server port, so override it until we have a PR to fix that.
result.vipAddress(hostname);
}
return result;
}

Expand Down
Loading

0 comments on commit d22f91f

Please sign in to comment.