Skip to content
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

Add a metric for diagram generations in the thread pool #131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SlimaneAmar
Copy link
Contributor

No description provided.

@SlimaneAmar SlimaneAmar force-pushed the monitoring-execution-queue branch 2 times, most recently from 274d483 to 6e3e4f3 Compare December 27, 2024 14:25
@SlimaneAmar SlimaneAmar force-pushed the monitoring-execution-queue branch from 6e3e4f3 to 46852fa Compare December 27, 2024 14:40
Signed-off-by: Slimane AMAR <amarsli@gm0winl104.bureau.si.interne>
@SlimaneAmar SlimaneAmar force-pushed the monitoring-execution-queue branch from 46852fa to a6181a1 Compare December 30, 2024 09:00
Copy link
Collaborator

@antoinebhs antoinebhs left a comment

Choose a reason for hiding this comment

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

Some code comments, will test tomorrow

pom.xml Show resolved Hide resolved
* @author Slimane Amar <slimane.amar at rte-france.com>
*/
@Service
public class DiagramGenerationExecutionService {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe NetworkAreaExecutionService as it's not used for the SLD?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 36 to 40
MultiGauge multiGauge = MultiGauge.builder(TASK_POOL_METER_NAME).description("The number of diagram generations (tasks) in the thread pool").register(meterRegistry);
multiGauge.register(List.of(
MultiGauge.Row.of(Tags.of(TASK_TYPE_TAG_NAME, TASK_TYPE_TAG_VALUE_CURRENT), threadPoolExecutor::getActiveCount),
MultiGauge.Row.of(Tags.of(TASK_TYPE_TAG_NAME, TASK_TYPE_TAG_VALUE_PENDING), () -> threadPoolExecutor.getQueue().size())
));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure to understand why we need a multigauge here as the number of tags is constant and equal to 2. From my understanding multigauge are useful if the number of tags vary.
Here, it seems simpler to have two gauges (one for current, one for pending)?

Copy link
Contributor Author

@SlimaneAmar SlimaneAmar Jan 3, 2025

Choose a reason for hiding this comment

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

Wiith Jauge.builder we can't have a value supplier different for different tags !


@Autowired
private SingleLineDiagramService singleLineDiagramService;
private final DiagramGenerationExecutionService diagramExecutionService;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why inject this here and not in the service directly ?
Move diagramExecutionService in NetworkAreaDiagramService.java?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 279 to 281
return diagramExecutionService
.supplyAsync(() -> networkAreaDiagramService.getNetworkAreaDiagramSvg(networkUuid, variantId, voltageLevelsIds, depth, withGeoData))
.get();
Copy link
Collaborator

Choose a reason for hiding this comment

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

this could simplify to

Suggested change
return diagramExecutionService
.supplyAsync(() -> networkAreaDiagramService.getNetworkAreaDiagramSvg(networkUuid, variantId, voltageLevelsIds, depth, withGeoData))
.get();
return networkAreaDiagramService.getNetworkAreaDiagramSvg(networkUuid, variantId, voltageLevelsIds, depth, withGeoData));

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want it to be used for SLD and NAD, it makes sense to have it here. But from the code, it looks specialized to NAD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@SlimaneAmar SlimaneAmar requested a review from antoinebhs January 3, 2025 14:49
@SlimaneAmar SlimaneAmar force-pushed the monitoring-execution-queue branch 2 times, most recently from 68a392f to 22916da Compare January 3, 2025 15:11
Signed-off-by: Slimane AMAR <amarsli@gm0winl104.bureau.si.interne>
@SlimaneAmar SlimaneAmar force-pushed the monitoring-execution-queue branch from 22916da to 3924027 Compare January 3, 2025 15:19
Copy link
Collaborator

@antoinebhs antoinebhs left a comment

Choose a reason for hiding this comment

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

Code OK

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.

2 participants