{"id":22347668,"url":"https://github.com/pgx-contrib/pgxtrace","last_synced_at":"2026-05-14T21:37:37.164Z","repository":{"id":225635101,"uuid":"766465626","full_name":"pgx-contrib/pgxtrace","owner":"pgx-contrib","description":"Composite query tracer for pgx v5 — chain multiple tracers (OpenTelemetry, logging, metrics) on a single pgx connection","archived":false,"fork":false,"pushed_at":"2026-05-10T10:12:40.000Z","size":64,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-10T12:23:03.221Z","etag":null,"topics":["go","golang","opentelemetry","pgx","pgxpool","postgresql","tracer"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/pgx-contrib/pgxtrace","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgx-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-03T10:51:17.000Z","updated_at":"2026-05-10T10:12:44.000Z","dependencies_parsed_at":"2024-03-03T12:24:56.695Z","dependency_job_id":"24547925-14d6-45d4-ba46-f344a5515a72","html_url":"https://github.com/pgx-contrib/pgxtrace","commit_stats":null,"previous_names":["pgx-contrib/pgxtrace","pgx-contrib/pgxc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pgx-contrib/pgxtrace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxtrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxtrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxtrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxtrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgx-contrib","download_url":"https://codeload.github.com/pgx-contrib/pgxtrace/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxtrace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33044458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","opentelemetry","pgx","pgxpool","postgresql","tracer"],"created_at":"2024-12-04T10:10:13.692Z","updated_at":"2026-05-14T21:37:37.159Z","avatar_url":"https://github.com/pgx-contrib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgxtrace\n\n[![CI](https://github.com/pgx-contrib/pgxtrace/actions/workflows/ci.yml/badge.svg)](https://github.com/pgx-contrib/pgxtrace/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/pgx-contrib/pgxtrace?include_prereleases)](https://github.com/pgx-contrib/pgxtrace/releases)\n[![Go Reference](https://pkg.go.dev/badge/github.com/pgx-contrib/pgxtrace.svg)](https://pkg.go.dev/github.com/pgx-contrib/pgxtrace)\n[![License](https://img.shields.io/github/license/pgx-contrib/pgxtrace)](LICENSE)\n[![Go](https://img.shields.io/badge/Go-1.25-00ADD8?logo=go\u0026logoColor=white)](https://go.dev)\n[![pgx](https://img.shields.io/badge/pgx-v5-blue)](https://github.com/jackc/pgx)\n\n`CompositeQueryTracer` is a decorator for [pgx v5](https://github.com/jackc/pgx)\nthat chains multiple tracers together. Assign it to `ConnConfig.Tracer` and\nevery database operation is dispatched to all registered tracers in order —\nquery, batch, connect, prepare, and copy-from.\n\n## Installation\n\n```bash\ngo get github.com/pgx-contrib/pgxtrace\n```\n\n## Usage\n\n### Connection pool\n\n```go\nconfig, err := pgxpool.ParseConfig(os.Getenv(\"PGX_DATABASE_URL\"))\nif err != nil {\n    panic(err)\n}\n\nconfig.ConnConfig.Tracer = pgxtrace.CompositeQueryTracer{\n    \u0026myTracer{},\n    \u0026anotherTracer{},\n}\n\npool, err := pgxpool.NewWithConfig(context.Background(), config)\nif err != nil {\n    panic(err)\n}\ndefer pool.Close()\n```\n\n### Mixing tracer types\n\nEach element only needs to implement `pgx.QueryTracer`. Elements that also\nimplement `pgx.ConnectTracer`, `pgx.BatchTracer`, `pgx.PrepareTracer`, or\n`pgx.CopyFromTracer` are automatically called for those operations:\n\n```go\nconfig.ConnConfig.Tracer = pgxtrace.CompositeQueryTracer{\n    \u0026pgxotel.QueryTracer{Name: \"my-service\"},  // all five interfaces\n    \u0026myAuditLogger{},                           // QueryTracer only\n}\n```\n\n## Development\n\n### DevContainer\n\nOpen in VS Code with the Dev Containers extension. The environment provides Go,\nPostgreSQL 18, and Nix automatically.\n\n```\nPGX_DATABASE_URL=postgres://vscode@postgres:5432/pgxtrace?sslmode=disable\n```\n\n### Nix\n\n```bash\nnix develop          # enter shell with Go\ngo tool ginkgo run -r\n```\n\n### Run tests\n\n```bash\n# Unit tests only (no database required)\ngo tool ginkgo run -r\n\n# With integration tests\nexport PGX_DATABASE_URL=\"postgres://localhost/pgxtrace?sslmode=disable\"\ngo tool ginkgo run -r\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgx-contrib%2Fpgxtrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgx-contrib%2Fpgxtrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgx-contrib%2Fpgxtrace/lists"}