Skip to content

Healthchecks plugin init first#9264

Closed
svlachakis wants to merge 12 commits into
masterfrom
healthchecks-init-first
Closed

Healthchecks plugin init first#9264
svlachakis wants to merge 12 commits into
masterfrom
healthchecks-init-first

Conversation

@svlachakis

@svlachakis svlachakis commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Initialise Health Checks Plugin first, in order to be able to always override properly by other modules like Arbitrum, regardless of the alphabetical order.

Previous discussion on this PR #9131

@svlachakis

svlachakis commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

@LukaszRozmej @asdacap concerning #9131 (review), We need to initialise HealthCheckPlugin always first, so Autofac can override properly from any other modules with the rule of "last initialised wins".

The other option would be to do something like that in HealthChecksPlugin.cs

            builder.RegisterType<ClHealthRequestsTracker>()
                .As<IClHealthTracker>()
                .As<IEngineRequestsTracker>()
                .SingleInstance()
                .PreserveExistingDefaults();

But that's even worse because it depends on the module's alphabetical order.

Please let me and @damian-orzechowski know your thoughts!

@asdacap

asdacap commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

What thing do healthcheckplugin need to override?

@svlachakis

svlachakis commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

What thing do healthcheckplugin need to override?

HealthCheckPlugin shouldn't override something, but it should be overriden.

We shouldn't have CL health checks in arbitrum like that NethermindEth/nethermind-arbitrum#206

My initial approach was this one #9131

@asdacap

asdacap commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

So... what is the problem with NethermindEth/nethermind-arbitrum#206?

@svlachakis

Copy link
Copy Markdown
Contributor Author

So... what is the problem with NethermindEth/nethermind-arbitrum#206?

The problem is that by default Autofac's rule is to keep the latest initialisation and ArbitrumPlugin is initialized before HealthChecksPlugin because of Alphabetical order so override doesn't work.

@asdacap

asdacap commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Ahh... okok. Make sense. Can you move the Priority property in IConsensusWrapperPlugin to INethermindPlugin and use that instead? It would make the solution more reusable.

@svlachakis

svlachakis commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

Ahh... okok. Make sense. Can you move the Priority property in IConsensusWrapperPlugin to INethermindPlugin and use that instead? It would make the solution more reusable.

Sure, the question is more of architectural approach, whether we prefer this change in priority over this approach #9131 (It has merge conflicts right now but you can see the point)

Comment on lines +97 to +98
if (f.Name == "HealthChecksPlugin") return -1;
if (s.Name == "HealthChecksPlugin") return 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not put it ahead in PluginOrder?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since we all feel like that this approach is better, I'll make it work through priority - thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@LukaszRozmej ArbitrumPlugin is IConsensusPlugin so it always goes at front

@svlachakis

svlachakis commented Sep 11, 2025

Copy link
Copy Markdown
Contributor Author

I've made some refactoring to keep the old functionallity + HealthCheck at the beginning + Priority field but I still don't like it I think we need to simplify it even more.

Tests are also commented out only for now.

@LukaszRozmej LukaszRozmej left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't look that bad

Comment thread src/Nethermind/Nethermind.Api/Extensions/PluginLoader.cs Outdated
Comment on lines +164 to +165
if (p.GetType().Name == "HealthChecksPlugin")
return -2000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why still custom code?

@svlachakis svlachakis Sep 11, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because if we want to keep the rule consensus first as number one, healthchecks need somehow to overrule that 😞 That's why I said maybe we need to simplify things here at standup

@svlachakis

Copy link
Copy Markdown
Contributor Author

slightly changed the approach based on our discussion with @asdacap #9308

@svlachakis

Copy link
Copy Markdown
Contributor Author

Replaced by #9308

@svlachakis svlachakis closed this Sep 18, 2025
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.

3 participants