Health Check

The Health Check feature in Babel Licensing Service provides a comprehensive mechanism to monitor the health and operational status of the service and its components. This feature is essential for ensuring system reliability, facilitating troubleshooting, and enabling integration with infrastructure monitoring tools.

Configuration

Health Check behavior is configured through the Application section in the appsettings.json file:

"Application": {
    "HealthCheckEndPoint": "/health",
    "HealthCheckResponseType": "JSON"
}

HealthCheckEndPoint

This setting specifies the URL path where the health check endpoint will be accessible. The default value is /health.

Example: If your service is running at https://licensing.example.com and the HealthCheckEndPoint is set to /health, the full health check URL would be https://licensing.example.com/health.

HealthCheckResponseType

This setting determines the format of the health check response. Two formats are supported:

  • JSON: Returns a structured JSON response (default)

  • TEXT: Returns a human-readable plain text response

JSON Response Format

When HealthCheckResponseType is set to "JSON", the health check endpoint produces a structured JSON response like this:

{
  "status": "Healthy",
  "duration": "00:00:00.2514204",
  "timestamp": "2025-03-20T07:26:07.1085160Z",
  "checks": [
    {
      "name": "babel_service_health",
      "status": "Healthy",
      "duration": "00:00:00.0010617",
      "data": {
        "serverTimeUtc": "2025-03-20T07:26:06.8604190Z",
        "activeTokens": 0
      }
    },
    {
      "name": "database_health",
      "status": "Healthy",
      "duration": "00:00:00.1003761"
    },
    {
      "name": "webhook_processor_health",
      "status": "Healthy",
      "duration": "00:00:00.0605641",
      "data": {
        "hasFailedEvents": false
      }
    },
    {
      "name": "geo_location_health",
      "status": "Healthy",
      "duration": "00:00:00.2456515"
    }
  ]
}

This format is ideal for:

  • Automated monitoring systems

  • Integration with orchestration platforms like Kubernetes

  • Programmatic health status evaluation

  • Third-party monitoring tools that can parse JSON data

TEXT Response Format

When HealthCheckResponseType is set to "TEXT", the health check endpoint produces a human-readable format:

Babel Licensing Service v. 11.0.0.0

Status: Healthy
Duration: 00:00:00.2586788
Timestamp: 2025-03-20T07:23:14.0761680Z
Version: 11.0.0.0

Checks:
- Babel Licensing Service: Healthy (00:00:00.0024254)
    * Server Time Utc: 2025-03-20T07:23:13.8180050Z
    * Active Tokens: 0

- Database: Healthy (00:00:00.0901153)
- Webhook Processor: Healthy (00:00:00.0687397)
    * Has Failed Events: False

- Geo Location: Healthy (00:00:00.2550240)

This format is better suited for:

  • Manual inspection by system administrators

  • Command-line tools and simple status checks

  • Situations where the response needs to be easily readable without additional parsing

  • Log file entries and console output

Health Check Components

The Babel Licensing Service health check monitors several critical components:

  1. Service Health: Provides information about the main service, including server time, license edition, active tokens, and maximum allowed tokens.

  2. Database Health: Verifies connectivity and operational status of the database.

  3. Webhook Processor: Checks if the webhook processing system is functioning correctly.

  4. Geo Location Service: Confirms that the configured geolocation service (like IpApiIs) is operational.

Status Values

Health checks will report one of the following statuses:

  • Healthy: The component is functioning normally

  • Degraded: The component is operational but with reduced functionality or performance

  • Unhealthy: The component is not functioning properly

Integration with Monitoring Systems

The health check endpoint can be integrated with various monitoring systems:

  • Load Balancers: Can use the health check to determine if the service should receive traffic

  • Container Orchestration: Platforms like Kubernetes can use the endpoint for readiness and liveness probes

  • Monitoring Tools: Systems like Prometheus, Nagios, or Zabbix can periodically check the endpoint

  • Custom Dashboards: The JSON format can be consumed by custom monitoring dashboards

Best Practices

  1. Regular Monitoring: Configure your monitoring system to check the health endpoint at regular intervals.

  2. Alerting: Set up alerts for when the service transitions from Healthy to Degraded or Unhealthy.

  3. Response Format Selection: Choose JSON for automated systems and TEXT for human operators.

  4. Custom Endpoint: Consider changing the default endpoint for security reasons in production environments.

  5. Firewall Configuration: Ensure your firewall allows access to the health check endpoint from your monitoring systems.

The Health Check feature is an essential tool for maintaining the reliability and stability of your Babel Licensing Service deployment by providing real-time insights into the operational status of the system and its components.

Last updated