-
Notifications
You must be signed in to change notification settings - Fork 597
Change ElasticsearchWriter to write perfdata as an array of objects #10518
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
base: master
Are you sure you want to change the base?
Conversation
Prior to this change the ElasticsearchWriter created a new field for every metric in check command. This leads to a vast number of fields in the indices, aka a field mapping explosion. Now, it uses an array of objects. This avoids the explosion, Makes the index fields more predictable when searching and Makes the perfdata independently searchable.
Tested it successfully with:
|
First, thanks for your PR. How is this change reflected in the ElasticSearch? Will this break compatibility due to the format change, especially for custom dashboards? |
This will change the format of what is written to Elasticsearch from this: "check_result.perfdata.load1.crit": 10,
"check_result.perfdata.load1.min": 0,
"check_result.perfdata.load1.value": 0.24,
"check_result.perfdata.load1.warn": 5, To this: "check_result.perfdata": [
{
"crit": 10,
"label": "load1",
"min": 0,
"value": 0.24,
"warn": 5
}
] Since existing Elasticsearch indices use a dynamic field mapping, no changes will have to be made in Elasticsearch (unless the users have a fixed mapping, but I doubt that, because of the current design of the fields that wouldn't be practical). But yes, custom dashboards will break. However, as described in the issue, the current designed was flawed from the beginning. Creating new fields for the metrics is not how this should have been done in the first place. In the SQL world this would be equal to creating a new column for each new metric, which would make no sense. |
This issue here also makes some valid points: #6805
|
As discussed offline, I generally support this PR, even if it results in breakages. However, I would like to test it before approving it. Since I don't currently have a testing ES setup, this may take a while. |
A quick and simple Elasticsearch/OpenSearch setup can be done with:
Here some example calls:
|
Hi,
Let me preface this PR with: I'm not a C++ developer. So please excuse my C++, tried my best, feedback is welcome.
Prior to this change the ElasticsearchWriter created a new field for every metric in check command. This leads to a vast number of fields in the indices, aka a field mapping explosion.
Now, it uses an array of objects. This avoids the explosion, Makes the index fields more predictable when searching and Makes the perfdata independently searchable.
How the new output looks like:
The resulting mapping in the index:
Users can decide themselves if they want a custom mapping in the index that will cause the
perfdata
field to be anested
type.Fixes #10511