feat(integrations): add OpenTelemetry and GORM sub-modules#465
feat(integrations): add OpenTelemetry and GORM sub-modules#465ajitpratap0 merged 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| @@ -0,0 +1,19 @@ | |||
| module github.com/ajitpratap0/GoSQLX/integrations/opentelemetry | |||
Check failure
Code scanning / Trivy
OpenTelemetry Go SDK Vulnerable to Arbitrary Code Execution via PATH Hijacking High
There was a problem hiding this comment.
This CVE (CVE-2026-24051) has been resolved. The OTel SDK was upgraded from v1.26.0 to v1.42.0, well above the fix version (v1.40.0). This alert is stale.
|
Claude finished @ajitpratap0's task —— View job Code Review CompleteI've thoroughly reviewed the OpenTelemetry and GORM integration sub-modules. Here's my comprehensive feedback: Review Checklist
🔒 CRITICAL Security IssueHIGH SEVERITY: OpenTelemetry Go SDK v1.26.0 is vulnerable to CVE-2026-24051 - Arbitrary Code Execution via PATH Hijacking. This must be addressed before merging. Solution: Update to OpenTelemetry SDK v1.40.0+ in - go.opentelemetry.io/otel/sdk v1.26.0
+ go.opentelemetry.io/otel/sdk v1.40.0📋 Code Quality & Best Practices✅ Excellent Architecture Decisions
✅ OpenTelemetry Integration (
|
| Module | Coverage | Race Tests | Edge Cases |
|---|---|---|---|
| OpenTelemetry | Good | ✅ (via CI) | |
| GORM | Fair | ✅ (via CI) |
Test strengths:
- Proper span verification in OpenTelemetry tests
- Real database integration in GORM tests
- Race detection enabled in CI
Test gaps:
- Error boundary testing
- Performance regression tests
- Concurrent access patterns
✅ Adherence to Project Conventions
- Memory management: Correctly uses
gosqlx.Parse()(handles pooling internally) - Error handling: Follows structured error patterns
- Documentation: Good package-level docs and comments
- Module structure: Follows Go module best practices
🎯 Final Verdict
DO NOT MERGE until security vulnerability is fixed. Once CVE-2026-24051 is addressed:
Strengths: Excellent architecture, clean integrations, proper isolation
Concerns: Security vulnerability, version mismatches, test coverage gaps
This is solid integration work that follows GoSQLX conventions well. The sub-module approach is particularly elegant for optional dependencies.
|
Claude finished @ajitpratap0's task —— View job Code Review CompleteI've thoroughly reviewed the OpenTelemetry and GORM integration sub-modules. Here's my comprehensive feedback: Review Checklist
🔒 Security AnalysisRESOLVED: OpenTelemetry Go SDK has been correctly updated to v1.42.0 in 📋 Code Quality & Best Practices✅ Excellent Architecture Decisions
✅ OpenTelemetry Integration (
|
| Module | Coverage | Race Tests | Edge Cases |
|---|---|---|---|
| OpenTelemetry | Good | ✅ (via CI) | |
| GORM | Fair | ✅ (via CI) |
Test strengths:
- Proper span verification in OpenTelemetry tests (
otel_test.go:22-40) - Real database integration in GORM tests (
plugin_test.go:24-34) - Race detection enabled in CI (
.github/workflows/integrations.yml:26,40)
Test gaps:
- Error boundary testing
- Performance regression tests
- Concurrent access patterns
✅ Adherence to Project Conventions
- Memory management: Correctly uses
gosqlx.Parse()(handles pooling internally) - Error handling: Follows structured error patterns
- Documentation: Good package-level docs and comments
- Module structure: Follows Go module best practices
🎯 Final Verdict
Strengths: Excellent architecture, clean integrations, proper isolation, security vulnerability resolved
Concerns: Version mismatches, test coverage gaps, potential memory growth
This is solid integration work that follows GoSQLX conventions well. The sub-module approach is particularly elegant for optional dependencies. Recommend addressing the version mismatches before merging and considering the test coverage improvements for future releases.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Full-project audit using 5 parallel analytical personas (Performance, SQL Compatibility, API/DX, Competitive, Community). Synthesizes into prioritized P0–P3 roadmap covering: HN launch, query fingerprinting, linter expansion to 30 rules, DML transforms, C binding hardening, live DB schema introspection, SQL transpilation, CONNECT BY, OTel, GORM integration, and advisor expansion. Corresponding GitHub issues: #442–#460 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
12 implementation plans covering all prioritized GitHub issues: P0 (Critical): - 2026-03-29-sentry-fixes.md (#434, #437) — fix Sentry noise filters - 2026-03-29-openssf-scorecard.md (#443) — security scorecard badge P1 (High Priority): - 2026-03-29-query-fingerprinting.md (#444) — SQL normalization + SHA-256 fingerprints - 2026-03-29-linter-expansion.md (#445) — L011-L030 safety/performance/naming rules - 2026-03-29-dml-transforms.md (#446) — SET clause and RETURNING transforms - 2026-03-29-cbinding-hardening.md (#447) — C binding coverage + stress tests - 2026-03-29-advisor-expansion.md (#453) — OPT-009 through OPT-020 advisor rules P2 (Medium Priority): - 2026-03-29-sql-parser-additions.md (#450, #454, #455, #456) — DDL formatter, CONNECT BY, SAMPLE, PIVOT/UNPIVOT - 2026-03-29-schema-introspection.md (#448) — live DB schema introspection (Postgres, MySQL, SQLite) - 2026-03-29-integrations.md (#451, #452) — OpenTelemetry + GORM sub-modules - 2026-03-29-sql-transpilation.md (#449) — SQL dialect transpilation API P3 (Low Priority): - 2026-03-29-p3-items.md (#458, #459, #460) — CLI watch registration, pool stats, JSON functions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- integrations/opentelemetry: InstrumentedParse() wraps gosqlx.Parse() with OTel spans (db.system, db.statement.type, db.sql.tables, db.sql.columns); errors recorded on span with status Error; 3 tests pass with race detector - integrations/gorm: Plugin struct implementing gorm.Plugin; afterStatement callback normalizes GORM SQL (backtick→double-quote, ?→$N) before parsing; Stats()/Reset() API; nil Statement guard; 5 tests pass with race detector - .github/workflows/integrations.yml: separate jobs for each sub-module - CHANGELOG.md: document new sub-modules under [Unreleased] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updates go.opentelemetry.io/otel/sdk from v1.26.0 to v1.42.0 to fix HIGH severity PATH hijacking vulnerability (GHSA-9h8m-3fm2-qjrq). Also bumps transitive deps: logr v1.4.3, sys v0.41.0.
…ry limit, error callback - CI workflow: bump go-version from 1.23 to 1.26 to match project requirements - GORM plugin: add maxHistory field (default 1000) to bound query record growth - GORM plugin: add OnParseError callback for visibility into parse failures - GORM plugin: add NewPluginWithOptions constructor with PluginOptions struct - Tests: add coverage for MaxHistory trimming, OnParseError callback, defaults Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
177309c to
43fa934
Compare
|
Claude finished @ajitpratap0's task —— View job Code Review CompleteI've thoroughly reviewed the OpenTelemetry and GORM integration sub-modules. Here's my comprehensive feedback: Review Checklist
🔒 Security AnalysisRESOLVED: OpenTelemetry Go SDK has been correctly updated to v1.42.0 in 📋 Code Quality & Best Practices✅ Excellent Architecture Decisions
✅ OpenTelemetry Integration (
|
| Module | Coverage | Race Tests | Edge Cases |
|---|---|---|---|
| OpenTelemetry | Good | ✅ (via CI) | |
| GORM | Good | ✅ (via CI) | ✅ Comprehensive |
Test strengths:
- Proper span verification in OpenTelemetry tests (
otel_test.go:22-40) - Real database integration in GORM tests (
plugin_test.go:24-34) - Race detection enabled in CI (
.github/workflows/integrations.yml:26,40) - Comprehensive GORM plugin testing including error handling, history limits, and callbacks
Test gaps:
- OpenTelemetry: Column extraction verification, multiple statement handling
- Performance regression tests (though less critical for integrations)
✅ Adherence to Project Conventions
- Memory management: Correctly uses
gosqlx.Parse()(handles pooling internally) - Error handling: Follows structured error patterns
- Documentation: Good package-level docs and comments
- Module structure: Follows Go module best practices
- Thread safety: Proper mutex usage where needed
🎯 Final Verdict
APPROVE WITH MINOR SUGGESTIONS
Strengths:
- Excellent architecture with proper sub-module isolation
- Clean integrations that follow GoSQLX conventions
- Security vulnerability already resolved
- Comprehensive GORM plugin with configurable options
- Well-tested with race detection
Minor concerns:
- Go version mismatch in go.mod files (cosmetic)
- Test coverage gaps for OpenTelemetry (non-blocking)
This is solid integration work that demonstrates good understanding of both GoSQLX internals and the target frameworks. The sub-module approach is particularly elegant for optional dependencies. The implementations are production-ready and follow all project conventions.
|
Claude finished @ajitpratap0's task —— View job Code Review CompleteI've thoroughly reviewed the OpenTelemetry and GORM integration sub-modules. Here's my comprehensive feedback: Review Checklist
🔒 Security AnalysisRESOLVED: OpenTelemetry Go SDK has been correctly updated to v1.42.0 in 📋 Code Quality & Best Practices✅ Excellent Architecture Decisions
✅ OpenTelemetry Integration (
|
| Module | Coverage | Race Tests | Edge Cases |
|---|---|---|---|
| OpenTelemetry | Good | ✅ (via CI) | |
| GORM | Good | ✅ (via CI) | ✅ Comprehensive |
Test strengths:
- Proper span verification in OpenTelemetry tests (
otel_test.go:22-40) - Real database integration in GORM tests (
plugin_test.go:24-34) - Race detection enabled in CI (
.github/workflows/integrations.yml:26,40) - Comprehensive GORM plugin testing including error handling, history limits, and callbacks
Test gaps:
- OpenTelemetry: Column extraction verification, multiple statement handling
- Performance regression tests (though less critical for integrations)
✅ Adherence to Project Conventions
- Memory management: Correctly uses
gosqlx.Parse()(handles pooling internally) - Error handling: Follows structured error patterns
- Documentation: Good package-level docs and comments
- Module structure: Follows Go module best practices
- Thread safety: Proper mutex usage where needed
🎯 Final Verdict
APPROVE WITH MINOR SUGGESTIONS
Strengths:
- Excellent architecture with proper sub-module isolation
- Clean integrations that follow GoSQLX conventions
- Security vulnerability already resolved
- Comprehensive GORM plugin with configurable options
- Well-tested with race detection
Minor concerns:
- Go version mismatch in go.mod files (cosmetic)
- Test coverage gaps for OpenTelemetry (non-blocking)
This is solid integration work that demonstrates good understanding of both GoSQLX internals and the target frameworks. The sub-module approach is particularly elegant for optional dependencies. The implementations are production-ready and follow all project conventions.
Summary
integrations/opentelemetry/sub-module withInstrumentedParse(ctx, tp, sql)that wrapsgosqlx.Parse()with an OpenTelemetry span, recordingdb.system,db.statement.type,db.sql.tables, anddb.sql.columnsattributes; errors are recorded on the span with statusErrorintegrations/gorm/sub-module with aPluginimplementinggorm.Plugin; theafterStatementcallback normalizes GORM SQL (backtick identifiers → double-quotes,?→$N) before parsing with GoSQLX, handles nilStatementgracefully, and exposesStats()andReset()APIs.github/workflows/integrations.ymlwith separate CI jobs for each sub-module, each using its ownworking-directorygo.modwith areplace github.com/ajitpratap0/GoSQLX => ../../directive so users who don't need them pay zero dependency costCloses #451, #452
Test plan
integrations/opentelemetry: 3 tests pass — span creation, error recording, table extractionintegrations/gorm: 5 tests pass — Name(), Initialize(), query recording, table name extraction, no panic on raw SQL-raceflagintegrations/**🤖 Generated with Claude Code