Repository: pinpoint-apm/pinpoint
Issue: UI time period not updating properly when using real time view
Labels: stale

<!-- 
    If you're reporting a bug or seeking help because something is not working, 
    please fill out below. 
    For all else, feel free to DELETE everything and post away your issue!
-->

#### Description
<!--- Provide a more detailed introduction to the issue itself -->

#### Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Pinpoint version:
* OS, WAS, affected library, etc:
* Additional details (e.g. how your collector/web is set up):

#### Additional Info
<!--- Not obligatory, but things like logs can help if something's not working -->


Issue comments:
@teambullseye 
Hi~
Sorry. I can't understand your issue.
Please explain more detail.
Pinpoint version: 1.6.0
when realtime is selected, the scatter chart is supposed to change to 1m interval, but there's a bug in the code causing scatter chart interval not to change from already selected interval.
when 2 days is selected followed by realtime, it **freezes** the page, since scatter chart is trying to retrieve the data for last 2 days every 2 seconds
@teambullseye 
Time interval of scatter chart in realtime does not related with time period.
Time interval of scatter chart in realtime always is about 2s when fast response.
and x- range of scatter chart in realtime always is 5m.

Can you capture request of scatter chart when freezes the page.
whats happening is the set timeperiod never updates when going to realtime this results in hbase overloading due ot the realtime status update request

navbar.directive.js

had this line removed aline similar to this UrlVoService.setReadablePeriod(cfg.periodType.REALTIME); on line 312 which caused this issue it needs to be there of when switching to real time the last set timeperiod attempts to do the real time refresh because it never recognizes the period type
we will make a pull request with the fix....if you go to a 2 day view and then back to real time (without refreshing) you should see the issue as long as you have a large amount of data in your hbase for that application already...then you have to refresh to get back to a normal view because the screen freezes
@teambullseye 
In summary, does the period setting before realtime mode affect the scatter-chart's request parameters in realtime mode?
Yes but more so selecting real time fails to ever set a new default time period for realtime that applies back to the page modules
What does 'default time period' mean?
You can not modify the 'time period' in real-time mode. it is hard coded to 5m.
All 'time period' in real-time mode is a fixed value.
can this be reviewed we have referenced the fix...the real time period type was never being passed so it was always defaulting to the current previously selected time period which was causing the error it seems the added line was dropped during some previous commits so we added it back in to fix the issue
sorry. I will review your pr.
This issue/proposal has been automatically marked as stale because it hasn't had any recent activity. It will automatically be closed if no further activity occurs for 20days. If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Pinpoint Community.


Pull request review comments:

Patch that resolved the issue:
diff --git a/web/src/main/webapp/features/navbar/navbar.directive.js b/web/src/main/webapp/features/navbar/navbar.directive.js
index 2d0427ac0c96..0938d3e3ac9a 100644
--- a/web/src/main/webapp/features/navbar/navbar.directive.js
+++ b/web/src/main/webapp/features/navbar/navbar.directive.js
@@ -309,6 +309,7 @@
 								oNavbarVoService.setReadablePeriod( PreferenceService.getRealtimeScatterXRangeStr() );
 								oNavbarVoService.setQueryEndDateTime( CommonUtilService.formatDate( currentServerTime ) );
 								oNavbarVoService.autoCalculateByQueryEndDateTimeAndReadablePeriod();
+								UrlVoService.setReadablePeriod(cfg.periodType.REALTIME);
 								UrlVoService.setQueryEndDateTime( CommonUtilService.formatDate( currentServerTime ) );
 								UrlVoService.autoCalculateByQueryEndDateTimeAndReadablePeriod();
 								emitAsChanged();


Test patch: