refactor(archied): gateway owns model work; daemon drops chat runtime, tools, memory and curators
The gateway now applies provider, model-role and tool settings live and runs the curators, which wake on its turns and read its conversations.
This commit is contained in:
7 files changed
+47
-150
No files matched your search
@@ -39,7 +39,6 @@ import (
|
|||||||
"github.com/samcharles93/archie-core/internal/domain/curator"
|
"github.com/samcharles93/archie-core/internal/domain/curator"
|
||||||
"github.com/samcharles93/archie-core/internal/domain/eda/module"
|
"github.com/samcharles93/archie-core/internal/domain/eda/module"
|
||||||
"github.com/samcharles93/archie-core/internal/domain/eda/playbook"
|
"github.com/samcharles93/archie-core/internal/domain/eda/playbook"
|
||||||
domainembedding "github.com/samcharles93/archie-core/internal/domain/embedding"
|
|
||||||
"github.com/samcharles93/archie-core/internal/domain/health"
|
"github.com/samcharles93/archie-core/internal/domain/health"
|
||||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||||
domainmemory "github.com/samcharles93/archie-core/internal/domain/memory"
|
domainmemory "github.com/samcharles93/archie-core/internal/domain/memory"
|
||||||
@@ -54,7 +53,6 @@ import (
|
|||||||
"github.com/samcharles93/archie-core/internal/gateway"
|
"github.com/samcharles93/archie-core/internal/gateway"
|
||||||
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
|
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
|
||||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||||
infraembedding "github.com/samcharles93/archie-core/internal/infrastructure/embedding"
|
|
||||||
"github.com/samcharles93/archie-core/internal/infrastructure/eventbus/nats"
|
"github.com/samcharles93/archie-core/internal/infrastructure/eventbus/nats"
|
||||||
infraMemory "github.com/samcharles93/archie-core/internal/infrastructure/memory"
|
infraMemory "github.com/samcharles93/archie-core/internal/infrastructure/memory"
|
||||||
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
|
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
|
||||||
@@ -240,13 +238,6 @@ type boot struct {
|
|||||||
// start, which read it as their resume points.
|
// start, which read it as their resume points.
|
||||||
runtimeVersions map[string]int64
|
runtimeVersions map[string]int64
|
||||||
|
|
||||||
// embeddings is nil unless models["embedding"] and a working provider
|
|
||||||
// credential are both configured -- see setupLLMAndChat's "Embeddings
|
|
||||||
// capability" section. Consumers must treat a nil embeddings the same
|
|
||||||
// as domainembedding.ErrUnavailable: skip, never fail startup or an
|
|
||||||
// unrelated call.
|
|
||||||
embeddings domainembedding.Client
|
|
||||||
|
|
||||||
// transcriber is the optional voice-transcription capability. It is built
|
// transcriber is the optional voice-transcription capability. It is built
|
||||||
// beside the chat runtime from this process's own [models]/[providers],
|
// beside the chat runtime from this process's own [models]/[providers],
|
||||||
// which is the model-owning side of the Messaging boundary: a channel
|
// which is the model-owning side of the Messaging boundary: a channel
|
||||||
@@ -699,15 +690,6 @@ func (b *boot) setupContainers(ctx context.Context) func() {
|
|||||||
return closeDocker
|
return closeDocker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boot) setupEmbeddings(cfg config.Config, log *slog.Logger) {
|
|
||||||
if client, ok := infraembedding.New(cfg, infraembedding.Options{}); ok {
|
|
||||||
b.embeddings = client
|
|
||||||
log.Info("embedding capability enabled", "role", infraembedding.Role)
|
|
||||||
} else if cfg.Models[infraembedding.Role] != "" {
|
|
||||||
log.Warn("embedding capability configured but unavailable; capability disabled", "role", infraembedding.Role)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *boot) setupTranscriber(cfg config.Config, log *slog.Logger) {
|
func (b *boot) setupTranscriber(cfg config.Config, log *slog.Logger) {
|
||||||
client, ok := transcription.New(cfg.Models, cfg.Providers, transcription.Options{
|
client, ok := transcription.New(cfg.Models, cfg.Providers, transcription.Options{
|
||||||
ResolveSecret: b.secrets.Resolve,
|
ResolveSecret: b.secrets.Resolve,
|
||||||
@@ -720,20 +702,16 @@ func (b *boot) setupTranscriber(cfg config.Config, log *slog.Logger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boot) setupLLMAndChat(ctx context.Context) error {
|
// setupGatewayClient dials the Gateway, which owns every model call. The daemon
|
||||||
cfg, log := b.cfg, b.log
|
// only enqueues the chat tasks scheduled workflows create.
|
||||||
|
func (b *boot) setupGatewayClient() error {
|
||||||
if err := b.setupChatRuntime(ctx, cfg); err != nil {
|
b.setupChatTasks(b.cfg)
|
||||||
return err
|
contract, cleanup, err := composeChatContract(b.cfg.Services, b.secrets)
|
||||||
}
|
|
||||||
|
|
||||||
b.setupEmbeddings(cfg, log)
|
|
||||||
contract, cleanup, err := composeChatContract(cfg.Services, b.secrets)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b.addCleanup(cleanup)
|
b.addCleanup(cleanup)
|
||||||
b.chat = &webui.ChatService{Contract: contract, Updates: b.updateService}
|
b.chat = &webui.ChatService{Contract: contract}
|
||||||
b.setupReadinessProbes()
|
b.setupReadinessProbes()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -1319,7 +1297,10 @@ func (b *boot) setupForgeWebhook() {
|
|||||||
|
|
||||||
func (b *boot) publishConfig(ctx context.Context, cfg config.Config) {
|
func (b *boot) publishConfig(ctx context.Context, cfg config.Config) {
|
||||||
b.cfgHolder.Set(cfg)
|
b.cfgHolder.Set(cfg)
|
||||||
b.publishConfigSnapshot(ctx)
|
// The daemon owns the published configuration view.
|
||||||
|
if b.processName != applystatus.Gateway {
|
||||||
|
b.publishConfigSnapshot(ctx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boot) configOrigins() []webui.ConfigOrigin {
|
func (b *boot) configOrigins() []webui.ConfigOrigin {
|
||||||
@@ -1386,8 +1367,6 @@ func (b *boot) wireConfigPublishing(ctx context.Context, cfgPath, overlayPath st
|
|||||||
signal.Notify(reloadCh, syscall.SIGHUP)
|
signal.Notify(reloadCh, syscall.SIGHUP)
|
||||||
b.addCleanup(func() { signal.Stop(reloadCh) })
|
b.addCleanup(func() { signal.Stop(reloadCh) })
|
||||||
go reloadLoop(ctx, reloadCh, reloadController, log)
|
go reloadLoop(ctx, reloadCh, reloadController, log)
|
||||||
|
|
||||||
b.chatController.WithRuntime(b.d)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:contextcheck // shutdown runs after the parent context is cancelled
|
//nolint:contextcheck // shutdown runs after the parent context is cancelled
|
||||||
@@ -1409,18 +1388,11 @@ func (b *boot) startServices(ctx context.Context) error {
|
|||||||
log.Error("capability host startup", "err", err)
|
log.Error("capability host startup", "err", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, skipped := range b.providerRegistry.Skipped() {
|
|
||||||
log.Error("tool provider unavailable; archie is running without its tools",
|
|
||||||
"provider", skipped.ID, "err", skipped.Err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := b.d.Startup(ctx); err != nil {
|
if err := b.d.Startup(ctx); err != nil {
|
||||||
log.Error("startup", "err", err)
|
log.Error("startup", "err", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := b.curatorRuntime.Start(ctx); err != nil {
|
|
||||||
log.Error("curator runtime startup", "err", err)
|
|
||||||
}
|
|
||||||
if b.schedulingEngine != nil {
|
if b.schedulingEngine != nil {
|
||||||
if err := b.schedulingEngine.Start(ctx); err != nil {
|
if err := b.schedulingEngine.Start(ctx); err != nil {
|
||||||
log.Error("scheduling engine startup", "err", err)
|
log.Error("scheduling engine startup", "err", err)
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ func (b *boot) startLiveSettings(ctx context.Context) error {
|
|||||||
if err := b.startWorkflowExecutionSettings(ctx); err != nil {
|
if err := b.startWorkflowExecutionSettings(ctx); err != nil {
|
||||||
return fmt.Errorf("workflow execution settings: %w", err)
|
return fmt.Errorf("workflow execution settings: %w", err)
|
||||||
}
|
}
|
||||||
if err := b.startRuntimeResourceWatches(ctx, b.runtimeVersions); err != nil {
|
if err := b.startRuntimeResourceWatches(ctx, b.runtimeVersions, runtimeResourceKinds); err != nil {
|
||||||
return fmt.Errorf("runtime resource watches: %w", err)
|
return fmt.Errorf("runtime resource watches: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -292,14 +292,22 @@ var runtimeResourceKinds = []string{
|
|||||||
controlplane.ContainerRuntimePoliciesKind,
|
controlplane.ContainerRuntimePoliciesKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gatewayRuntimeKinds are the kinds the Gateway applies live: the settings its
|
||||||
|
// chat runtime and tool providers are built from.
|
||||||
|
var gatewayRuntimeKinds = []string{
|
||||||
|
controlplane.ProviderSettingsKind,
|
||||||
|
controlplane.ModelRoleAssignmentsKind,
|
||||||
|
controlplane.ToolSettingsKind,
|
||||||
|
}
|
||||||
|
|
||||||
// startRuntimeResourceWatches keeps a watch per live kind established for the
|
// startRuntimeResourceWatches keeps a watch per live kind established for the
|
||||||
// life of the process. versions carries the resume point each kind starts
|
// life of the process. versions carries the resume point each kind starts
|
||||||
// from, the versions boot's layering recorded. The first stream per kind is
|
// from, the versions boot's layering recorded. The first stream per kind is
|
||||||
// opened synchronously, so a control plane that cannot be watched at all
|
// opened synchronously, so a control plane that cannot be watched at all
|
||||||
// fails the boot that asked for it; after that the watch does not return, it
|
// fails the boot that asked for it; after that the watch does not return, it
|
||||||
// reconnects (see keepWatch, whose backoff rules these watches ride).
|
// reconnects (see keepWatch, whose backoff rules these watches ride).
|
||||||
func (b *boot) startRuntimeResourceWatches(ctx context.Context, versions map[string]int64) error {
|
func (b *boot) startRuntimeResourceWatches(ctx context.Context, versions map[string]int64, kinds []string) error {
|
||||||
for _, kind := range runtimeResourceKinds {
|
for _, kind := range kinds {
|
||||||
updates, err := b.controlPlane.WatchResource(ctx, kind, versions[kind])
|
updates, err := b.controlPlane.WatchResource(ctx, kind, versions[kind])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("watch %s: %w", kind, err)
|
return fmt.Errorf("watch %s: %w", kind, err)
|
||||||
|
|||||||
@@ -187,6 +187,15 @@ func (b *boot) startGatewayRuntime(ctx context.Context, actor gateway.ChatTaskAc
|
|||||||
for _, skipped := range b.providerRegistry.Skipped() {
|
for _, skipped := range b.providerRegistry.Skipped() {
|
||||||
b.log.Warn("gateway tool provider unavailable", "provider", skipped.ID, "err", skipped.Err)
|
b.log.Warn("gateway tool provider unavailable", "provider", skipped.ID, "err", skipped.Err)
|
||||||
}
|
}
|
||||||
|
if err := b.startRuntimeResourceWatches(ctx, b.runtimeVersions, gatewayRuntimeKinds); err != nil {
|
||||||
|
return nil, fmt.Errorf("runtime resource watches: %w", err)
|
||||||
|
}
|
||||||
|
b.startModelCatalogRefresh(ctx)
|
||||||
|
// Curators wake on this process's turns and read its conversations.
|
||||||
|
b.setupCurators(ctx)
|
||||||
|
if err := b.curatorRuntime.Start(ctx); err != nil {
|
||||||
|
b.log.Error("curator runtime startup", "err", err)
|
||||||
|
}
|
||||||
return contract, nil
|
return contract, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,16 +56,7 @@ func (b *boot) setupChatRuntime(ctx context.Context, cfg config.Config) error {
|
|||||||
b.providerOutcomes = newProviderOutcomeRecorder()
|
b.providerOutcomes = newProviderOutcomeRecorder()
|
||||||
b.statusHealth = newStatusHealth(b)
|
b.statusHealth = newStatusHealth(b)
|
||||||
|
|
||||||
profiles, defaultChatIdentity := chatTaskProfiles(cfg)
|
b.setupChatTasks(cfg)
|
||||||
var chatTasks gateway.TaskCreator
|
|
||||||
if len(profiles) > 0 {
|
|
||||||
chatTasks = gateway.NewStoreTaskCreatorForProfiles(
|
|
||||||
chatTaskWriterAdapter{enqueue: b.stateStore.EnqueueChatTask},
|
|
||||||
profiles,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
b.chatTasks = chatTasks
|
|
||||||
b.defaultChatIdentity = defaultChatIdentity
|
|
||||||
var canceller storecontract.ExecutionCanceller
|
var canceller storecontract.ExecutionCanceller
|
||||||
if ec, ok := b.stateStore.(storecontract.ExecutionCanceller); ok {
|
if ec, ok := b.stateStore.(storecontract.ExecutionCanceller); ok {
|
||||||
canceller = ec
|
canceller = ec
|
||||||
@@ -89,6 +80,19 @@ func (b *boot) setupChatRuntime(ctx context.Context, cfg config.Config) error {
|
|||||||
// cannot be watched at all fails the boot that asked for it rather than
|
// cannot be watched at all fails the boot that asked for it rather than
|
||||||
// leaving the process running personas it can no longer update; after that the
|
// leaving the process running personas it can no longer update; after that the
|
||||||
// watch reconnects instead of ending (see keepWatch).
|
// watch reconnects instead of ending (see keepWatch).
|
||||||
|
// setupChatTasks wires the task creator chat commands and scheduled workflows
|
||||||
|
// enqueue through.
|
||||||
|
func (b *boot) setupChatTasks(cfg config.Config) {
|
||||||
|
profiles, defaultChatIdentity := chatTaskProfiles(cfg)
|
||||||
|
if len(profiles) > 0 {
|
||||||
|
b.chatTasks = gateway.NewStoreTaskCreatorForProfiles(
|
||||||
|
chatTaskWriterAdapter{enqueue: b.stateStore.EnqueueChatTask},
|
||||||
|
profiles,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
b.defaultChatIdentity = defaultChatIdentity
|
||||||
|
}
|
||||||
|
|
||||||
func (b *boot) watchPersonas(ctx context.Context, version int64) error {
|
func (b *boot) watchPersonas(ctx context.Context, version int64) error {
|
||||||
updates, err := b.controlPlane.WatchPersonas(ctx, version)
|
updates, err := b.controlPlane.WatchPersonas(ctx, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -384,24 +384,15 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := b.setupLLMAndChat(ctx); err != nil {
|
if err := b.setupGatewayClient(); err != nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// The catalog's consumers exist from here on, and the daemon is the
|
// The daemon publishes the configuration view, which carries the catalog's
|
||||||
// process that owns the published configuration, so this is where the
|
// model limits.
|
||||||
// live catalog refresh belongs. The standalone Gateway reads the catalog
|
|
||||||
// once at boot and runs no control-plane watches (RunGateway).
|
|
||||||
b.startModelCatalogRefresh(ctx)
|
b.startModelCatalogRefresh(ctx)
|
||||||
if err := b.buildTreesAndIdentities(ctx); err != nil {
|
if err := b.buildTreesAndIdentities(ctx); err != nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// setupMemoryEngine must run before setupCurators: curator.Registrar
|
|
||||||
// captures b.memEngines at construction time, so built the other way
|
|
||||||
// round every curator would hold a nil engine source.
|
|
||||||
if err := b.setupMemoryEngine(); err != nil {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := b.loadWorkflows(); err != nil {
|
if err := b.loadWorkflows(); err != nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -415,16 +406,10 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
|||||||
if err := b.registerNATSRPC(); err != nil {
|
if err := b.registerNATSRPC(); err != nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
b.setupCurators(ctx)
|
|
||||||
|
|
||||||
if err := b.setupScheduling(); err != nil {
|
if err := b.setupScheduling(); err != nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := b.registerTools(); err != nil {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
b.registerStandaloneTools()
|
|
||||||
b.buildDaemon()
|
b.buildDaemon()
|
||||||
b.wireConfigSurfaces(ctx, args.cfgPath, args.overlayPath)
|
b.wireConfigSurfaces(ctx, args.cfgPath, args.overlayPath)
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ package archied
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/samcharles93/archie-core/internal/config"
|
"github.com/samcharles93/archie-core/internal/config"
|
||||||
@@ -34,7 +31,6 @@ func (b *boot) setupReadinessProbes() {
|
|||||||
readiness.NewStoreProbe(b.stateStore),
|
readiness.NewStoreProbe(b.stateStore),
|
||||||
readiness.NewConfigProbe(b.cfgHolder.Get, configuration.Validate),
|
readiness.NewConfigProbe(b.cfgHolder.Get, configuration.Validate),
|
||||||
readiness.NewDiskProbeTargets(diskProbeTargets(cfg)),
|
readiness.NewDiskProbeTargets(diskProbeTargets(cfg)),
|
||||||
readiness.NewModelProbe(b.chatModels.ActiveModel, b.chatModels.Models, modelReachProbe(cfg, b.chatModels.ActiveModel)),
|
|
||||||
// The daemon no longer runs a chat channel, so it cannot observe one's
|
// The daemon no longer runs a chat channel, so it cannot observe one's
|
||||||
// lifecycle; channel health is the Messaging Service's own probe. What
|
// lifecycle; channel health is the Messaging Service's own probe. What
|
||||||
// this process depends on is the Gateway answering, so that is what it
|
// this process depends on is the Gateway answering, so that is what it
|
||||||
@@ -86,39 +82,3 @@ func diskProbePath(cfg config.Config) string {
|
|||||||
return "."
|
return "."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// modelReachProbe returns a live reachability check for the active model. It
|
|
||||||
// resolves the active model's provider and, when the provider has a custom
|
|
||||||
// base URL, performs a short-timeout HTTP request to it: any response
|
|
||||||
// (including 401/404) proves the endpoint is reachable, while a network error
|
|
||||||
// or an unconfigured provider reports unreachable. A provider using its SDK
|
|
||||||
// default endpoint is assumed reachable, because no custom endpoint exists to
|
|
||||||
// probe.
|
|
||||||
func modelReachProbe(cfg config.Config, active func() string) func(context.Context) error {
|
|
||||||
return func(ctx context.Context) error {
|
|
||||||
model := active()
|
|
||||||
provider, _, _ := strings.Cut(model, "/")
|
|
||||||
if provider == "" {
|
|
||||||
return fmt.Errorf("active model %q has no provider", model)
|
|
||||||
}
|
|
||||||
p, ok := cfg.Providers[provider]
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("provider %q not configured", provider)
|
|
||||||
}
|
|
||||||
if p.BaseURL == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
reqCtx, cancel := context.WithTimeout(ctx, 3*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
req, err := http.NewRequestWithContext(reqCtx, http.MethodGet, p.BaseURL, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_ = resp.Body.Close()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -275,47 +275,6 @@ func (p *DiskProbe) Check(ctx context.Context) health.Result {
|
|||||||
|
|
||||||
// --- model ---
|
// --- model ---
|
||||||
|
|
||||||
// ModelProbe reports whether a model is configured (an active model is
|
|
||||||
// selected) and reachable (a live network check succeeds). Reachability is a
|
|
||||||
// narrow function so the probe is deterministic in tests and the composition
|
|
||||||
// root supplies the real provider probe.
|
|
||||||
type ModelProbe struct {
|
|
||||||
ActiveModel func() string
|
|
||||||
Models func() []string
|
|
||||||
Reach func(context.Context) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewModelProbe returns a model probe. The reachability probe is optional:
|
|
||||||
// nil means the probe only verifies configuration, not the network.
|
|
||||||
func NewModelProbe(active func() string, models func() []string, reach func(context.Context) error) *ModelProbe {
|
|
||||||
return &ModelProbe{ActiveModel: active, Models: models, Reach: reach}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *ModelProbe) Name() string { return "model" }
|
|
||||||
|
|
||||||
func (p *ModelProbe) Check(ctx context.Context) health.Result {
|
|
||||||
active := ""
|
|
||||||
if p.ActiveModel != nil {
|
|
||||||
active = p.ActiveModel()
|
|
||||||
}
|
|
||||||
models := 0
|
|
||||||
if p.Models != nil {
|
|
||||||
models = len(p.Models())
|
|
||||||
}
|
|
||||||
if active == "" && models == 0 {
|
|
||||||
return health.Result{Status: health.StatusDegraded, Detail: "no model configured"}
|
|
||||||
}
|
|
||||||
if p.Reach == nil {
|
|
||||||
return health.Result{Status: health.StatusOK, Detail: "model " + active + " configured"}
|
|
||||||
}
|
|
||||||
if err := p.Reach(ctx); err != nil {
|
|
||||||
return health.Result{Status: health.StatusDegraded, Detail: "model unreachable: " + err.Error()}
|
|
||||||
}
|
|
||||||
return health.Result{Status: health.StatusOK, Detail: "model " + active + " reachable"}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- gateway ---
|
|
||||||
|
|
||||||
// ChannelState is a per-channel lifecycle fact as the gateway probe sees it.
|
// ChannelState is a per-channel lifecycle fact as the gateway probe sees it.
|
||||||
// It is a projection of the channels.Manager's Status, kept in this package
|
// It is a projection of the channels.Manager's Status, kept in this package
|
||||||
// so the probe does not depend on the channels package's concrete type.
|
// so the probe does not depend on the channels package's concrete type.
|
||||||
|
|||||||
Reference in new issue
Block a user