Package com.tnsai.quality.observability.health
package com.tnsai.quality.observability.health
Health check infrastructure for TnsAI components.
This package provides a comprehensive health monitoring system for agents, LLM providers, and system resources.
Core Components
HealthIndicator- Interface for health checksHealthCheckResult- Health check result with detailsHealthRegistry- Central registry for indicatorsHealthStatus- Health status enum
Built-in Health Indicators
AgentHealthIndicator- Agent health monitoringLLMHealthIndicator- LLM provider healthResourceHealthIndicator- System resources
Quick Start
// Get the global registry
HealthRegistry registry = HealthRegistry.getInstance();
// Register health indicators
registry.register(new AgentHealthIndicator(myAgent));
registry.register(new LLMHealthIndicator(llmClient, "openai"));
registry.register(new ResourceHealthIndicator());
// Check overall health
HealthCheckResult result = registry.checkAll();
System.out.println("Status: " + result.getStatus());
// Get health summary for HTTP endpoint
Map<String, Object> summary = registry.getHealthSummary();
Custom Health Indicators
// Using lambda
registry.register(HealthIndicator.of("database", () -> {
return database.isConnected()
? HealthCheckResult.up()
: HealthCheckResult.down("Not connected");
}));
// Using class
public class MyHealthIndicator implements HealthIndicator {
@Override
public String getName() {
return "my-component";
}
@Override
public HealthCheckResult check() {
if (isHealthy()) {
return HealthCheckResult.up()
.withDetail("connections", getConnectionCount());
}
return HealthCheckResult.down("Component failed");
}
}
- See Also:
-
ClassDescriptionHealth indicator for TnsAI agents.Result of a health check operation.Interface for components that can report their health status.Central registry for health indicators with aggregation support.Represents the health status of a component.Health indicator for LLM providers.Builder for LLMHealthIndicator.Health indicator for system resources.