Re: Pgadmin4 System Stats Extension Design

From: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
To: Sahil Harpal <sahilharpal1234(at)gmail(dot)com>
Cc: Khushboo Vashi <khushboo(dot)vashi(at)enterprisedb(dot)com>, pgadmin-hackers(at)postgresql(dot)org, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, Dave Page <dpage(at)pgadmin(dot)org>, Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
Subject: Re: Pgadmin4 System Stats Extension Design
Date: 2023-08-07 11:41:50
Message-ID: CAM9w-_nJWCnnQvXozGgrXVwhJwQ3hfeFZfKe+mKJHM5nox2AhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Mon, Aug 7, 2023 at 4:47 PM Sahil Harpal <sahilharpal1234(at)gmail(dot)com>
wrote:

> Hi Aditya,
> On Mon, 7 Aug 2023 at 11:01, Aditya Toshniwal <
> aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
>
>> Hi Sahil,
>> I would suggest changing the behaviour in StreamingChart so that it can
>> be used at other places. If you want to reverse it then you can still do
>> it. I had achieved reverse direction with the following piece of code.
>> Basically, creating an array of 75 points, filling it with available points
>> and reverse. You can change it based on reverse=true flag. In your case,
>> simply reverse, not need of 75 points.
>> Array.from(new Array(xRange).keys()),
>> ...(data.datasets?.map((d)=>{
>> let ret = [...d.data];
>> ret.reverse();
>> return ret;
>> })??{}),
>>
>
> I'm a little confused here. So, the code snippet above is exactly what's
> used to initialize the data currently.
>
> The expected behavior is that the graph should start from the right side
> only. However, currently, when the page loads, for a few seconds, the
> graphs are visible on the left side and then shift to the right.
>
> I think we can skip the reverse if we make changes in the statsReducer
> method.
> action.counter ? action.incoming[label] - action.counterData[label] :
> action.incoming[label],
> ...state[label].slice(0, X_AXIS_LENGTH-1),
>
> Here, we are adding new data to the beginning and selecting the first
> X_AXIS_LENGTH-1 datapoints from the previous state. However, an alternative
> approach would be to initially take the X_AXIS_LENGTH-1 elements from the
> end of the array, then add a new element to the end. This would eliminate
> the need to reverse the array.
>
> I believe this reversal isn't causing any issues, but something might be
> occurring during graph plotting. Reversing just ensures that the most
> recent data point remains on the right within the stream.
>
OK I thought you wanted the graph to go from left to right. Yeah, I have
seen that glitch a few times (but rare). I think you can ignore it for now,
we can look into it once we get time. It is not a priority.
The reason data reversing and stuff is maintained in StreaminChart is -
Pass the data points and StreamingChart will appear from right to left.
Don't want the source to take efforts to reverse and fill.

>
> Thank you,
> Sahil
>
>

--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Architect | *enterprisedb.com*
<https://www.enterprisedb.com/>
"Don't Complain about Heat, Plant a TREE"

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Khushboo Vashi 2023-08-07 11:49:21 [pgadmin-org/pgadmin4] b55164: Fix the query tool issue where raise Notice from f...
Previous Message Sahil Harpal 2023-08-07 11:17:27 Re: Pgadmin4 System Stats Extension Design