Skip to content
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

fix: Discover and health check with service incarnation #1853

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {
object Kalix {
val ProtocolVersionMajor = 1
val ProtocolVersionMinor = 1
val ProxyVersion = System.getProperty("kalix-proxy.version", "1.1.22")
val ProxyVersion = System.getProperty("kalix-proxy.version", "1.1.23")
}

// changing the Scala version of the Java SDK affects end users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package kalix.javasdk.impl

import java.time.Duration
import java.util
import java.util.UUID
import java.util.concurrent.atomic.AtomicReference

import scala.concurrent.Future
Expand Down Expand Up @@ -52,6 +53,8 @@ class DiscoveryImpl(

private val log = LoggerFactory.getLogger(getClass)

private val serviceIncarnationUuid = UUID.randomUUID().toString

// Delay CoordinatedShutdown until the proxy has been terminated.
// This is updated from the `discover` call with a new Promise. Completed in the `proxyTerminated` call.
private val proxyTerminatedRef = new AtomicReference[Promise[Done]](Promise.successful(Done))
Expand Down Expand Up @@ -107,7 +110,8 @@ class DiscoveryImpl(
protocolMinorVersion =
configuredIntOrElse("kalix.library.protocol-minor-version", BuildInfo.protocolMinorVersion),
// passed along for substitution in options
env = env)
env = env,
serviceIncarnationUuid = serviceIncarnationUuid)

if (isVersionProbe(in)) {
// only (silently) send service info for hybrid proxy version probe
Expand Down Expand Up @@ -207,8 +211,8 @@ class DiscoveryImpl(
Future.successful(com.google.protobuf.empty.Empty.defaultInstance)
}

override def healthCheck(in: Empty): Future[Empty] =
Future.successful(Empty.defaultInstance)
override def healthCheck(in: Empty): Future[HealthCheckResponse] =
Future.successful(HealthCheckResponse(serviceIncarnationUuid))

private def loadSource(location: UserFunctionError.SourceLocation): Option[String] =
if (location.endLine == 0 && location.endCol == 0) {
Expand Down