Class: Woods::Observability::HealthCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/woods/observability/health_check.rb

Overview

Probes configured components and reports overall system health.

Checks vector store, metadata store, and embedding provider by calling lightweight operations on each. Components that are nil are reported as :not_configured and do not affect the overall healthy? status.

Examples:

check = HealthCheck.new(
  vector_store: vector_store,
  metadata_store: ,
  embedding_provider: provider
)
status = check.run
status.healthy?    # => true
status.components  # => { vector_store: :ok, metadata_store: :ok, embedding_provider: :ok }

Defined Under Namespace

Classes: HealthStatus

Instance Method Summary collapse

Constructor Details

#initialize(vector_store: nil, metadata_store: nil, embedding_provider: nil) ⇒ HealthCheck

Returns a new instance of HealthCheck.

Parameters:

  • vector_store (Object, nil) (defaults to: nil)

    Vector store adapter (must respond to #count)

  • metadata_store (Object, nil) (defaults to: nil)

    Metadata store adapter (must respond to #count)

  • embedding_provider (Object, nil) (defaults to: nil)

    Embedding provider (must respond to #embed)



28
29
30
31
32
# File 'lib/woods/observability/health_check.rb', line 28

def initialize(vector_store: nil, metadata_store: nil, embedding_provider: nil)
  @vector_store = vector_store
  @metadata_store = 
  @embedding_provider = embedding_provider
end

Instance Method Details

#runHealthStatus

Run health probes on all configured components.

Returns:

  • (HealthStatus)

    Result with healthy? flag and per-component status



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/woods/observability/health_check.rb', line 37

def run
  components = {
    vector_store: probe_store(@vector_store),
    metadata_store: probe_store(@metadata_store),
    embedding_provider: probe_provider(@embedding_provider)
  }

  all_healthy = components.values.all? { |status| %i[ok not_configured].include?(status) }

  HealthStatus.new(healthy?: all_healthy, components: components)
end