Skip to content

feat: telemetry for shard handoff#32888

Merged
sebastian-alfers merged 1 commit intosharding-telemetryfrom
shard-handoff-latency
Feb 17, 2026
Merged

feat: telemetry for shard handoff#32888
sebastian-alfers merged 1 commit intosharding-telemetryfrom
shard-handoff-latency

Conversation

@sebastian-alfers
Copy link
Contributor

No description provided.

typeName: String): Unit =
instrumentations.foreach(_.incrementShardRegionBufferSize(selfAddress, shardRegionActor, typeName))

override def beginnShardHandoff(selfAddress: Address, shardCoordinatorActor: ActorRef, typeName: String): Unit =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo nn

import Internal._

private val instrumentation = ClusterShardingInstrumentationProvider.get(context.system).instrumentation
val cluster = Cluster(context.system)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private

private val instrumentation = ClusterShardingInstrumentationProvider.get(context.system).instrumentation
val cluster = Cluster(context.system)

instrumentation.beginnShardHandoff(cluster.selfAddress, self, typeName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be good to include shard since this is a handoff for a specific typeName and shard

if (ok) {
instrumentation.finishedShardHandoffOk(cluster.selfAddress, self, typeName)
} else {
instrumentation.finishedShardHandoffNotOk(cluster.selfAddress, self, typeName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could consider having only finishedShardHandoff with ok: Boolean as parameter?

}

override def beginnShardHandoff(selfAddress: Address, shardCoordinatorActor: ActorRef, typeName: String): Unit = {
println("ok jea >?>>")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember cleanup of such

selfAddress: Address,
shardRegionActor: ActorRef,
typeName: String): Unit = {
counter.incrementAndGet()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps counter should have a more specific name now?

override def finishedShardHandoffOk(selfAddress: Address, shardCoordinatorActor: ActorRef, typeName: String): Unit = {
println("ok jea >?>> FINNNNNNN")
val currentValue = shardHandoffDuration.get()
shardHandoffDuration.set(System.currentTimeMillis() - currentValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment here, avoid clock?

selfAddress: Address,
shardCoordinatorActor: ActorRef,
typeName: String,
shard: String): Unit = beginShardHandoffDurationCounter.incrementAndGet()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not latency though, it is a counter. Latency would be a timestamp at begin to and then one at finish to calculate the time it took.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it is just the test counting NVM!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thanks for pointing out. I now avoid the term "latency" at all, as you are correct here!

@sebastian-alfers sebastian-alfers changed the title feat: latency for shard handoff feat: telemetry for shard handoff Feb 12, 2026
@sebastian-alfers sebastian-alfers merged commit ecee976 into sharding-telemetry Feb 17, 2026
10 checks passed
@sebastian-alfers sebastian-alfers deleted the shard-handoff-latency branch February 17, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants