Skip to content

FDE-57: feat(database): expose ParseDSNAttributes as public API#18

Merged
karthikeyangs9 merged 1 commit intomainfrom
prathamesh/fde-57-expose-parse-dsn-attributes
Feb 27, 2026
Merged

FDE-57: feat(database): expose ParseDSNAttributes as public API#18
karthikeyangs9 merged 1 commit intomainfrom
prathamesh/fde-57-expose-parse-dsn-attributes

Conversation

@prathamesh-sonpatki
Copy link
Member

Summary

  • Renames unexported extractDSNAttributesParseDSNAttributes to expose it as a public API
  • Adds unit tests for Postgres, MySQL, SQLite, and empty DSN cases

Problem

Users creating manual wrapper spans for DB operations (e.g. FindTopicByID) were missing server.address, server.port, db.user attributes. These were only being added to spans auto-generated by otelsql, not to hand-rolled spans using a custom tracer scope.

Usage

span.SetAttributes(database.ParseDSNAttributes(dsn, "mysql")...)

Linear

https://linear.app/last9/issue/FDE-57

Test plan

  • Unit tests: go test ./integrations/database/... -run TestParseDSN (8 cases, all passing)
  • Linter: golangci-lint run ./integrations/database/... — clean

🤖 Generated with Claude Code

Renames unexported extractDSNAttributes to ParseDSNAttributes so callers
can stamp server.address, server.port, db.user, and db.name onto manually
created wrapper spans — not just on spans auto-generated by otelsql.

  span.SetAttributes(database.ParseDSNAttributes(dsn, "mysql")...)

Adds unit tests covering Postgres, MySQL (with/without port, with query
params), SQLite (no network attrs), and empty DSN edge cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@karthikeyangs9 karthikeyangs9 merged commit 754fc7e into main Feb 27, 2026
10 checks passed
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.

2 participants