Module: check_mk
Branch: master
Commit: 1b727576dd6af534350cd2de06929580e030ed49
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1b727576dd6af5…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Mar 15 14:14:14 2018 +0100
Added logging for string/time range restrictions.
Change-Id: I837bb15bf8107e68bd68d742562ee8faef8d3060
---
livestatus/src/Query.cc | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/livestatus/src/Query.cc b/livestatus/src/Query.cc
index f691e81..2c7101e 100644
--- a/livestatus/src/Query.cc
+++ b/livestatus/src/Query.cc
@@ -35,6 +35,7 @@
#include <utility>
#include "Aggregator.h"
#include "AndingFilter.h"
+#include "ChronoUtils.h"
#include "Column.h"
#include "Filter.h"
#include "Logger.h"
@@ -713,12 +714,29 @@ void Query::finish(QueryRenderer &q) {
std::optional<std::string> Query::stringValueRestrictionFor(
const std::string &column_name) const {
- return _filter->stringValueRestrictionFor(column_name);
+ auto result = _filter->stringValueRestrictionFor(column_name);
+ if (result) {
+ Debug(_logger) << "column " << _table.name() <<
"." << column_name
+ << " is restricted to '" << *result
<< "'";
+ } else {
+ Debug(_logger) << "column " << _table.name() <<
"." << column_name
+ << " is unrestricted";
+ }
+ return result;
}
void Query::findIntLimits(const std::string &column_name, int *lower,
int *upper) const {
- return _filter->findIntLimits(column_name, lower, upper, timezoneOffset());
+ _filter->findIntLimits(column_name, lower, upper, timezoneOffset());
+ // NOTE: Despite of the name of this method, we always use it for time
+ // ranges.
+ Debug(_logger)
+ << "column " << _table.name() << "."
<< column_name
+ << " is restricted to ["
+ << FormattedTimePoint(std::chrono::system_clock::from_time_t(*lower))
+ << ", "
+ << FormattedTimePoint(std::chrono::system_clock::from_time_t(*upper))
+ << ") resp. [" << *lower << ", " <<
*upper << ")";
}
void Query::optimizeBitmask(const std::string &column_name,