backstage icon indicating copy to clipboard operation
backstage copied to clipboard

[RFC] Debug Plugin

Open awanlin opened this issue 4 years ago • 22 comments

Status: Open for comments

Sound Check: a test of sound equipment before a musical performance or recording to check that the desired sound is being produced.

Need

Currently there is no "home" for various debugging features - viewing logs, config, health, etc. This makes it hard once Backstage has been deployed to debug or troubleshoot issues. This is especially true for locked down production environments or for those that are new to Backstage and do not know yet where to look for answers

If there was a "home" for these debug features we could slowly implement features as needed either by the Core Maintainers or the Community.

Proposal

I'd like to propose the "Sound Check" plugin as place for collecting these various features to allow us to debug a running instance of Backstage. This could be accessed from the settings area of Backstage and use the new permission framework to lock it down to specific "admin" type users.

Once in the Sound Check UI you would be able to view the current logs, change log level (turn debug on or off), view status of health checks, view the current config being used (filtering out secrets), list of installed plugins, etc.

The plugin itself would simply be normal frontend and backend packages like every other Backstage plugin.

awanlin avatar Feb 22 '22 16:02 awanlin

This is my first RFC so my apologies if it's not as detailed as others

awanlin avatar Feb 22 '22 16:02 awanlin

@freben @benjdlambert we've talked about this on Discord here and there so I've put pen to paper to try and get something rolling for this. Would love your feedback!

awanlin avatar Feb 22 '22 16:02 awanlin

Oh, worth mentioning that we have some work done to show the current config with secrets filtered out. We also have an extensible health check that you can add URLs to fetch or Targets to ping which can be helpful for validating that you can reach other systems from your Backstage instance to rule out things like DNS or firewall issues. We'd be willing to contribute these for this plugin :)

awanlin avatar Feb 22 '22 16:02 awanlin

Inventive naming! Could we just call it plain "debug" or "inspect" or similar though? Wanna be super clear that it's not meant as a primary use case but more for debugging.

Any ideas on how to best reach it? Will it have like a master view that you reach from the sidebar or via a secret keypress if you're an admin? Or will it mostly be composed of several small pieces, so maybe it has a catalog debug part reached from the catalog, a scaffolder debug part ... etc

freben avatar Feb 25 '22 10:02 freben

Also to be clear, yesss we'd love to get help getting this ball rolling!

freben avatar Feb 25 '22 10:02 freben

Yes, the name, though nice, matters much less than the utility and being easy for people to find and use. We can use it as the code name for this project ;)

Personally I lean towards "debug" but I think that may come with it's own assumptions so I think "inspect" works better. Really most of the items that have been suggested for this are around inspecting various data.

I think being able to reach it from both a central location as well as context aware links as you mentioned would make sense to me. Having it show in the sidebar makes it easy to find for people who might be setting up their first instance. Also having context aware links would also be good as a helping hand when something unexpected happens.

Another feature that would be pretty awesome to have in here is the list of tasks/process that the backend-tasks are managing. Would be nice to see previously process items and upcoming items.

awanlin avatar Mar 06 '22 16:03 awanlin

@grantila this seems to line up nicely with your DevTools and related PRs - #10254, #10255, #10256, #10257, #10258, #10259, #10260. Could we tie this together?

awanlin avatar Mar 17 '22 14:03 awanlin

Heh, I completely missed this issue before building this 😅

Yeah, these things, the way I've been thinking of it, does introduce new core concepts that needs to (well, probably/potentially) be exposed. This will need some thorough planning and thinking, so we don't create core concepts that we'll regret.

This is just a start - maybe this is a good place for plugin modules to have their own things debuggable through one DevTools UI, a little bit like plugins providing tabs on the entity page. Food for thought anyway.

grantila avatar Mar 18 '22 16:03 grantila

@grantila I've noticed that all your PRs are now closed? I would love to help with them but I think some of them are just beyond my current skill level. I'm happy to help coordinate or do any testing or other support as needed though.

@freben what do you think? These PRs really seem like great functionality and very much fit with the idea of what this RFC is for. But I understand that the maintainers may not have time to help with these beyond reviews

awanlin avatar Apr 04 '22 13:04 awanlin

Just a follow up on this: I have the framework for this built and two tabs - Info (a lot like an about page combined with the data from running yarn backstage-cli info) and Config (shows you a tree of your config) - built with a third (external dependencies so things like APIs you might consume from Backstage or Servers that you need to be able to reach) that I'm waffling on.

awanlin avatar Sep 08 '22 19:09 awanlin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 11 '22 21:11 github-actions[bot]

Still very much working on this

awanlin avatar Nov 11 '22 23:11 awanlin

I've got a draft PR for this, there's going to be a long discussion on it I think so please be patient. In the end I settled on DevTools for the name, just feels more open. Here's a quick rundown on the features:

Lists info about your current Backstage instance - OS, NodeJS version, Backstage version and packages:

devtools-info-tab

Lists the config being used by your current Backstage instance:

devtools-config-tab

There's also an optional tab where you can list connectivity with External Dependencies:

devtools-external-dependencies

The plugin has also been designed so you can customize the tabs - remove them, add them, and/or create your own.

Support for the permissions framework is included in an open way so that you can control this as best fits your needs.

ahhhndre avatar Nov 15 '22 16:11 ahhhndre

@ahhhndre I like it! One other addition that O thought of which would be amazing, would be to pull the scheduler times into a ui. You could even force one to be reset maybe? That might be too much though.. but just seeing when things are going to run next would be incredibley valuable.

webark avatar Nov 23 '22 14:11 webark

YES! This ^ is my next item once I get the plugin merged in. As someone who does not have any access to the database it would be amazing to be able to see this information in a single place for all the scheduled things

awanlin avatar Nov 23 '22 15:11 awanlin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 22 '23 15:01 github-actions[bot]

It will be closed if no further activity occurs.

noooooooooooo!!!

webark avatar Jan 22 '23 16:01 webark

@drodil essentially what DevTools is intended to be is a “home” for all these Backstage admin tools. The PR has the ground work and includes three tabs - package and version information, view of the current config, and status of external dependencies. It’s setup in a way that you can add more tabs as needed. We have more to be able to see state of our internal plugins, one for viewing events, one for orphans, etc.

There is permissions setup for what is in the PR. Ideally I’d like to improve this area to be able to dynamically permission the tabs but that will come at some later time.

My overall goal is that once this PR is merged in the community would contribute more useful tools in this area that way Backstage operators can add what they need.

ahhhndre avatar Feb 23 '23 17:02 ahhhndre

@ahhhndre Hey hey! The screenshot above looks 🔥 Did you manage to create any PR for that plugin? I'd love to use it. :)

OrkoHunter avatar Mar 15 '23 17:03 OrkoHunter

@OrkoHunter , I believe this is the PR: https://github.com/backstage/backstage/pull/14642

efenner-cambia avatar Mar 17 '23 16:03 efenner-cambia