Feature/tags for elasticsearchwriter#10074
Conversation
|
Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA). Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA. After that, please reply here with a comment and we'll verify. Contributors that have not signed yet: @SebastianOpeni Details
|
|
The CLA should be signed now. |
|
@cla-bot check |
yhabteab
left a comment
There was a problem hiding this comment.
Hi, thanks for your contribution! I've just been looking over the code changes and left some inline comments below, but haven't tested it with an Elastic/OpenSearch instance yet. Other than that, can you please rebase this against the current master to fix the GitHub actions. Thanks!
|
Hi thanks for your review :) |
44a55ec to
2f3c2fa
Compare
lib/perfdata/elasticsearchwriter.cpp
Outdated
| } | ||
| } | ||
| } | ||
| fields->Set("tags", tags); |
There was a problem hiding this comment.
I'm not quite sure if tags is the right field for this. Isn't it common that tags is just a simple list instead of key-value pairs? I would set a different field or make it configureable.
There was a problem hiding this comment.
The field tags as a dictionary was used because the influxdb-writer is also using it that way.
The functionality would stay the same with a different field name so if you have a preference I could change it accordingly.
(labels would come to mind as a alternative.)
There was a problem hiding this comment.
I gave it some thought and I could also simply allow tags to be of type array. (in addition to dict)
That would change some of the logic we had reviewed until now but if that would be preferred by you, I could also implement it that way.
There was a problem hiding this comment.
Isn't it common that
tagsis just a simple list instead of key-value pairs?
I'm afraid, in perfdata DB context, they indeed are key-value pairs:
There was a problem hiding this comment.
I'm afraid, in perfdata DB context, they indeed are key-value pairs:
Please show me where we set a field called tags in one of them. Supporting tags in both just means adding key-value pairs, with no reference to a tags field, right?. But here we set the field where I wonder if users of Elasticsearch or similar would expect a list rather than key-value pairs. tag_set sounds more reasonable to me. Anyway, before we just merge this, I'd like to get an informed opinion.
There was a problem hiding this comment.
For Icingas influxdbcommonwriter this is done here:
https://github.com/Icinga/icinga2/blob/master/lib/perfdata/influxdbcommonwriter.cpp#L253
But tags never reaches Influx DB.
The graphite writer does only allow to configure templates for the host and service name.
Otherwise there would not be a tags field either.
There was a problem hiding this comment.
Found it as well just after Commenting. 🙈
That was my bad.
I'm very sorry for the confusion.
There was a problem hiding this comment.
To prevent confusion about the Type of tags, would you prefer to:
- Rename the field to
tag_setor - Add the configured key-values directly into the elasticSearch-Entries as done in the influxdb case?
There was a problem hiding this comment.
To prevent confusion about the Type of
tags, would you prefer to:
- Rename the field to
tag_setor
I think a tag_set property would be rather confusing in ES/Kibana.
- Add the configured key-values directly into the elasticSearch-Entries as done in the influxdb case?
This, in contrast, has the advantages:
- No
tags.boilerplate in our ES data - Consistency with InfluxDB
There was a problem hiding this comment.
After my changes the configured tags are now added to the root element.
That also allows for tags = ["foo", "bar"] if desired.
Notice:
Since the templated_tags are added after the default fields and the performance Values this change will also allow to overwrite them.
|
Thanks for your answers in the review. |
|
Apart from #10074 (comment), code wise it should be fine now, I haven't tested it with a actual ElasticSearch instance though, but till I get the time, some of my colleagues might want a look at this as well. |
lib/perfdata/elasticsearchwriter.cpp
Outdated
| } | ||
| } | ||
| } | ||
| fields->Set("tags", tags); |
There was a problem hiding this comment.
Isn't it common that
tagsis just a simple list instead of key-value pairs?
I'm afraid, in perfdata DB context, they indeed are key-value pairs:
There was a problem hiding this comment.
I tested this today with ElasticSearch 7.17.25 and it seems to be working fine 👍🏼. Though , whilst going through the changes again, I just noticed two small things, see inline comments below.
Edit: While you're at it, please rebase this against the master branch to get the GHAs pass.
b64788f to
14c47d2
Compare
|
I think I worked on all your requested changes, and you also marked them as resolved, but somehow they are still blocking the pipeline 🤔 |
Hi, yes, thanks for that! Unfortunately, the GitHub actions were changed again with #10253 just after you rebased this against the master branch. You just need to rebase and force push again :)! |
14c47d2 to
cbe7cc9
Compare
|
Thanks for your fast reply :) |
|
The checks seem to be not the problem, but rather github does not register that we closed all your previously existing change requests. I think I have to "re-request" a review from you. 🤔 |
|
Happy new year and nice to hear from you 😃 |
cbe7cc9 to
c78c7de
Compare
Thanks! But it would have been enough to just check the |
c78c7de to
54cb29e
Compare
Since @lippserd requested a change in #10074 (comment) not to send the tags fields to elastic search, so I wanted to know whether the changed (flattened) version of those matches his expectation. |

Offers to add additional tags to entries written by the ElasticSearchWriter.
As discussed with Eric at the icinga summit we are submitting this feature. Please revise the code and let us know if there is something we need to improve. otherwise we would be happy for timely merge.
fixes #6837