Skip to content

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
29 of 33 checks passed
@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