Skip to content

rds: Added a verbose option to extract additional debug information#196

Merged
brenns10 merged 1 commit intooracle-samples:mainfrom
Hannibal404:rds_verbose
Feb 23, 2026
Merged

rds: Added a verbose option to extract additional debug information#196
brenns10 merged 1 commit intooracle-samples:mainfrom
Hannibal404:rds_verbose

Conversation

@Hannibal404
Copy link
Copy Markdown
Contributor

The "verbose" option is added to the drgn RDS helper to extract data that is not required in general, but can help get the exact state of different objects of an RDS connection if needed.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 22, 2025
Comment thread drgn_tools/rds.py Outdated
Comment thread drgn_tools/rds.py Outdated
Comment on lines +736 to +737
if args.verbose:
with open("conn_structure_dump.txt", "a") as f:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this function is to be used within corelens, then it cannot create files at random in the current directory. Corelens output should be controlled by the corelens CLI. Given that corelens is normally run as root, creating a file unexpectedly in the current directory could be dangerous.

I see four possibilities:

  1. In verbose mode, print the output to stdout, not a new file.
  2. In verbose mode, print to this file as you currently have it. But change the corelens module so that it passes verbose=False always. This avoids corelens users getting unexpected output.
  3. Move this verbose output to a new function (with @redirectable). Call it from the corelens module during verbose mode. Your scripts can call this function separately and use @redirectable to control its output.
  4. Introduce some new API from corelens that allows one corelens module to have multiple output files or output sections.

Honestly, any of these is fine with me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Going forward with 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure that this is resolved - the key point of option 2 was that the corelens module should never enable the verbose mode that creates this file. As of now, it does when the user passes --verbose.

Corelens modules must not create arbitrary output files. All output is controlled by the corelens CLI flags. Corelens modules just print to stdout, which will be redirected accordingly by the CLI.

If a customer runs this module, they should not end up with a root-owned file conn_structure_dump.txt in the working directory. That's unexpected, and it's a bug. If the customer was generating a report with -o, then this file won't get included in the report, because it gets written into the current working directory, not the output directory. And if the customer was printing the output to stdout, then no files should be created at all!

It's okay for this function to be able to create the file if that's what you want for your analysis scripts, but the behavior cannot be exposed via corelens. If you want it exposed via corelens, then it needs to be printed together with the same output stream that the rest of the output goes to, or we'll need to make an API for corelens modules to write output to ancillary files. I'm happy to help with this API if that's what we need.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

simply printing the verbose output now instead of rerouting to a new file

Comment thread drgn_tools/rds.py Outdated
Comment thread drgn_tools/rds.py Outdated
Comment thread drgn_tools/rds.py Outdated
Comment thread drgn_tools/rds.py Outdated
The "verbose" option is added to the drgn RDS helper to extract data
that is not required in general, but can help get the exact state of
different objects of an RDS connection if needed.

Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
Signed-off-by: Pradyumn Rahar <pradyumn.rahar@oracle.com>
@brenns10 brenns10 merged commit 0c3fa32 into oracle-samples:main Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants