Skip to content

Conversation

@OA6DXV
Copy link

@OA6DXV OA6DXV commented Mar 16, 2025

As I mentioned in #505, I am proposing the ability to modify the update interval of the statistics file. Despite the compilation error due to issues in the unstable branch, I am submitting this PR to showcase the necessary code changes to declare the update-stats-frequency variable, which is an integer that defines how many seconds will pass before the file is updated. This file will then be read by Prometheus.

Now, it would only be necessary to add the global variable update-stats-frequency = x; in the configuration file (rtl_airband.conf) so that each user can control the frequency at which the statistics are updated. The modified code still maintains the default 15-second interval if this global variable is not specified, just like the original code does.

The reason for proposing this change is that having the option to configure a shorter update interval and allowing Prometheus to read these values more frequently enables more precise statistics, especially for analyzing signal and noise levels, for example.

Thank you, and I apologize for any mistakes that may exist. I'm not very experienced with Git and pull requests.

char *stats_filepath = NULL;
size_t fft_size_log = DEFAULT_FFT_SIZE_LOG;
size_t fft_size = 1 << fft_size_log;
int stats_update_interval = 15; // Stats update every 15 seconf by default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int stats_update_interval = 15; // Stats update every 15 seconf by default
int stats_update_interval = 15; // Stats update every 15 seconds by default

if(root.exists("stats_filepath"))
stats_filepath = strdup(root["stats_filepath"]);
if (root.exists("stats_update_interval")) {
stats_update_interval = (int)root["stats_update_interval"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any validation we should do on the value? Ie, >0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants