victronenergy / venus-influx-loader

NodeJS server that takes from MQTT into Influx, and config UI and still more
MIT License
14 stars 7 forks source link

Feature Request: Support dotted syntax in measurement name #82

Open mman opened 7 months ago

mman commented 7 months ago

As suggested in the PR: https://github.com/victronenergy/venus-influx-loader/pull/69

It may be a nice addition to support storing the measurements into InfluxDB with dotted syntax which then allows to dynamically access parts of the measurement name within the query itself.

so the pvinverter/Ac/L1/Power would become pvinverter.Ac.L1.Power.

Since all measurements are properly tagged with portalId, and instanceNumber, the immediate benefit I can see at the moment is to group by a phase in all three phase measurements where each phase is represented separately. So one query can be used to easily visualise voltate/amperage/power of a three phase measurement as opposed to three queries required currently.

Since the change would break all existing dashboards out there, it must be an opt in. My suggesting would be to add it as an option to the Admin Dashboard Settings/InfluxDB page. Something along the lines of

Measurement Separator: Slash (/) - Example: pvinverter/Ac/L1/Power
Measurement Separator: Dot (.) - Example: pvinverter.Ac.L1.Power

with proper explanation of how the dotted format can be used later in the InfluxDB query.

Screenshot 2024-04-22 at 12 06 54
kvesterling commented 7 months ago

"with proper explanation of how the dotted format can be used later in the InfluxDB query." I'm not sure what you mean by this, it's functionality in Grafana is why I'm requesting the "feature". It's merely a measurement name, influx would care less if it were dots, slash, or otherwise. If you're concerned about regex for the measurement, simply escape the dot with \.

mman commented 6 months ago

@kvesterling Any comments about the PR and how I propose the feature to be implemented? It's not gonna be ON by default due to compatibility reasons, so it will be opt-in for now... what do you think: https://github.com/victronenergy/venus-influx-loader/pull/98

mman commented 5 months ago

Possibly/Probably related to https://github.com/victronenergy/venus-influx-loader/issues/114

kvesterling commented 5 months ago

Thanks! I don't have any comments to say, I'd be happy to contribute my dashboards with the feature enabled to make it easy for those whom would like the dot formatted.

maurerle commented 2 weeks ago

I would like to have this feature. Is there anything blocking the PR?

mman commented 2 weeks ago

@maurerle This PR can not be merged like this as it would break the world. I will implement it in the following days as a command line switch so that it can be override, but can not be accidentally changed via config file. But I'd still love to learn what do you think about https://github.com/victronenergy/venus-influx-loader/issues/114 and if we just change the delimiter, how would it help. Could you please share your use case?

maurerle commented 19 hours ago

Hi @mman that sounds very good! The main drawback of the current solution is, that you need 3 copy pasty queries to show different phases in one graph panel. This would be solved by #114 - So I'd be very happy with that as well