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: Debug info to Site Health Info screen #517

Merged
merged 27 commits into from
Jun 15, 2020
Merged

Conversation

dinhtungdu
Copy link
Contributor

@dinhtungdu dinhtungdu commented Feb 7, 2020

Description of the Change

Add debug information of Distributor to Site Health Info screen.

Alternate Designs

n/a

Benefits

Adding Distributor-specific debug info there can help solve issues that come to us from support forums, GitHub, email, etc. as users can copy this info and send to us for faster assistance with issues.

Possible Drawbacks

n/a

Verification Process

Go to Tools > Site Health > Info and check the Distributor section.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Relates to #407

Changelog Entry

Added: Site Health debug information.

*
* @return array
*/
function get_formatted_internal_connnections() {
Copy link
Contributor Author

@dinhtungdu dinhtungdu Feb 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have duplicated code here (and the next function) and in the pull-ui.php. I'm considering splitting it and move the logic to utils.php.

@dinhtungdu dinhtungdu self-assigned this Feb 9, 2020
@dinhtungdu dinhtungdu marked this pull request as ready for review February 10, 2020 01:06
@jeffpaul jeffpaul added the type:enhancement New feature or request. label Feb 11, 2020
@jeffpaul jeffpaul added this to the 2.0.0 milestone Feb 11, 2020
@jeffpaul
Copy link
Member

@dinhtungdu some feedback/question from my testing:

  1. Change Valid license to Valid registration.
  2. Change Email to Registration email.
  3. Ensure Settings notes details for Override Author Byline and Media Handling.
  4. Is there any better formatting we can apply to the Internal Connections and External Connections sections besides the current blob of data?

@dinhtungdu
Copy link
Contributor Author

@jeffpaul I fixed 1 and 2, 4.
For 3, do you mean the field title and description?

@jeffpaul
Copy link
Member

@dinhtungdu yes, we'll want to log how users have those settings configured.

@dinhtungdu
Copy link
Contributor Author

@jeffpaul thanks for the head up, this PR is ready for review again

@jeffpaul
Copy link
Member

@dinhtungdu 1-3 look good. For 4, can we call out the Title, URL, Status, Auth method, Username, Roles Allowed to Push labels and their associated value for each External Connection plus the additional data you're capturing? I still need to test on a multisite to see how things compare for Internal Connections.

@dinhtungdu
Copy link
Contributor Author

@jeffpaul, Thanks for the feedback, I updated both internal and external connections data, see https://prnt.sc/rkhnbq.

Please note that you need to run npm run build to build the new stylesheet for Site info screen.

Copy link
Member

@johnwatkins0 johnwatkins0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few very minor comments, but otherwise code looks good and it's working well locally.

includes/debug-info.php Outdated Show resolved Hide resolved
includes/debug-info.php Outdated Show resolved Hide resolved
includes/debug-info.php Outdated Show resolved Hide resolved
johnwatkins0
johnwatkins0 previously approved these changes Mar 23, 2020
Copy link
Member

@johnwatkins0 johnwatkins0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@dinhtungdu dinhtungdu linked an issue Mar 24, 2020 that may be closed by this pull request
3 tasks
@jeffpaul
Copy link
Member

@dinhtungdu are we able to detect the Distributor version for the External Connections and report that for those in the respective section?

@dinhtungdu
Copy link
Contributor Author

@jeffpaul With current codebase, no, but we can with a custom public REST API endpoint.

@jeffpaul
Copy link
Member

While it would be nice to be able to confirm all Distributor versions are current/equal, I'm not sure whether the value there is high enough to warrant a public API... @dkotter what's your take?

@dinhtungdu
Copy link
Contributor Author

@jeffpaul That's my concern, too.

@dkotter
Copy link
Collaborator

dkotter commented Mar 31, 2020

@jeffpaul @dinhtungdu This is something that was added as part of the Auth Setup Wizard PR (see https://github.com/10up/distributor/pull/368/files#diff-923616c19cf0f150ddc8b464ca53da19R257). So if that stays in (and we get that merged at some point) we will be able to utilize that here as well.

@jeffpaul
Copy link
Member

@dinhtungdu let's wait on this PR until #368 gets merged and you can build on top of the API then.

@dinhtungdu
Copy link
Contributor Author

Added version to debug info. But the current solution may not scale if the site has many connections.

I thought about caching or saving version info to dt_external_connections meta as well, but if we do so, we can't ensure that the versions in debug info are up-to-date.

What do you think @dkotter ?

@jeffpaul
Copy link
Member

Unless we have alternatives that clearly scale better, I'd say we get this merged in to benefit anyone triaging Distributor setups and then work to also include the Distributor version as a column in the External Connections list table (as previously suggested by @dinhtungdu).

@dkotter
Copy link
Collaborator

dkotter commented Jun 10, 2020

@dinhtungdu @jeffpaul Yeah, not sure there's a great answer here. Ideally, this health info screen isn't accessed very often, so not sure how much of a concern this will be in reality. But for sites that have hundreds of external connections, this will add a significant overhead to that page.

We could take the same approach we did for the Push UI, where we don't load anything on page load, only when the menu is hovered into. So instead of querying for the version information when the health info screen is loaded, we do it after page load, so it doesn't hurt performance.

Not sure if that's worth the effort here or not but caching won't help a ton, as the data won't be cached until the page is visited (and again, hopefully this page isn't visited often) and as mentioned, saving to meta can become out-of-date.

@dinhtungdu
Copy link
Contributor Author

@jeffpaul After considering some options, I incline to merge this PR. I added a filter to disable the debug info as well.

@jeffpaul jeffpaul requested a review from dkotter June 15, 2020 14:54
@jeffpaul jeffpaul merged commit 21d3cb9 into develop Jun 15, 2020
@dinhtungdu dinhtungdu deleted the add/407-debug-info branch July 2, 2020 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add debug info to Site Health Info screen
4 participants