Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Is there a way to find out how many threads are active in the thread pool? #2783

Closed
Phoebus888 opened this issue Mar 13, 2024 · 1 comment
Closed

Comments

@Phoebus888
Copy link

Phoebus888 commented Mar 13, 2024

My code is as follows

    @Override
    public void bindTo(MeterRegistry registry) {
        EventLoopGroupProvider provider = clientResources.eventLoopGroupProvider();
        //Total thread pool
        registry.gauge("lettuce.pool.size", provider, EventLoopGroupProvider::threadPoolSize);
        //Active thread pool
       How does the code implement
    }

Now I want to add a method to get the size of the running thread pool to the metrics for monitoring, how to implement

@mp911de
Copy link
Collaborator

mp911de commented Mar 13, 2024

You can implement EventLoopGroupProvider to decorate DefaultEventLoopGroupProvider.
However, the concept of EventLoopGroup is to configure it with a fixed number of threads and the executor service will spin up that many threads so your gauge could be also configured with the values of computationThreadPoolSize and ioThreadPoolSize provided to ClientResources.Builder.

@redis redis locked and limited conversation to collaborators Mar 13, 2024
@mp911de mp911de converted this issue into discussion #2784 Mar 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants