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

splunksql: Add splunksql.OpenDB function #106

Open
pellared opened this issue Sep 20, 2021 · 6 comments
Open

splunksql: Add splunksql.OpenDB function #106

pellared opened this issue Sep 20, 2021 · 6 comments

Comments

@pellared
Copy link
Contributor

pellared commented Sep 20, 2021

Add splunksql.OpenDB function for ones who dislike the sql.Open and splunksql.Open which use global state.

Something similar to https://pkg.go.dev/github.com/XSAM/otelsql#OpenDB

Desired API: func OpenDB(c driver.Connector, cfg InstrumentationConfig) *sql.DB.
We should also add OpenDB functions to all other sql-based instrumentation libraries that will use splunksql.OpenDB.

Implementation guidelines: #88 (comment)

Originally posted by @pellared in #88 (comment)

@pellared
Copy link
Contributor Author

Waiting until anyone asks for this feature.

@pellared pellared changed the title Add splunksql.OpenDB function splunksql: Add splunksql.OpenDB function Sep 30, 2021
@ccoqueiro

This comment was marked as off-topic.

@pellared

This comment was marked as off-topic.

@joshi-kamitsukasa
Copy link

Hi, we want splunksql.OpenDB function. We want to use pgx Connector's option (e.g. OptionAfterConnect) but we can't use it with splunksql.

@pellared
Copy link
Contributor Author

pellared commented Oct 11, 2023

@joshi-kamitsukasa Could you please add a snippet how would you use such function?

My guess is that it would rather prefer using func OpenDB(config pgx.ConnConfig, opts ...stdlib.OptionOpenDB) *sql.DB that could be added to https://pkg.go.dev/github.com/signalfx/splunk-otel-go/instrumentation/github.com/jackc/pgx/v5/splunkpgx.

Of course we would need to create splunksql.OpenDB anyway 😉

If you would like to have this sooner rather than later, please contact Splunk's support/sales to escalate this issue. More: https://docs.splunk.com/observability/en/get-started/support.html

@joshi-kamitsukasa
Copy link

@pellared Thanks for your reply.

For example below,

	return stdlib.OpenDB(*pgxConfig, []stdlib.OptionOpenDB{
		stdlib.OptionAfterConnect(func(ctx context.Context, conn *pgx.Conn) error {
			pgxdecimal.Register(conn.TypeMap())
			return setXxxxxFunc(ctx, conn)
		}),
		stdlib.OptionResetSession(setXxxxxFunc),
	}...), nil

We are going to contact support. Thanks.

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

No branches or pull requests

3 participants