-
Notifications
You must be signed in to change notification settings - Fork 9
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: register db.sql metrics #2305
Conversation
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.
LGTM with some comments that need to be addressed.
@@ -51,7 +52,9 @@ func main() { | |||
kctx.FatalIfErrorf(err, "failed to initialize observability") | |||
|
|||
// The FTL controller currently only supports DB as a configuration provider/resolver. | |||
conn, err := sql.Open("pgx", cli.ControllerConfig.DSN) | |||
conn, err := otelsql.Open("pgx", cli.ControllerConfig.DSN) |
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.
That is a nice clean API.
Looks like this is breaking tests right now because modulecontext's |
New changes: 2 minor additions to internal/reflect/reflect.go:
|
ftl-project.toml
Outdated
@@ -1,8 +1,6 @@ | |||
name = "ftl" | |||
module-dirs = ["examples/go"] | |||
ftl-min-version = "" | |||
hermit = false |
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.
Why'd these get removed?
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.
oh what the heck! I'll undo all the changes to that file. Thanks for catching that
Fixes #2285 Unreverts #2305 with these changes: * Reverts [`copyAny`](https://github.com/TBD54566975/ftl/blob/main/internal/reflect/reflect.go#L149) changes except for the `list.List` handling. * The original PR caused a panic when deploying to prod: `reflect: internal error: must be a Pointer or Ptr; got unsafe.Pointer` * #2376 removed the DB handles from the module context Database struct, so we no longer need to handle all these types in `DeepCopy`. * Updates all `reflect.Ptr` refs to `reflect.Pointer`. Not a big deal, but `Ptr` is the [old name](https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/reflect/type.go;l=303), and since we're using `reflect.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 implied `Pointer` and `Ptr` were two _separate_ types. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes #2285
Register the standard otel database metrics using: https://github.com/XSAM/otelsql
Found call sites by grepping for
sql.Open
and skipping all test code.Sample: