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: Allow context to be set as configuration #144

Closed
wants to merge 1 commit into from

Conversation

anderson-comvex
Copy link

@anderson-comvex anderson-comvex commented Mar 4, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Currently the context of the plugin for Initialize is hardcoded causing limitations on some context wrappers for example when using AWS x-ray for tracing, since the context does not contains the xray wrapping it can't be traced.

2024-03-04T03:24:15Z [ERROR] Suppressing AWS X-Ray context missing panic: failed to begin subsegment named 'Unknown': segment cannot be found.
2024-03-04T03:24:15Z [ERROR] Suppressing AWS X-Ray context missing panic: failed to get segment from context since segment is nil
2024-03-04T03:24:15Z [ERROR] Suppressing AWS X-Ray context missing panic: failed to end subsegment: subsegment 'Unknown' cannot be found.

At this point the gorm session transaction still not initialized so we can't actually retrieve from the session using db.Transaction.Context so the best option is really pass it manually for now.

User Case Description

Allow to trace the query using telemetry that depends on the context.

References

@jinzhu
Copy link
Member

jinzhu commented Mar 9, 2024

Maybe just skip initialize with version to skip this SQL?

mysql/mysql.go

Line 34 in 739f97b

SkipInitializeWithVersion bool

@jinzhu jinzhu closed this Mar 9, 2024
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.

None yet

2 participants