Add health indicator for PgVector vector store#5764
Open
iaJingda wants to merge 1 commit intospring-projects:mainfrom
Open
Add health indicator for PgVector vector store#5764iaJingda wants to merge 1 commit intospring-projects:mainfrom
iaJingda wants to merge 1 commit intospring-projects:mainfrom
Conversation
Adds a Spring Boot Actuator HealthIndicator for the PgVector vector store that verifies the vector PostgreSQL extension is installed and reachable. Reports the extension version as part of the health details when UP. The health indicator can be disabled via: management.health.pgvector.enabled=false Closes spring-projectsgh-1611 Signed-off-by: jiajingda <dadamonkey1@gmail.com>
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
This PR adds a Spring Boot Actuator
HealthIndicatorfor the PgVector vector store, addressing #1611.Why
Spring AI vector stores can become unavailable independently from the application (e.g., database connection lost, the
vectorPostgreSQL extension uninstalled). Production deployments need observability into the health of these external dependencies, following Spring Boot's standardHealthIndicatorpattern.Changes
PgVectorStoreHealthIndicatorthat verifies thevectorPostgreSQL extension is installed and reachablePgVectorStoreHealthAutoConfigurationfor conditional auto-configurationAutoConfiguration.importsspring-boot-healthdependency inpom.xmlBehavior
The health indicator:
SELECT extversion FROM pg_extension WHERE extname = 'vector'UPwith details (vectorExtensionVersion,database) when the extension is installedDOWNwithreasonwhen the extension is missingDOWNwhen the query throws an exceptionmanagement.health.pgvector.enabled=falsepgvectorHealthIndicatorbeanTests
Unit tests cover:
PgVectorStorebean is presentUPstatus when vector extension is installed (with version details)DOWNstatus when vector extension is missingDOWNstatus on JDBC exceptionmanagement.health.pgvector.enabled=falsepgvectorHealthIndicatorbean is providedAll 6 tests pass locally.
Notes
This is intentionally a focused, minimal-scope PR for a single vector store. If the approach is approved, I'm happy to follow up with similar health indicators for other vector stores (Redis, Elasticsearch, etc.) in separate PRs.
Related to the earlier work in #5553 (closed), which proposed a similar pattern for Qdrant and Weaviate.