Skip to content

Commit dddf2aa

Browse files
authored
reduce noisy error level log in sessiond (#7142)
Signed-off-by: Marie Bremner <[email protected]>
1 parent 9f69ccb commit dddf2aa

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

lte/gateway/c/session_manager/ChargingGrant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static RedirectInformation_AddressType address_type_converter(
389389
case RedirectServer_RedirectAddressType_SIP_URI:
390390
return RedirectInformation_AddressType_SIP_URI;
391391
default:
392-
MLOG(MERROR) << "Unknown redirect address type!";
392+
MLOG(MWARNING) << "Unknown redirect address type!";
393393
return RedirectInformation_AddressType_IPv4;
394394
}
395395
}

lte/gateway/c/session_manager/LocalEnforcer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,7 @@ void LocalEnforcer::sync_sessions_on_restart(std::time_t current_time) {
217217
}
218218
}
219219
bool success = session_store_.update_sessions(session_update);
220-
if (success) {
221-
MLOG(MDEBUG) << "Successfully synced sessions after restart";
222-
} else {
220+
if (!success) {
223221
MLOG(MERROR) << "Failed to sync sessions after restart";
224222
}
225223
}
@@ -1826,8 +1824,8 @@ void LocalEnforcer::update_ipfix_flow(
18261824
std::string apn_mac_addr;
18271825
std::string apn_name;
18281826
if (!parse_apn(config.common_context.apn(), apn_mac_addr, apn_name)) {
1829-
MLOG(MWARNING) << "Failed mac/name parsiong for apn "
1830-
<< config.common_context.apn();
1827+
MLOG(MDEBUG) << "Failed mac/name parsiong for apn "
1828+
<< config.common_context.apn();
18311829
apn_mac_addr = "";
18321830
apn_name = config.common_context.apn();
18331831
}

lte/gateway/c/session_manager/SessionState.cpp

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const char* LABEL_DIRECTION = "direction";
4141
const char* DIRECTION_UP = "up";
4242
const char* DIRECTION_DOWN = "down";
4343
const char* LABEL_SESSION_ID = "session_id";
44+
// TODO(@themarwhal): SessionD should own the naming of the drop all rule so
45+
// that we never regress here
46+
const char* DROP_ALL_RULE = "internal_default_drop_flow_rule";
4447
} // namespace
4548

4649
using magma::service303::increment_counter;
@@ -477,42 +480,50 @@ optional<RuleStats> SessionState::get_rule_delta(
477480
const std::string& rule_id, uint64_t rule_version, uint64_t used_tx,
478481
uint64_t used_rx, uint64_t dropped_tx, uint64_t dropped_rx,
479482
SessionStateUpdateCriteria* session_uc) {
480-
auto it = policy_version_and_stats_.find(rule_id);
481-
if (it == policy_version_and_stats_.end()) {
482-
MLOG(MERROR) << "Reported rule (" << rule_id << ") not found, ignoring";
483+
// TODO(@koolzz): Handle drop all stats properly GH7143
484+
if (policy_version_and_stats_.find(rule_id) ==
485+
policy_version_and_stats_.end()) {
486+
if (rule_id.compare(DROP_ALL_RULE)) {
487+
// Only log if it's not the drop all rule
488+
MLOG(MERROR) << "Reported rule (" << rule_id << ") not found in "
489+
<< session_id_ << ", ignoring";
490+
}
483491
return {};
484492
}
485493

486-
RuleStats ret = RuleStats();
494+
RuleStats ret = RuleStats();
495+
StatsPerPolicy& stats = policy_version_and_stats_[rule_id];
487496
// Only accept rule reports for current_version or last_reported_version
488497
// ignore other reports as they shoudn't be sent
489-
auto last_reported_version = it->second.last_reported_version;
490-
if (rule_version > it->second.current_version) {
491-
MLOG(MERROR) << "Reported version higher than tracked one("
492-
<< it->second.current_version << ") for "
493-
<< "Rule_id: " << rule_id << " version: " << rule_version;
498+
auto last_reported_version = stats.last_reported_version;
499+
if (rule_version > stats.current_version) {
500+
MLOG(MWARNING) << "Reported version higher than tracked one("
501+
<< stats.current_version << ") for " << session_id_
502+
<< ", rule_id: " << rule_id << ", version: " << rule_version;
494503
return ret;
495504
}
496505

497506
if (rule_version < last_reported_version) {
498-
MLOG(MERROR) << "Reported rule version too old, current one("
499-
<< it->second.current_version << ") for "
500-
<< "Rule_id: " << rule_id << " version: " << rule_version;
507+
MLOG(MWARNING) << "Reported rule version too old, current one("
508+
<< stats.current_version << ") for " << session_id_
509+
<< ", rule_id: " << rule_id << ", version: " << rule_version;
501510
return ret;
502511
}
503512

504-
auto last_tracked =
505-
policy_version_and_stats_[rule_id].stats_map.find(last_reported_version);
506-
507-
RuleStats prev_usage = last_tracked->second;
508-
513+
RuleStats prev_usage = stats.stats_map[last_reported_version];
509514
if (rule_version == last_reported_version) {
510515
if (prev_usage.tx != 0 && prev_usage.tx > used_tx) {
511-
MLOG(MERROR) << "Reported stat used_tx less than the current tracked one";
516+
MLOG(MWARNING)
517+
<< "Reported stat used_tx is less than the current tracked one for "
518+
<< session_id_ << ", rule_id: " << rule_id
519+
<< ", version: " << rule_version;
512520
return ret;
513521
}
514522
if (prev_usage.rx != 0 && prev_usage.rx > used_rx) {
515-
MLOG(MERROR) << "Reported stat used_rx less than the current tracked one";
523+
MLOG(MWARNING)
524+
<< "Reported stat used_rx is less than the current tracked one for "
525+
<< session_id_ << ", rule_id: " << rule_id
526+
<< ", version: " << rule_version;
516527
return ret;
517528
}
518529

orc8r/gateway/c/common/policydb/PolicyLoader.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ bool do_loop(
6666
MLOG(MERROR) << "Failed to get rules from map because map error " << result;
6767
return false;
6868
}
69-
if (rules.size() > 0) {
70-
MLOG(MDEBUG) << rules.size() << " rules synced";
71-
}
7269
processor(rules);
7370
return true;
7471
}

0 commit comments

Comments
 (0)