refactor(otto): implement modular architecture with database support using sqlx#17
Open
austinlparker wants to merge 2 commits intoopen-telemetry:mainfrom
Open
refactor(otto): implement modular architecture with database support using sqlx#17austinlparker wants to merge 2 commits intoopen-telemetry:mainfrom
austinlparker wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
This commit includes: - Restructured code into specialized packages for better separation of concerns - Added database support with migrations for persistent storage - Implemented oncall rotation management module with SQLite backend - Added module system for easy extension and component management - Fixed all linting issues across the codebase - Enhanced Makefile with improved tooling and workflow commands
jaronoff97
reviewed
May 14, 2025
jaronoff97
left a comment
There was a problem hiding this comment.
some initial thoughts for review. code is a bit verbose, but makes sense in structure. Some suggestions on how to simplify.
Comment on lines
+14
to
+17
| // Entity represents a database entity with an ID. | ||
| type Entity interface { | ||
| GetID() string | ||
| } |
There was a problem hiding this comment.
i feel like this should be in the entity.go file.
otto/internal/database/repository.go
Outdated
| } | ||
|
|
||
| // Create inserts a new entity. | ||
| func (r *SQLRepository[T]) Create(ctx context.Context, entity *T) error { |
There was a problem hiding this comment.
IMO it would probably be easier to use something like sqlx which handles most of this mapping and selecting.
Comment on lines
+24
to
+28
| // SlogLogger is an implementation of Logger using Go's standard log/slog package. | ||
| type SlogLogger struct { | ||
| logger *slog.Logger | ||
| } | ||
|
|
There was a problem hiding this comment.
why are we wrapping slog here and not just using directly?
| } | ||
|
|
||
| // MockRegistry is a mock implementation of Registry for testing. | ||
| type MockRegistry struct { |
There was a problem hiding this comment.
i don't think we need a mock registry, we can probably use the real one.
otto/modules/oncall/mappers.go
Outdated
| } | ||
|
|
||
| // ToRow maps an entity to database column values. | ||
| func (m *OnCallRotationMapper) ToRow(entity *OnCallRotation) []interface{} { |
There was a problem hiding this comment.
like above, i think sqlx will handle a lot of this.
- Added jmoiron/sqlx library for simplified database operations - Replaced custom SQL mapping with struct-based scanning - Fixed type handling for EscalationStatus - Updated tests to work with the new implementation - Removed no longer needed mappers.go file
|
@austinlparker is this ready for another review? |
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
Technical Changes
Test Plan
make testmake lint🤖 Generated with Claude Code