feat(integrations): AWS SDK v2 instrumentation + improved SQL tracing#29
Merged
karthikeyangs9 merged 4 commits intomainfrom Apr 7, 2026
Merged
feat(integrations): AWS SDK v2 instrumentation + improved SQL tracing#29karthikeyangs9 merged 4 commits intomainfrom
karthikeyangs9 merged 4 commits intomainfrom
Conversation
…acing AWS SDK v2 (integrations/aws): - New InstrumentSDK() wraps otelaws.AppendMiddlewares with auto-agent init - Per-service attributes (DynamoDB table, SQS queue URL, SNS topic ARN) captured automatically via otelaws built-in attribute builders - Option type alias so callers avoid a direct otelaws import SQL tracing improvements (integrations/database): - Add TracePing() to default options for connection health spans - Replace TraceQueryWithoutArgs with a custom queryTracer that stamps db.statement, db.operation (SELECT/INSERT/...), and db.sql.table onto every query span - Add WithSpanNameFormatter producing "SELECT users"-style span names instead of the generic "sql.query" - Add IncludeQueryArgs bool to Config for opt-in query arg capture (disabled by default to avoid PII exposure) - New parseSQL() helper with 22 test cases covering DML, DDL, subqueries, schema-qualified names, and quoted identifiers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- aws: fall through on agent.Start() failure (matches integrations/ pattern) instead of returning without attaching middleware; fix log capitalisation - database: replace double parseSQL() call per query with parseSQLCached() backed by sync.Map — SQL queries in production are a bounded, reused set - database: fix over-allocation in buildQueryTracer when IncludeQueryArgs=false (was allocating 3+len(args) even when args would not be written) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
karthikeyangs9
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
integrations/aws—InstrumentSDK(&cfg)wrapsotelaws.AppendMiddlewares; auto-starts agent; captures per-service attributes for DynamoDB, SQS, SNS automaticallyintegrations/database— every SQL span now carriesdb.statement,db.operation, anddb.sql.table; span names becomeSELECT usersinstead ofsql.query; opt-inIncludeQueryArgsfor arg capture;TracePing()added to defaultsparseSQLhelper — lightweight token-based extractor with 22 unit tests covering DML, DDL, subqueries, schema-qualified names, quoted identifiersWhat spans look like now
sql.querySELECT usersdb.system,server.addressdb.statement,db.operation=SELECT,db.sql.table=userssql.pingspans capturedTest plan
go test ./integrations/database/...— 22 parseSQL tests + existing DSN testsgo test ./integrations/aws/...— middleware append, nil-safe, options passthrough🤖 Generated with Claude Code