telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

Add environment variable for config.stats.interval #1627

Open rg2011 opened 1 month ago

rg2011 commented 1 month ago

Component

Feature enhancement

Is your feature request related to a problem? Please describe

Stat collection would be easier to manage in dockerized environment if config.stats.interval could be overriden by an environment variable, as is the case for many other config settings.

Describe the solution you'd like

Add an IOTA_STATS_INTERVAL environment variable that overrides the value of config.stats.interval

Describe alternatives you've considered

Replace the whole config.js file with a kubernetes configmap, but that would make maintenance harder, if we have to track and replicate in our configmap any changes to the builtin config.js when a new version is released.

The systemd version you checked that didn't have the feature you are asking for

4.5.0

fgalan commented 1 month ago

~PR #1628~

rg2011 commented 1 month ago

I have been testing the changes in PR #1628 and they work, but I find the push model for statistics too cumbersome:

Besides, comments in PR #1628 suggest that these push stats have actually never been used.

All above considered, I am tempted to suggest deprecating the push mechanism altogether, and replacing it with an openmetrics endpoint in the northbound API.

I might work on such an endpoint in another PR.

fgalan commented 1 month ago

PR https://github.com/telefonicaid/iotagent-node-lib/pull/1629

fgalan commented 1 month ago

Now that PR #1629 has been merged, can this issue be closed?

rg2011 commented 1 month ago

I tested the :latest image in our kubernetes environment and found out that the prometheus version available there actually requests openmetrics version 0.0.1, so I had to add support for that version too. I submitted PR #1640