Skip to content

Conversation

@wagnerdevocelot
Copy link
Owner

Summary

  • wrap in-memory storage with a new LoggingAdapter
  • integrate adapter in main.go for gradual replacement
  • expose metrics and logging for every storage operation

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_6874413d30d08328b231ade06e0f5eda

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LoggingAdapter implementation with per-operation counters and log output
  • Update main.go to 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 {

@wagnerdevocelot wagnerdevocelot merged commit f418bf2 into main Jul 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants