Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aggregation for another log line #52

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ private ReporterModel forCourcirc(@NonNull final ReporterModel reporterModel) {
ReportWrapper logsTransientReactanceTooLowSummary = null;
TypedValue logsTransientReactanceTooLowSeverity = null;

long logsTransientReactanceUndefinedCount = 0L;
ReportWrapper logsTransientReactanceUndefinedSummary = null;
TypedValue logsTransientReactanceUndefinedSeverity = null;

long logsSimulatingShortCircuitLocatedCount = 0L;
ReportWrapper logsSimulatingShortCircuitLocatedSummary = null;
TypedValue logsSimulatingShortCircuitLocatedSeverity = null;
Expand All @@ -121,6 +125,15 @@ private ReporterModel forCourcirc(@NonNull final ReporterModel reporterModel) {
}
copyReportAsTrace(newReporter, report);
logsTransientReactanceTooLowCount++;
} else if (StringUtils.endsWith(report.getDefaultMessage(), " : transient reactance undefined ==> generator ignored")) {
//we match line "X.ABCDEF2 : transient reactance undefined ==> generator ignored"
if (logsTransientReactanceUndefinedSummary == null) {
logsTransientReactanceUndefinedSummary = new ReportWrapper();
newReporter.report(logsTransientReactanceUndefinedSummary);
logsTransientReactanceUndefinedSeverity = report.getValue(Report.REPORT_SEVERITY_KEY);
}
copyReportAsTrace(newReporter, report);
logsTransientReactanceUndefinedCount++;
} else if (StringUtils.startsWith(report.getDefaultMessage(), "Simulating : short-circuit located on node ")) {
//we match line "Simulating : short-circuit located on node .BRIDGE_0"
if (logsSimulatingShortCircuitLocatedSummary == null) {
Expand Down Expand Up @@ -153,6 +166,13 @@ private ReporterModel forCourcirc(@NonNull final ReporterModel reporterModel) {
Map.of(Report.REPORT_SEVERITY_KEY, ObjectUtils.defaultIfNull(logsTransientReactanceTooLowSeverity, TypedValue.WARN_SEVERITY),
"nb", new TypedValue(logsTransientReactanceTooLowCount, TypedValue.UNTYPED))));
}
log.debug("Found {} lines in courcirc logs matching \"MYNODE : transient reactance undefined ==> generator ignored\"", logsTransientReactanceUndefinedCount);
if (logsTransientReactanceUndefinedSummary != null) {
logsTransientReactanceUndefinedSummary.setReport(new Report("transientReactanceUndefinedSummary",
"${nb} node(s) with transient reactance undefined ==> generator ignored",
Map.of(Report.REPORT_SEVERITY_KEY, ObjectUtils.defaultIfNull(logsTransientReactanceUndefinedSeverity, TypedValue.WARN_SEVERITY),
"nb", new TypedValue(logsTransientReactanceUndefinedCount, TypedValue.UNTYPED))));
}
log.debug("Found {} lines in courcirc logs matching \"Simulating : short-circuit located on node MYNODE\"", logsSimulatingShortCircuitLocatedCount);
if (logsSimulatingShortCircuitLocatedSummary != null) {
logsSimulatingShortCircuitLocatedSummary.setReport(new Report("simulatingShortCircuitLocatedNodeSummary",
Expand Down
40 changes: 40 additions & 0 deletions src/test/resources/reporter_courcirc_modified.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,42 @@
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "transientReactanceUndefinedSummary",
"values" : {
"reportSeverity" : {
"value" : "WARN",
"type" : "SEVERITY"
},
"nb" : {
"value" : 3,
"type" : "UNTYPED"
}
}
}, {
"reportKey" : "REC_15",
"values" : {
"reportSeverity" : {
"value" : "TRACE",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_16",
"values" : {
"reportSeverity" : {
"value" : "TRACE",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_17",
"values" : {
"reportSeverity" : {
"value" : "TRACE",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_245",
"values" : {
Expand Down Expand Up @@ -309,6 +345,9 @@
"REC_11" : "T:NODE2 : transient reactance too low ==> generator ignored",
"REC_12" : "T NODE3 : transient reactance too low ==> generator ignored",
"REC_13" : "T—NODE4 : transient reactance too low ==> generator ignored",
"REC_15" : "NODE-1 : transient reactance undefined ==> generator ignored",
"REC_16" : "NODE-2 : transient reactance undefined ==> generator ignored",
"REC_17" : "NODE-3 : transient reactance undefined ==> generator ignored",
"REC_245" : "Simulating : short-circuits located on nodes with branches contributions",
"REC_246" : "Simulating : short-circuit located on node NODE123_0",
"REC_274" : "Simulating : short-circuit located on node ABCDEFG_1",
Expand All @@ -318,6 +357,7 @@
"REC_306" : "Short circuit on node DUPOND2_0 is not simulated : it is located in an out of voltage part of the network",
"REC_307" : "Simulating : short-circuit located on node CAPTAIN_0",
"transientReactanceTooLowSummary" : "${nb} node(s) with transient reactance too low ==> generator ignored",
"transientReactanceUndefinedSummary" : "${nb} node(s) with transient reactance undefined ==> generator ignored",
"simulatingShortCircuitLocatedNodeSummary": "Simulating: short-circuits located on ${nb} nodes",
"shortCircuitNodeNotSimulatedOutOfVoltageSummary": "Short circuit on ${nb} nodes is not simulated : they are in an out of voltage part of the network."
}
Expand Down
27 changes: 27 additions & 0 deletions src/test/resources/reporter_courcirc_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_15",
"values" : {
"reportSeverity" : {
"value" : "WARN",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_16",
"values" : {
"reportSeverity" : {
"value" : "WARN",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_17",
"values" : {
"reportSeverity" : {
"value" : "WARN",
"type" : "SEVERITY"
}
}
}, {
"reportKey" : "REC_245",
"values" : {
Expand Down Expand Up @@ -273,6 +297,9 @@
"REC_11" : "T:NODE2 : transient reactance too low ==> generator ignored",
"REC_12" : "T NODE3 : transient reactance too low ==> generator ignored",
"REC_13" : "T—NODE4 : transient reactance too low ==> generator ignored",
"REC_15" : "NODE-1 : transient reactance undefined ==> generator ignored",
"REC_16" : "NODE-2 : transient reactance undefined ==> generator ignored",
"REC_17" : "NODE-3 : transient reactance undefined ==> generator ignored",
"REC_245" : "Simulating : short-circuits located on nodes with branches contributions",
"REC_246" : "Simulating : short-circuit located on node NODE123_0",
"REC_274" : "Simulating : short-circuit located on node ABCDEFG_1",
Expand Down
Loading