Skip to content

chore: add structured lifecycle logging to postgres configstore and logstore initialization - #4409

Merged
akshaydeo merged 3 commits into
devfrom
06-15-chore_adds_more_verbose_logs_for_configstore_connection
Jun 15, 2026
Merged

chore: add structured lifecycle logging to postgres configstore and logstore initialization#4409
akshaydeo merged 3 commits into
devfrom
06-15-chore_adds_more_verbose_logs_for_configstore_connection

Conversation

@impoiler

@impoiler impoiler commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds structured, step-by-step info and error logging throughout the Postgres initialization path for both the config store and log store. This makes it significantly easier to diagnose startup hangs or failures — particularly when the database host is unreachable, migrations are blocked on an advisory lock, or connection pool setup fails.

Changes

  • Added Info log lines at each major stage of Postgres store initialization: target host/port/db/sslmode, migration pool open, migration execution, migration pool close, runtime pool open, pool tuning, plaintext row encryption, and final ready state.
  • Added Error log lines immediately before returning errors so failures are surfaced with context rather than silently propagated.
  • Log messages include actionable hints (e.g., "if this step hangs, the database host/port is likely unreachable", "may block on a cross-node advisory lock if another pod is migrating").

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Start the service pointed at a Postgres instance and observe logs during startup. Verify that each initialization stage emits the expected log lines. To test error paths, point the service at an unreachable host and confirm the error log is emitted before the process exits.

go test ./framework/configstore/... ./framework/logstore/...

Breaking changes

  • Yes
  • No

Security considerations

The connection info logged (host, port, db name, SSL mode) does not include credentials. Passwords are not logged.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e70fec4-3ff4-4823-a556-8b41b73f6ca4

📥 Commits

Reviewing files that changed from the base of the PR and between a252d00 and 0f474cb.

📒 Files selected for processing (2)
  • framework/configstore/postgres.go
  • framework/logstore/postgres.go
✅ Files skipped from review due to trivial changes (1)
  • framework/logstore/postgres.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • framework/configstore/postgres.go

📝 Walkthrough

Summary by CodeRabbit

Chores

  • Added detailed structured logging to PostgreSQL configuration and log store initialization flows, including startup diagnostics, schema migrations, and connection pool lifecycle events.

Walkthrough

Structured logger.Info and logger.Error calls are inserted into newPostgresConfigStore and newPostgresLogStore initialization paths. The additions cover logging the resolved Postgres target, migration pool open/close, schema migration execution, runtime pool open and tuning, and the plaintext-row encryption step. No control flow, error handling, or public APIs are changed.

Changes

Postgres Store Startup Logging

Layer / File(s) Summary
ConfigStore initialization logging
framework/configstore/postgres.go
Adds an Info log for the resolved Postgres target (host/port/db/sslmode), Info/Error logs wrapping migration pool open, migration execution, pool close, runtime pool open, and tuning failures, plus Info/Error logs around the startup EncryptPlaintextRows call and a readiness log on success.
LogStore initialization logging
framework/logstore/postgres.go
Adds Info/Error logs for migration pool open, server version check, version-gate condition, migration execution, migration pool close, runtime pool open, and a readiness log once the runtime pool is established.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐇 Hop hop, the logs now speak aloud,
Each pool that opens wears a proud cloud.
Migration done? A message is sent!
Encryption ready? Logger is content.
No logic changed, just words in a row —
Now startup stages put on quite a show! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding structured logging to Postgres store initialization for both config and log stores.
Description check ✅ Passed The description is comprehensive and follows the template structure, covering summary, changes, type, affected areas, testing, and security considerations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-15-chore_adds_more_verbose_logs_for_configstore_connection

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands and usage tips.

@impoiler impoiler self-assigned this Jun 15, 2026
@impoiler impoiler changed the title feat: add structured lifecycle logging to postgres configstore and logstore initialization chore: add structured lifecycle logging to postgres configstore and logstore initialization Jun 15, 2026
@impoiler
impoiler marked this pull request as ready for review June 15, 2026 13:02
@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge after adding the missing error log before the ApplyPoolTuning return in logstore — a one-line fix.

The configstore side is complete and correct. In the logstore, every error-return path now logs except the ApplyPoolTuning failure — the only silent early-return in the function. A pool-tuning failure during logstore startup would produce no diagnostic output, directly contradicting the purpose of this change.

framework/logstore/postgres.go — the ApplyPoolTuning failure path (lines 149-152) needs a logger.Error before return.

Important Files Changed

Filename Overview
framework/configstore/postgres.go Adds structured Info/Error log lines at each major initialization stage; all error paths consistently emit a logger.Error before returning. Host/port/db/sslmode are logged without credentials.
framework/logstore/postgres.go Adds structured Info/Error log lines at each initialization stage, but the ApplyPoolTuning failure path (line 149-152) is missing a logger.Error before returning, unlike the equivalent configstore path and every other error path in this same function.

Reviews (5): Last reviewed commit: "chore: adds more verbose logs for config..." | Re-trigger Greptile

Comment thread framework/logstore/postgres.go Outdated
Comment thread framework/logstore/postgres.go Outdated
@impoiler
impoiler force-pushed the 06-15-chore_adds_more_verbose_logs_for_configstore_connection branch from 87dad4a to 70b64d9 Compare June 15, 2026 13:04
@impoiler
impoiler force-pushed the 06-15-fix_allow_hard_delete_for_custom_servers_on_mcp_library branch from 527a36c to 536a898 Compare June 15, 2026 13:04
@impoiler
impoiler force-pushed the 06-15-chore_adds_more_verbose_logs_for_configstore_connection branch from 70b64d9 to a252d00 Compare June 15, 2026 13:07

akshaydeo commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Merge activity

@impoiler
impoiler force-pushed the 06-15-fix_allow_hard_delete_for_custom_servers_on_mcp_library branch from 536a898 to d55841b Compare June 15, 2026 13:57
@impoiler
impoiler force-pushed the 06-15-chore_adds_more_verbose_logs_for_configstore_connection branch from a252d00 to 0f474cb Compare June 15, 2026 13:57
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 15, 2026
@akshaydeo
akshaydeo changed the base branch from 06-15-fix_allow_hard_delete_for_custom_servers_on_mcp_library to graphite-base/4409 June 15, 2026 14:22
@akshaydeo
akshaydeo changed the base branch from graphite-base/4409 to dev June 15, 2026 14:23
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review June 15, 2026 14:23

The base branch was changed.

@akshaydeo
akshaydeo merged commit befeccc into dev Jun 15, 2026
12 checks passed
@akshaydeo
akshaydeo deleted the 06-15-chore_adds_more_verbose_logs_for_configstore_connection branch June 15, 2026 14:23
akshaydeo pushed a commit that referenced this pull request Jun 15, 2026
…ogstore initialization (#4409)

## Summary

Adds structured, step-by-step info and error logging throughout the Postgres initialization path for both the config store and log store. This makes it significantly easier to diagnose startup hangs or failures — particularly when the database host is unreachable, migrations are blocked on an advisory lock, or connection pool setup fails.

## Changes

- Added `Info` log lines at each major stage of Postgres store initialization: target host/port/db/sslmode, migration pool open, migration execution, migration pool close, runtime pool open, pool tuning, plaintext row encryption, and final ready state.
- Added `Error` log lines immediately before returning errors so failures are surfaced with context rather than silently propagated.
- Log messages include actionable hints (e.g., "if this step hangs, the database host/port is likely unreachable", "may block on a cross-node advisory lock if another pod is migrating").

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [x] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Start the service pointed at a Postgres instance and observe logs during startup. Verify that each initialization stage emits the expected log lines. To test error paths, point the service at an unreachable host and confirm the error log is emitted before the process exits.

```sh
go test ./framework/configstore/... ./framework/logstore/...
```

## Breaking changes

- [ ] Yes
- [x] No

## Security considerations

The connection info logged (host, port, db name, SSL mode) does not include credentials. Passwords are not logged.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
…ogstore initialization (maximhq#4409)

## Summary

Adds structured, step-by-step info and error logging throughout the Postgres initialization path for both the config store and log store. This makes it significantly easier to diagnose startup hangs or failures — particularly when the database host is unreachable, migrations are blocked on an advisory lock, or connection pool setup fails.

## Changes

- Added `Info` log lines at each major stage of Postgres store initialization: target host/port/db/sslmode, migration pool open, migration execution, migration pool close, runtime pool open, pool tuning, plaintext row encryption, and final ready state.
- Added `Error` log lines immediately before returning errors so failures are surfaced with context rather than silently propagated.
- Log messages include actionable hints (e.g., "if this step hangs, the database host/port is likely unreachable", "may block on a cross-node advisory lock if another pod is migrating").

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [x] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Start the service pointed at a Postgres instance and observe logs during startup. Verify that each initialization stage emits the expected log lines. To test error paths, point the service at an unreachable host and confirm the error log is emitted before the process exits.

```sh
go test ./framework/configstore/... ./framework/logstore/...
```

## Breaking changes

- [ ] Yes
- [x] No

## Security considerations

The connection info logged (host, port, db name, SSL mode) does not include credentials. Passwords are not logged.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
…ogstore initialization (maximhq#4409)

## Summary

Adds structured, step-by-step info and error logging throughout the Postgres initialization path for both the config store and log store. This makes it significantly easier to diagnose startup hangs or failures — particularly when the database host is unreachable, migrations are blocked on an advisory lock, or connection pool setup fails.

## Changes

- Added `Info` log lines at each major stage of Postgres store initialization: target host/port/db/sslmode, migration pool open, migration execution, migration pool close, runtime pool open, pool tuning, plaintext row encryption, and final ready state.
- Added `Error` log lines immediately before returning errors so failures are surfaced with context rather than silently propagated.
- Log messages include actionable hints (e.g., "if this step hangs, the database host/port is likely unreachable", "may block on a cross-node advisory lock if another pod is migrating").

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [x] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Start the service pointed at a Postgres instance and observe logs during startup. Verify that each initialization stage emits the expected log lines. To test error paths, point the service at an unreachable host and confirm the error log is emitted before the process exits.

```sh
go test ./framework/configstore/... ./framework/logstore/...
```

## Breaking changes

- [ ] Yes
- [x] No

## Security considerations

The connection info logged (host, port, db name, SSL mode) does not include credentials. Passwords are not logged.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants