Hard dependency on InfluxDB - should be loaded on demand
HendrikF opened this issue · 4 comments
I think it was a bad decision to unconditionally include InfluxDB modules in Smokeping. It's a hard dependency even for people not using it.
Lines 26 to 27 in 64633f4
It even seems that it was optional while being developed. Optional: 45ec481 Mandatory: c4076fc
As this is my first time working with Perl, this is what I found about loading modules on demand: https://stackoverflow.com/a/251786
my $rc = eval
{
require Term::ReadKey;
Term::ReadKey->import();
1;
};
if($rc)
{
# Term::ReadKey loaded and imported successfully
...
}
Although it seems to be recommended to use Try::Tiny.
Indeed that is a bit of a big module for mandatory inclusion ... I agree ... would you care to provide a patch ?
I would suggest to 'require and import' if cfg->{InfluxDB} exists ...
note that the 45ec481 was not actually optional since it used 'use'.
Oh, right, I missed that. It is even the main point of that SO answer.
Merged, closing now.