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

OTEL tracing support #1176

Open
NickBelhomme opened this issue Sep 25, 2024 · 3 comments
Open

OTEL tracing support #1176

NickBelhomme opened this issue Sep 25, 2024 · 3 comments

Comments

@NickBelhomme
Copy link

NickBelhomme commented Sep 25, 2024

Is your feature request related to a problem? Please describe.
We are using pgx/v5: https://github.com/golang-migrate/migrate/tree/master/database/pgx/v5
This works great, however for our general usage we have attached an OTEL tracer to it.
https://pkg.go.dev/github.com/jackc/pgx/v5#ConnConfig.Tracer

    config, _ := pgxpool.ParseConfig("postgres://test:[email protected]:5432/test?sslmode=require&pool_max_conns=10&pool_max_conn_lifetime=20&pool_max_conn_idle_time=10")
    config.Tracer = otelpgx.NewTracer()
   conn, err := pgxpool.NewWithConfig(ctx, config)

currently looking at the migrate codebase I do not see an option to pass the tracer as a config option...

Describe the solution you'd like
A possibility to pass a tracer to the config

Why
It is useful to know how long some migration statements have run atomically .

@joschi
Copy link
Contributor

joschi commented Sep 30, 2024

Kind of related to #1132.

@joschi
Copy link
Contributor

joschi commented Dec 10, 2024

I got this pretty much working for most of the database drivers supported by golang-migrate.

Example screenshot of a trace running the SQLite example migrations:
Dash0 golang-migrate trace
Dash0 golang-migrate trace

@dhui It still needs some tuning here and there, but if the appetite is there, I can probably come up with a PR soon (-ish).

Although it kind of depends on #1132 being merged. 😅

@joschi
Copy link
Contributor

joschi commented Dec 21, 2024

Latest update:

  • Source drivers are also instrumented now. While this doesn't make too much sense for the file driver (reading migrations from the local filesystem), it does for remote drivers such as github and gitlab.
Source driver span with migration version and source driver name attributes GitHub source driver span with request attributes
  • Database drivers have more attributes, such as the currently running migration.
Database driver span with migration identifier, version, and direction

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

2 participants