Add logging adapter for storage#40
Merged
wagnerdevocelot merged 1 commit intomainfrom Jul 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a LoggingAdapter that wraps the existing in-memory storage to log operations and collect metrics, and integrates this adapter in main.go for gradual rollout.
- Introduce
LoggingAdapterimplementation with per-operation counters and log output - Update
main.goto use the new adapter instead of raw in-memory store - Expose a
Metrics()method to retrieve collected metrics
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| main.go | Swapped raw store for NewLoggingAdapter(NewInMemoryStore()) |
| logging_adapter.go | Implemented LoggingAdapter that logs errors and counts ops |
Comments suppressed due to low confidence (8)
logging_adapter.go:51
- [nitpick] Variable name 'copy' shadows the built-in 'copy' function. Consider renaming it to 'metricsCopy' or similar.
copy := make(map[string]int, len(l.metrics))
logging_adapter.go:205
- [nitpick] Metric key 'GetPKCESessionError' is inconsistent with the method name GetPKCERequestSession; consider renaming to 'GetPKCERequestSessionError' for clarity.
l.inc("GetPKCESessionError")
logging_adapter.go:207
- [nitpick] Metric key 'GetPKCESession' doesn't match the method name GetPKCERequestSession; consider renaming to 'GetPKCERequestSession'.
l.inc("GetPKCESession")
logging_adapter.go:216
- [nitpick] Metric key 'CreatePKCESessionError' is missing 'Request' from CreatePKCERequestSession; consider 'CreatePKCERequestSessionError'.
l.inc("CreatePKCESessionError")
logging_adapter.go:218
- [nitpick] Metric key 'CreatePKCESession' should reflect CreatePKCERequestSession, e.g., 'CreatePKCERequestSession'.
l.inc("CreatePKCESession")
logging_adapter.go:227
- [nitpick] Metric key 'DeletePKCESessionError' should match DeletePKCERequestSession; consider 'DeletePKCERequestSessionError'.
l.inc("DeletePKCESessionError")
logging_adapter.go:229
- [nitpick] Metric key 'DeletePKCESession' is inconsistent with DeletePKCERequestSession; rename to 'DeletePKCERequestSession'.
l.inc("DeletePKCESession")
logging_adapter.go:37
- Add unit tests for LoggingAdapter to verify that metrics increment correctly and errors are logged as expected.
func NewLoggingAdapter(backend fullStorage) *LoggingAdapter {
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
LoggingAdaptermain.gofor gradual replacementTesting
go test ./...https://chatgpt.com/codex/tasks/task_e_6874413d30d08328b231ade06e0f5eda