-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[influxdb] Add option for using metadata value as measurement name #9943
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @DerOetzi
But I see some problems with this because it will break the query part of the addon:
- A complete solution should add also itemName as a tag when this option is used and make query part intelligent to use that logic.
- Also I would like to include test covering that new functionality.
- I added also some minor notes in your code
bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes explained in previous comment
The itemname is already always included as tag, if I see this correct. But your right I missed the query part. Please review my changes on this.
I have added some tests. Please give me feedback, whether they are enough like this.
Renamed the things you commented |
...nfluxdb/src/main/java/org/openhab/persistence/influxdb/internal/ItemToStorePointCreator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @lujop Can you have a second look at this pull request and approve if ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your modifications, I haven't had time to test but it seems ok.
Only two minor things.
....influxdb/src/main/java/org/openhab/persistence/influxdb/internal/InfluxDBMetadataUtils.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
I did some refactoring of my code as mentioned above there is no configuration flag for service anymore, but it just checks whether there is a metadata value or not. But while doing the refactoring I think I have found a bug inside the existing code, of ItemToStorePointCreator which wasn't noticed because of a missing test case. But I'm not sure and need your experience with the code @lujop and @Hilbrand. At the I have added now such testcase to the ItemToStorePointCreator file as well, which fails although with the old code, without my changes because it tries to access MetadataKey in addPointTags as well. My question is it a valid item name with a dot, then the question is how to access metadata with such items, or is this testcase invalid in the FilterQuery test? |
I did some further research from what I see so far an item name cannot contain a dot because this will always fail here: So I think the testcase is not valid and I would remove it? |
...xdb/src/test/java/org/openhab/persistence/influxdb/internal/ItemToStorePointCreatorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, I apologize for not being able to review the addon before.
Today I've been able to build and test it for InfluxDB 2 and worked correctly.
The code seems good to me also.
I only made a little commit with some minor documentation changes and suggested a change in a condition expanding the negation to make reading the condition clearer. Please accept the commit suggestion.
Good work, and thank you very much for the PR.
...org/openhab/persistence/influxdb/internal/influx1/Influx1FilterCriteriaQueryCreatorImpl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the unused parameter from config.
bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Johannes Ott <info@johannes-ott.net>
…y builder to find data in correct measurement. Add tests for new feature. Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
…-INF/config/config.xml Co-authored-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
…nhab/persistence/influxdb/internal/influx1/Influx1FilterCriteriaQueryCreatorImpl.java Co-authored-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
Thanks for your constructive review comments. Think we found a good solution together now. |
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Signed-off-by: Johannes Ott <info@johannes-ott.net>
Please don't merge yet I think I have found another problem on restoring item states |
Signed-off-by: Johannes Ott <info@johannes-ott.net>
@lujop can you please recheck my last changes to V1 Query parts. As I noticed there was a bug because tem-tags where not accquired. |
Sure, let me find some time and I will install InfluxDB1 and do some more detailed testing |
I have installed a v1.8 docker container and did some more testing myself. For me everything seems to work fine now, but I would be very glad, if find the time to check it as well @lujop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done some testing with InfluxDB1 and it seems to be working correctly.
Thanks for the fixs.
@Hilbrand It seems ok to be integrated for me. |
As @Hilbrand already approved on Feb 3, I'd say we can merge. 👍 |
…penhab#9943) * Add option for using metadata value as measurement name Also-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net> Signed-off-by: John Marshall <john.marshall.au@gmail.com>
…penhab#9943) * Add option for using metadata value as measurement name Also-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
…penhab#9943) * Add option for using metadata value as measurement name Also-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
…penhab#9943) * Add option for using metadata value as measurement name Also-by: Joan Pujol <joanpujol@gmail.com> Signed-off-by: Johannes Ott <info@johannes-ott.net>
Add option for using the metadata value as measurement name. Part of solution for #9556
Signed-off-by: Johannes Ott info@johannes-ott.net