Skip to content

Commit

Permalink
Merge pull request #267 from camunda-community-hub/grpc-status
Browse files Browse the repository at this point in the history
feat: include the Zeebe version in the topology
  • Loading branch information
saig0 authored Feb 21, 2023
2 parents 8315b10 + 3c8b88d commit 0783108
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class GrpcToLogStreamGateway(

private val requestIdGenerator = AtomicLong()

private val versionInfo = getVersionInfo()

private fun writeCommandWithKey(
key: Long,
metadata: RecordMetadata,
Expand Down Expand Up @@ -426,7 +428,7 @@ class GrpcToLogStreamGateway(
.addPartitions(partition)
.setHost("0.0.0.0")
.setPort(26500)
.setVersion(javaClass.`package`.implementationVersion ?: "X.Y.Z")
.setVersion(versionInfo)
.build()

val topologyResponse = GatewayOuterClass.TopologyResponse
Expand All @@ -435,7 +437,7 @@ class GrpcToLogStreamGateway(
.setClusterSize(1)
.setPartitionsCount(1)
.setReplicationFactor(1)
.setGatewayVersion(javaClass.`package`.implementationVersion ?: "A.B.C")
.setGatewayVersion(versionInfo)
.build()

responseObserver.onNext(topologyResponse)
Expand Down Expand Up @@ -493,4 +495,11 @@ class GrpcToLogStreamGateway(
// TODO handle
}
}

private fun getVersionInfo(): String {
val ezeVersion = javaClass.`package`.implementationVersion ?: "dev"
val zeebeVersion = RecordMetadata::class.java.`package`.implementationVersion ?: "dev"

return "$ezeVersion ($zeebeVersion)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ class EngineClientTest {
assertThat(topology.clusterSize).isEqualTo(1)
assertThat(topology.replicationFactor).isEqualTo(1)
assertThat(topology.partitionsCount).isEqualTo(1)
assertThat(topology.gatewayVersion).isEqualTo("A.B.C")
assertThat(topology.gatewayVersion)
.describedAs("Expect a version with the pattern 'dev (8.1.8)'")
.containsPattern("""dev \(8\.\d+\.\d+(-.*)?\)""")

assertThat(topology.brokers).hasSize(1)
val broker = topology.brokers[0]
assertThat(broker.host).isEqualTo("0.0.0.0")
assertThat(broker.port).isEqualTo(26500)
assertThat(broker.version).isEqualTo("X.Y.Z")
assertThat(broker.version)
.describedAs("Expect a version with the pattern 'dev (8.1.8)'")
.containsPattern("""dev \(8\.\d+\.\d+(-.*)?\)""")

assertThat(broker.partitions).hasSize(1)
val partition = broker.partitions[0]
Expand Down

0 comments on commit 0783108

Please sign in to comment.