Calculation of KSC reports timespans "Last Week" and "This Week" broken

Description

Created a KSC report with some random graphs in Meridian 2016.1.4 with the "Override Graph Timespan" option. Viewing the report works with no problems. If I use the "Override Graph Timespan" dropdown and choose "Last Week" or "This week", a wrong timespan was calculated (end time before start time) and the graphs can not be displayed. Please see the attached screenshot, captured on May 8th with the option "This week" and the calculated graph time spans from May 14th until May 13th.

This behavior could not be seen on a Horizon 18.0.1, where the "This week" timespan was calculated correctly.

Acceptance / Success Criteria

None

Attachments

1
  • 08 May 2017, 11:51 AM

Lucidchart Diagrams

Activity

Show:

Michael Batz May 24, 2017 at 3:25 AM

, thanks for the fix

Alejandro Galue May 9, 2017 at 1:46 PM
Edited

Alejandro Galue May 9, 2017 at 1:46 PM
Edited

Indeed the locale affects the way we calculate the range, because the "first" day of the week depends on the locale. I tested the following and works with the DE and US locale:

g/opennms/netmgt/config/KSC_PerformanceReportFactory.java index 7f6576e6a3..4527b7ef09 100644 --- a/opennms-config/src/main/java/org/opennms/netmgt/config/KSC_PerformanceReportFactory.java +++ b/opennms-config/src/main/java/org/opennms/netmgt/config/KSC_PerformanceReportFactory.java @@ -397,7 +397,7 @@ public class KSC_PerformanceReportFactory { end_time.add(Calendar.DATE, -1); end_time.set(Calendar.HOUR_OF_DAY, 22); } else if (interval.equals("This Week") || interval.equals("Last Week")) { - begin_time.set(Calendar.DAY_OF_WEEK, 1); + begin_time.set(Calendar.DAY_OF_WEEK, begin_time.getFirstDayOfWeek()); end_time.set(Calendar.DAY_OF_WEEK, 7); end_time.set(Calendar.HOUR_OF_DAY, 23); end_time.set(Calendar.MINUTE, 59);

Alejandro Galue May 9, 2017 at 12:13 PM

You're right. In fact, on my VM, I've changed the locale to be de_DE.utf8 as you've described, and I was able to reproduce the problem.

Michael Batz May 9, 2017 at 11:27 AM

It seems, that the issue depends on the language settings on the system. I used a CentOS 7 as operating system with a German language setting (environment variable LANG=de_DE.utf8). If I change the locacle to en_US.utf8, with the following command "localectl set-locale LANG=en_US.utf8", logout and login from the shell and restart OpenNMS, the error is gone, and the graphs were shown correctly.

Fixed

Details

Assignee

Reporter

Labels

Affects versions

Priority

PagerDuty

Created May 8, 2017 at 11:51 AM
Updated June 8, 2017 at 10:22 AM
Resolved May 18, 2017 at 3:21 PM

Flag notifications