Contents

llcfreedom-space/fs-app-health-checks

This repository offers a wide collection of health checks features for widely used services and platforms.

Installation

App Health Checks is available with Swift Package Manager. The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding App Health Checks as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/LLCFreedom-Space/fs-app-health-checks.git", from: "x.x.x")
]

List of checks

  • Application – Basic application health status.
  • ConsulHealthChecks – Checks the status of your Consul services.
  • MongoHealthChecks – Checks MongoDB connectivity and status.
  • PostgresHealthChecks – Checks PostgreSQL connectivity and status.
  • RedisHealthChecks – Checks Redis connectivity and status.

Example of result

{
  "status": "pass",
  "version": "1",
  "releaseId": "1.0.0",
  "serviceId": "43119325-63f5-4e14-9175-84e0e296c527",
  "notes": ["All services operational"],
  "checks": {
    "system": [
      {
        "componentId": "system-uptime",
        "componentType": "system",
        "observedValue": 12345,
        "observedUnit": "s",
        "status": "pass",
        "time": "2026-03-25T17:36:48Z"
      }
    ],
    "datastore": [
      {
        "componentId": "mongo-db-1",
        "componentType": "datastore",
        "observedValue": 12.5,
        "observedUnit": "ms",
        "status": "pass",
        "time": "2026-03-25T17:36:48Z"
      },
      {
        "componentId": "redis-db-1",
        "componentType": "datastore",
        "observedValue": 2.1,
        "observedUnit": "ms",
        "status": "pass",
        "time": "2026-03-25T17:36:48Z"
      },
      {
        "componentId": "postgres-db-1",
        "componentType": "datastore",
        "observedValue": 15.0,
        "observedUnit": "ms",
        "status": "pass",
        "time": "2026-03-25T17:36:48Z"
      }
    ],
    "component": [
      {
        "componentId": "consul-service-1",
        "componentType": "component",
        "observedValue": 15.3,
        "observedUnit": "ms",
        "status": "pass",
        "time": "2026-03-25T17:36:48Z"
      }
    ]
  }
}

πŸ“Š MongoDB Connection Strategies Comparison

| Feature / Behavior | Eager Connection | Lazy Connection | Hybrid Approach (Recommended) | |--------------------------|--------------------------------------------------|--------------------------------------------------|----------------------------------------------------------| | Connection timing | At application startup | On first database operation | Lazy + background warm-up after startup | | Initialization type | Asynchronous (async/await) | Synchronous | Mixed (lazy + async warm-up task) | | Failure behavior | Fails fast on startup | Fails later at runtime | Does not block startup, but surfaces errors early | | Startup impact | Slower (waits for DB) | Fast | Fast startup with controlled background initialization | | Reliability at start | High (connection guaranteed) | Low (not verified yet) | Medium β†’ High (verified shortly after startup) | | First request latency| None | Possible delay | Usually none (connection warmed up in background) | | Error visibility | Immediate | Delayed | Early but non-blocking | | Best use cases | Critical systems, strict environments | Dev / staging, optional dependencies | Production-grade distributed systems | | Resilience pattern | Fail-fast | Lazy-init | Lazy-init + retry + warm-up + health checks |

Package Metadata

Repository: llcfreedom-space/fs-app-health-checks

Default branch: main

README: README.md