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

feat: Add variable state capture to internal server error logging #2251

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aliraza556
Copy link
Contributor

Describe your changes

Issue ticket number and link: #2241

Closed: #2241

image

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested on Chrome and Firefox
  • I have tested on a mobile device
  • I have provided a screenshot or recording of changes in my PR if there were updates to the frontend

@aliraza556
Copy link
Contributor Author

Hi @kevkevinpal Please review this PR.

@kevkevinpal
Copy link
Contributor

Hmm I'm not sure this is exactly what were looking for since this gets the variables from the panic/error message.

I was thinking maybe there is a way to get the variable state from the stacktrace without having to pass the variable explicitly to the error

not sure if that makes sense?

@aliraza556
Copy link
Contributor Author

@kevkevinpal :
The approach you're suggesting - getting variable values directly from the stack trace without explicitly passing them - isn't possible in Go by design. Here's why:

1- Go's stack traces only contain function names, file locations, and line numbers
2- Variable values are not preserved in the stack trace when a panic occurs
3- Go intentionally prevents access to variables from previous stack frames for memory safety

To capture variable state during errors, we would need to either:

  • Add explicit logging/monitoring throughout the code
  • Use a debugging tool like Delve
  • Implement runtime hooks before the panic occurs

Would you like me to explore any of these alternative approaches instead?

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

Successfully merging this pull request may close these issues.

modify jarvis to accept final variable state
2 participants