Eric Lippmann
ccda48234e
Use custom logger for accessing the interval for periodic logging
2021-11-05 17:57:22 +01:00
Eric Lippmann
8ec157e39b
Add periodic logging for runtime updates
2021-11-05 17:52:48 +01:00
Eric Lippmann
6232773943
Use debug instead of info for some log messages
...
These log messages are not relevant for the info level.
2021-11-05 17:52:48 +01:00
Eric Lippmann
2d4b5419af
Log which history sync started
2021-11-05 17:52:48 +01:00
Eric Lippmann
5fd4d35907
Remove syncing $subject log message
...
This info message just pollutes the logs and
for debugging we log the execution anyway
2021-11-05 17:52:46 +01:00
Eric Lippmann
43bcd2bbee
Remove syncing $redisKey log message
...
This info message just pollutes the logs and
for debugging we log the execution anyway.
2021-11-05 17:52:11 +01:00
Eric Lippmann
8ce917d45a
Remove waiting for heartbeat message
...
If a heartbeat is pending,
we log it every 60 seconds anyway.
2021-11-05 17:52:11 +01:00
Eric Lippmann
313e3cc735
Log time taken for the config and initial state sync
2021-11-05 17:52:11 +01:00
Eric Lippmann
bd23f17eda
Use pkg periodic for database logs
2021-11-05 17:52:10 +01:00
Eric Lippmann
8e7564b2aa
Log which delta finished
2021-11-05 17:18:05 +01:00
Eric Lippmann
d6a28d7672
Use pkg periodic for history sync logs
2021-11-05 17:18:05 +01:00
Eric Lippmann
4b239d69bb
Use debug instead of info for overdue refresh logs
2021-11-05 17:18:05 +01:00
Eric Lippmann
12525c7872
Use pkg periodic for overdue sync logs
2021-11-05 17:18:05 +01:00
Eric Lippmann
b10d038ba8
Use internal.LoggingInterval()
2021-11-05 17:18:05 +01:00
Eric Lippmann
dbb64a0de3
Log how many items to insert
2021-11-05 17:18:05 +01:00
Eric Lippmann
addfabbde1
Speak of items instead of rows
2021-11-05 17:18:05 +01:00
Eric Lippmann
5f1639aca2
Use pkg periodic for Redis logs
2021-11-05 17:18:05 +01:00
Eric Lippmann
a6e02e7f3c
Introduce Counter.Total()
2021-11-05 17:18:05 +01:00
Eric Lippmann
c335a3c99c
Introduce package periodic
2021-11-05 17:18:05 +01:00
Eric Lippmann
986e685ee0
Allow to configure interval for periodic logging
2021-11-05 17:18:05 +01:00
Eric Lippmann
b067ed2147
Introduce Counter.Reset()
2021-11-05 17:18:05 +01:00
Eric Lippmann
8a03745273
Speak of Icinga heartbeat not Icinga 2 heartbeat
2021-11-05 17:18:03 +01:00
Eric Lippmann
797dc1968c
Comment out component-logging level pairs
...
Otherwise they would default to the info level.
2021-11-05 17:16:57 +01:00
Eric Lippmann
dc7511cd25
Don't log if context is canceled
2021-11-05 17:16:57 +01:00
Julian Brost
54dbe0cfbe
Merge pull request #391 from Icinga/bugfix/multi-environment
...
Better handling of multiple environments
2021-11-05 16:55:21 +01:00
Julian Brost
82cf600c55
Merge pull request #401 from Icinga/flawed-config-keys-and-validation
...
Fix flawed config keys and validation
2021-11-04 15:01:51 +01:00
Julian Brost
74fb238923
Increase Redis schema version
...
PR #391 and icinga2#9036 changed where the environment is read from in an
incompatible way, therefore the schema version bump.
2021-11-03 15:47:38 +01:00
Julian Brost
6cf9266655
Update schema comments to match new use of environments
...
There was a change to how environments work in icinga2 that affects how many
IDs are structured: https://github.com/Icinga/icinga2/pull/9036
2021-11-03 15:47:38 +01:00
Julian Brost
aedfa8aeba
No longer skip environment tests and adapt them to new behavior
2021-11-03 15:47:38 +01:00
Julian Brost
3342191b5e
Exit on environment ID changes
...
There's a small risk that when the environment ID changes, Icinga DB could
update write into the wrong environment in the database. Therefore,
https://github.com/Icinga/icinga2/pull/9036 introduced a new default
environment ID based on the CA public key so that there should be no cases
where it's required to change the actual environment ID. So if this happens
nonetheless, just bail out.
2021-11-03 15:47:38 +01:00
Julian Brost
9b02b18f46
Use new environment ID
...
https://github.com/Icinga/icinga2/pull/9036 introduced a new environment ID for
Icinga DB that's written to the icinga:stats stream as field
"icingadb_environment". This commit updates the code to make use of this ID
instead of the one derived from the Icinga 2 Environment constant.
2021-11-03 15:47:38 +01:00
Eric Lippmann
a081927672
Only sync entities that belong to the current environment
...
Previously, we selected each entity from the database.
Now we only select entities that belong to the current environment.
2021-11-03 15:47:38 +01:00
Eric Lippmann
6b5aac9154
Config: Validate max_rows_per_transaction
2021-11-03 15:26:20 +01:00
Eric Lippmann
dac4a7246a
Config: Validate max_placeholders_per_statement
2021-11-03 15:26:01 +01:00
Eric Lippmann
15eb9b471f
Don't use CamelCase for config keys
2021-11-03 15:25:16 +01:00
Eric Lippmann
563aafaf90
Config: Validate xread_count
2021-11-03 15:23:40 +01:00
Eric Lippmann
084e0409bc
Restart HA after environment change
...
If the environment changes during runtime, we have to restart HA
in order to stop a possibly running config sync and start a new
one.
2021-11-03 14:51:19 +01:00
Eric Lippmann
e74b09daa1
Use synctx instead of ctx
...
Otherwise, code that is executed with ctx will not be cancelled if
the synchronization is cancelled, e.g. in the case of heartbeat
handovers.
2021-11-03 14:51:13 +01:00
Eric Lippmann
26a184d953
Make v1.Environment#Name types.String
...
The default environment of Icinga is the empty string.
In Golang, the zero value of string is also the empty string.
But it makes sense to distinguish whether the name is not set
or set to the empty string. That is possible with this change.
2021-11-03 14:49:56 +01:00
Eric Lippmann
54f9ef5a12
Insert environment
...
With this change Icinga DB will insert the environment after each
heartbeat takeover if it does not already exist in the database as
the environment may have changed, although this is likely to happen
very rarely,
Instead of checking whether the environment already exists,
uses an INSERT statement that does nothing if it does.
2021-11-03 14:49:56 +01:00
Eric Lippmann
4a659fd5c4
Add db.BuildIgnoreStmt()
2021-11-03 14:49:56 +01:00
Julian Brost
cd9e683faa
Merge pull request #393 from Icinga/feature/history-ha
...
Sync history independent of HA
2021-11-03 14:17:14 +01:00
Julian Brost
f290a0c9b7
Merge pull request #392 from Icinga/feature/history-deterministic-ids
...
Make {NotificationHistory,StateHistory,History*}#Id UUID -> SHA1
2021-11-03 13:18:11 +01:00
Alexander A. Klimov
b39eac660f
Replace Apache 2.0 licensed gopkg.in/yaml.v3 with MIT licensed github.com/goccy/go-yaml
...
... not to have GPLv2<->Apache 2.0 (app<->deps) license conflicts.
2021-11-03 12:22:21 +01:00
Alexander A. Klimov
47d5e80a05
Raise expectedRedisSchemaVersion 1 -> 2
2021-11-03 12:15:25 +01:00
Alexander A. Klimov
d903d05c82
Make History*#Id UUID -> SHA1
2021-11-03 12:15:25 +01:00
Alexander A. Klimov
52ae34a6f8
Make {NotificationHistory,StateHistory}#Id UUID -> SHA1
2021-11-03 12:15:25 +01:00
Alexander Aleksandrovič Klimov
cbbea6bd85
Merge pull request #297 from Icinga/customvar-flat-runtime-updates
...
Sync customvar flat runtime updates
2021-11-02 12:26:00 +01:00
Alexander A. Klimov
660d8c7d5a
Sync history independent of HA
2021-10-29 20:32:04 +02:00
Eric Lippmann
c29a70272d
Merge pull request #387 from Icinga/dependabot/go_modules/github.com/go-redis/redis/v8-8.11.4
...
Bump github.com/go-redis/redis/v8 from 8.11.3 to 8.11.4
2021-10-27 22:30:59 +02:00