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

Error Refreshing Grid #166

Closed
adamdriscoll opened this issue Nov 28, 2017 · 13 comments
Closed

Error Refreshing Grid #166

adamdriscoll opened this issue Nov 28, 2017 · 13 comments

Comments

@adamdriscoll
Copy link
Owner

I have noticed that the New-UdGrid stops refreshing shortly after the page is brought up. No errors, but the grid's data stops populating

Gist of log

12:15:46 ExecutionService StackTrace =    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
   at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
   at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
@GavinEke
Copy link

Just going to reference #161 as it sounds like the error I am having.

@adamdriscoll
Copy link
Owner Author

Fixed in next build.

@kort3x
Copy link

kort3x commented Dec 2, 2017

Just tested it with 1.2.1: Grids still dont't refresh for me.

Also: I have massive performance issues when I try to filter. I start typing and it takes seconds to accept input and keeps resetting the filter field to empty or a single letter of my input.

@adamdriscoll adamdriscoll reopened this Dec 3, 2017
@adamdriscoll
Copy link
Owner Author

I reopened this so we can investigate your issue.

Re: Performance Issue: The filtering calls back to the server to do the filtering. If it takes awhile for your endpoint to return, it can be slow. It is possible to do client side filtering but this is not implemented yet. I need to investigate a way to not filter on every key stroke otherwise long running endpoints may cause the problem you are seeing. I will open another issue for this.

@GavinEke
Copy link

GavinEke commented Dec 3, 2017

Just tested on 1.2.1 as well and its not refreshing for me either. It is no longer removing all the entries and showing empty grid but it just isn't updating the values in the grid. Let me know if there is anything I can do to assist.

@adamdriscoll
Copy link
Owner Author

Can one of you guys please post an example dashboard? Mine seems to be working as expected.

@adamdriscoll
Copy link
Owner Author

So I'm seeing the grid refresh but there are some other weird issues going on here. I wouldn't be surprised that if you messed with the grid a bit it would stop refreshing based on the usability of it right now. I'll take a look to see what I can do. I also can easily reproduce the performance issue with this script. My testing of this fix used static data and likely why a cmdlet that is a bit slow to return causes issues. I will try and get a build out this week to resolve this some how. I'll likely do a pre-release again for you guys to test out.

capture-19

@adamdriscoll
Copy link
Owner Author

@GavinEke
Copy link

GavinEke commented Dec 6, 2017

From my testing using 1.2.2 beta the grid is refreshing as it should when it is the only element. But for some reason when I run the following it isn't refreshing, I am not sure if it is trying to do too much or its a combination of the grid with another element on the page but it just doesn't seem to work for me.

Start-UdDashboard -Content {
    New-UdDashboard -Title "Server Performance Dashboard" -Color '#FF050F7F' -Content {
        New-UdRow {
            New-UdColumn -Size 6 -Content {
                New-UdRow {
                    New-UdColumn -Size 12 -Content {
                        New-UdTable -Title "Server Information" -Headers @(" ", " ") -Endpoint {
                            @{
                                'Computer Name' = $env:COMPUTERNAME
                                'Uptime' = (Get-ComputerInfo).OsUptime.ToString()
                                'Operating System' = (Get-CimInstance -ClassName Win32_OperatingSystem).Caption
                                'Free Disk Space (C:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                            }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
                        }

                    }
                }
                New-UdRow {
                    New-UdColumn -Size 12 -Content {
                        New-UdChart -Title "Disk Space by Drive" -Type Bar -AutoRefresh -Endpoint {
                            Get-CimInstance -ClassName Win32_LogicalDisk | ForEach-Object {
                                    [PSCustomObject]@{ DeviceId = $_.DeviceID;
                                                       Size = [Math]::Round($_.Size / 1GB, 2);
                                                       FreeSpace = [Math]::Round($_.FreeSpace / 1GB, 2); } } | Out-UDChartData -LabelProperty "DeviceID" -Dataset @(
                                New-UdChartDataset -DataProperty "Size" -Label "Size" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
                                New-UdChartDataset -DataProperty "FreeSpace" -Label "Free Space" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C"
                            )
                        }
                    }
                }
                New-UdRow {
                    New-UdColumn -Size 12 {
                        New-UdGrid -Title "Automatic Services NOT Started" -Headers @("Name", "State", "StartMode") -Properties @("Name", "State", "StartMode") -AutoRefresh -RefreshInterval 60 -Endpoint {
                            Get-CimInstance -ClassName Win32_Service | Where-Object {($_.StartMode -eq "Auto") -and ($_.State -eq "Stopped")} | Out-UDGridData
                        }
                    }
                }
            }
            New-UdColumn -Size 6 -Content {
                New-UdRow {
                    New-UdColumn -Size 6 -Content {
                        New-UdMonitor -Title "CPU (% processor time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80FF6B63' -ChartBorderColor '#FFFF6B63' -Endpoint {
						    try {
								Get-Counter '\Processor(_Total)\% Processor Time' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
							}
                            catch {
								0 | Out-UDMonitorData
							}
                        }
                    }
                    New-UdColumn -Size 6 -Content {
                        New-UdMonitor -Title "Memory (% in use)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842' -Endpoint {
							try {
								Get-Counter '\memory\% committed bytes in use' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
							}
                            catch {
								0 | Out-UDMonitorData
							}
                        }
                    }
                }
                New-UdRow {
                    New-UdColumn -Size 6 -Content {
                        New-UdMonitor -Title "Network (IO Read Bytes/sec)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D'  -Endpoint {
							try {
								Get-Counter '\Process(_Total)\IO Read Bytes/sec' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
							}
                            catch {
								0 | Out-UDMonitorData
							}
                        }
                    }
                    New-UdColumn -Size 6 -Content {
                        New-UdMonitor -Title "Disk (% disk time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D' -Endpoint {
							try {
								Get-Counter '\physicaldisk(_total)\% disk time' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
							}
							catch {
								0 | Out-UDMonitorData
							}
                        }
                    }
                }
                New-UdRow {
                    New-UdColumn -Size 12 {
                        New-UdGrid -Title "Top 10 Processes" -Headers @("ProcessName", "Id", "WS") -Properties @("ProcessName", "Id", "WS") -AutoRefresh -RefreshInterval 60 -Endpoint {
                            Get-Process | Sort-Object WS -Descending | Select-Object -First 10 | Out-UDGridData
                        }
                    }
                }
            }
        }
    }
}

@kort3x
Copy link

kort3x commented Dec 7, 2017

I see the same as Gavin: As soon as the grid isn't the only element it breaks.
Try adding two grids and a few monitor to a page: no refresh, no filtering, sorting is sluggish, the second grid takes very long to even populate (if at all)

@adamdriscoll
Copy link
Owner Author

I feel like I'm going crazy! I can't reproduce this on 2 boxes now. I'm running 1.2.2 from the release page and the exact dashboard you posted above, @GavinEke.

image

I've tried in IE11, Firefox and Chrome and I can sort, filter and reload grids. There is something I'm missing here.

Would either of you be willing to setup a Skype call sometime to take a look together?

@kort3x
Copy link

kort3x commented Dec 7, 2017

I had to localize Gavins code to run on my german machines but it works fine (execept for the filter which gets removed from the field but still gets applied everytime the grid refreshes)

Maybe two unrelated issues after all where my issue could be my bad code?
If this is the case: Sorry, Adam.

I will compare Gavins script to mine and keep you posted.

@adamdriscoll
Copy link
Owner Author

Ok. Thank you. It's no worries. I just want to make sure everything is working. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants