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 activation priority for config object types #6270

Merged
merged 1 commit into from May 4, 2018

Conversation

Crunsher
Copy link
Contributor

@Crunsher Crunsher commented Apr 27, 2018

This PR adds an activation_priority option to all icinga objects. Objects are activated in order of their activation, with the lowest going first and the highest last.
The default is 0.

Currently the priorities are as follows

  • -100:
    Loggers (FileLogger, SyslogLogger) We want these first to make sure any errors are logged
  • 0:
    Everything else. Mostly Config items (Hosts, Services, Downtimes...)
  • 50:
    ApiListener. Stated after config but as the first feature since we want it available asap. A bit of premature optimization possibly.
  • 100:
    Features (CheckerComponent, CheckResultReader, CompatLogger, ExternalCommandListener, StatusDataWriter, IdoConnections, LivestatusListener, NotificationComponent, ElasticSearchWriter, GelfWriter, GraphiteWriter, InfluxdbWriter, OpenTsdbWriter) These are activated last to make sure they don't act before all config objects are there.

fixes #6057
fixes #6231

@Crunsher Crunsher added the area/configuration DSL, parser, compiler, error handling label Apr 27, 2018
@Crunsher Crunsher added this to the 2.9.0 milestone Apr 27, 2018
@Crunsher
Copy link
Contributor Author

This is still a WIP (there are debug messages and a sleep to help debug). Please use this PR to discuss changes to the Priorities.

@dnsmichi
Copy link
Contributor

So far, this works fine in my tests in provoking notifications prior to a downtime object.

@dnsmichi dnsmichi added the enhancement New feature or request label Apr 30, 2018
@dnsmichi dnsmichi self-assigned this May 2, 2018
This patch ensures that specific configuration types
are pre-activated and post-activated. In general,
logging is first, then common configuration objects
like host/service, downtimes, etc.
In the end, all features are activated after to ensure
that notifications are only sent once downtimes are applied.
A similar thing happens for starting with checks too early.
The ApiListener feature runs first to allow cluster connections
at first glance.

fixes #6057
fixes #6231
@dnsmichi dnsmichi force-pushed the feature/activation-priority branch from bb03e6b to c54e042 Compare May 4, 2018 09:26
@dnsmichi dnsmichi changed the title [WIP] Add activation priority to objects Add activation priority for config object types May 4, 2018
@dnsmichi
Copy link
Contributor

dnsmichi commented May 4, 2018

Squashed, amended and rebased. Looks good to me.

@dnsmichi
Copy link
Contributor

dnsmichi commented May 4, 2018

Technical note:

The patch adds a feature to our class compiler which parses the .ti files into actual code. This renders it easier to specify the priority just for the type instance from any library. This is necessary since lib/config doesn't know anything about our config object types.

The major change happens in the config compiler within ActivateItems() where the type sort order relies on the priority and enforces that on the config object activation order.

@dnsmichi
Copy link
Contributor

dnsmichi commented May 4, 2018

Note aside: This is a big change and should be tested with the snapshot packages once available. Backports are only an option after successful tests with the snapshot packages.

@dnsmichi dnsmichi merged commit 40dfd82 into master May 4, 2018
@dnsmichi dnsmichi deleted the feature/activation-priority branch May 4, 2018 09:42
@ekeih
Copy link
Contributor

ekeih commented May 4, 2018

Thank you for this fix! Especially @Crunsher 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling enhancement New feature or request
Projects
None yet
3 participants