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: un-revert registration of db.sql metrics #2373

Merged
merged 3 commits into from
Aug 20, 2024
Merged

feat: un-revert registration of db.sql metrics #2373

merged 3 commits into from
Aug 20, 2024

Conversation

deniseli
Copy link
Contributor

@deniseli deniseli commented Aug 15, 2024

Fixes #2285

Unreverts #2305 with these changes:

  • Reverts copyAny changes except for the list.List handling.
  • Updates all reflect.Ptr refs to reflect.Pointer. Not a big deal, but Ptr is the old name, 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.

@deniseli deniseli marked this pull request as ready for review August 15, 2024 02:00
@deniseli deniseli requested a review from alecthomas as a code owner August 15, 2024 02:00
@deniseli deniseli requested review from a team and stuartwdouglas and removed request for a team August 15, 2024 02:00
@ftl-robot ftl-robot mentioned this pull request Aug 15, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 15, 2024
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"
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent, thank you! Done

@deniseli deniseli force-pushed the dli/otelsql branch 2 times, most recently from 061a410 to 2b7b088 Compare August 19, 2024 18:12
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
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))
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great idea - done

@deniseli deniseli added this pull request to the merge queue Aug 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2024
@deniseli deniseli added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 57be427 Aug 20, 2024
18 checks passed
@deniseli deniseli deleted the dli/otelsql branch August 20, 2024 00:22
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.

otel: instrument observability (metrics + traces) on the database
2 participants