Skip to content

Use global counter as an MBean ID for WSTP#4186

Merged
djspiewak merged 1 commit intotypelevel:series/3.xfrom
iRevive:metrics-pool-id
Dec 8, 2024
Merged

Use global counter as an MBean ID for WSTP#4186
djspiewak merged 1 commit intotypelevel:series/3.xfrom
iRevive:metrics-pool-id

Conversation

@iRevive
Copy link
Contributor

@iRevive iRevive commented Nov 27, 2024

I cherry-picked the ID idea from #3813 since it was pushed to 3.7.

I guess the hash helps to make it unique, but it actually doesn't guarantee that. I wonder if instead we can use a global AtomicLong counter. That is guaranteed to be unique, and in the happy path (one global runtime) it will always be 0 which should be nice enough for easy access. WDYT?

It should be easier to use with MBeans and metrics, too.

try {
val localQueueSamplerName = new ObjectName(
s"cats.effect.unsafe.metrics:type=LocalQueueSampler-$hash-$i")
s"cats.effect.unsafe.metrics:type=LocalQueueSampler-$threadPoolId-$i")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unlike #3813, there is no global counter for queues. Pool ID + queue index should be a unique combination.

@djspiewak djspiewak merged commit 61a2ad9 into typelevel:series/3.x Dec 8, 2024
@iRevive iRevive deleted the metrics-pool-id branch December 8, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants