Skip to content

Expose ThreadPoolTaskExecutor queue size and capacity for metrics#28583

Closed
rguihard wants to merge 1 commit into
spring-projects:mainfrom
rguihard:patch-1
Closed

Expose ThreadPoolTaskExecutor queue size and capacity for metrics#28583
rguihard wants to merge 1 commit into
spring-projects:mainfrom
rguihard:patch-1

Conversation

@rguihard

@rguihard rguihard commented Jun 8, 2022

Copy link
Copy Markdown

We're using grafana to monitor our app through java jmx exporter. We planned to configure some alerts based on those metrics, and we think it could be interesting to have at least the currentQueueCapacity for this purpose since the queue size directly affects the app memory load.
(Having the queueCapacity seems also interesting to set up triggers whose trigger value are calculated based on the maximum capacity of the queue.)

We're using grafana to monitor our app through java jmx exporter. We planned to configure some alerts based on those metrics, and we think it could be interesting to have at least the currentQueueCapacity for this purpose  since the queue size directly affects the app memory load.
(Having the queueCapacity seems also interesting to set up triggers whose trigger value are calculated based on the maximum capacity of the queue.)
@pivotal-cla

Copy link
Copy Markdown

@rguihard Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 8, 2022
@pivotal-cla

Copy link
Copy Markdown

@rguihard Thank you for signing the Contributor License Agreement!

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 8, 2022
@sbrannen sbrannen self-assigned this Jun 8, 2022
@sbrannen sbrannen added this to the 5.3.21 milestone Jun 8, 2022
@sbrannen sbrannen changed the title Expose ThreadPoolTaskExecutor metrics to JMX Expose ThreadPoolTaskExecutor queue size and capacity for metrics Jun 8, 2022
sbrannen pushed a commit that referenced this pull request Jun 8, 2022
We use Grafana to monitor our app via Spring's JMX exporter, and we
think it could be interesting to have at least the current queue size
for this purpose since the queue size directly affects the app memory
load. Having the queue capacity seems also interesting to set up
triggers whose values are calculated based on the maximum capacity of
the queue.

This commit introduces new getCurrentQueueSize() and getQueueCapacity()
methods in ThreadPoolTaskExecutor.

See gh-28583
@sbrannen sbrannen closed this in 8478e8e Jun 8, 2022
@sbrannen

sbrannen commented Jun 8, 2022

Copy link
Copy Markdown
Member

This has been merged into 5.3.x and main in e386bdb and revised in 8478e8e.

Note that there were build failures due to Checkstyle violations. I fixed those for you, but please make sure to run ./gradlew check before pushing commits in the future to ensure that the build passes.

Thanks for contributing your first PR to the Spring Framework! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants