-
Notifications
You must be signed in to change notification settings - Fork 8
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: un-revert registration of db.sql
metrics
#2373
Conversation
The ModuleContext was designed to be an abstract data model in the Controller for the resources required by a module, but along the way it started to be used for storing DB connections for use by the go-runtime. This change cleanly separates those requirements so that the go-runtime is entirely responsible for creating new connections from the DSN provided by the ModuleContext. I think there's a bit more work to be done here, in that the ModuleContext knows about testing in the go-runtime, which it really shouldn't, but this will unblock #2373 for now.
@@ -13,6 +13,7 @@ | |||
package reflect | |||
|
|||
import ( | |||
"container/list" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's roll these reflection changes back, we shouldn't be copying a db.DB in the first place. I'll send a PR to rectify that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you! Done
061a410
to
2b7b088
Compare
cleanup lint client_test.go temp go.mod cleanup undo project toml change integration test go.mod and go.sum testdata handle unsafe.pointer rm encryptors nuke reflect changes minus list.List
cmd/ftl-controller/main.go
Outdated
conn, err := sql.Open("pgx", cli.ControllerConfig.DSN) | ||
conn, err := otelsql.Open("pgx", cli.ControllerConfig.DSN) | ||
kctx.FatalIfErrorf(err) | ||
err = otelsql.RegisterDBStatsMetrics(conn, otelsql.WithAttributes(semconv.DBSystemPostgreSQL)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a helper function that opens + instruments in one, and use that function in all these locations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea - done
Fixes #2285
Unreverts #2305 with these changes:
copyAny
changes except for thelist.List
handling.reflect: internal error: must be a Pointer or Ptr; got unsafe.Pointer
DeepCopy
.reflect.Ptr
refs toreflect.Pointer
. Not a big deal, butPtr
is the old name, and since we're usingreflect.Pointer
elsewhere in this file, it's better to stay consistent. Accordingly, this also fixes the error message that we saw in the prod deployment, which previously impliedPointer
andPtr
were two separate types.