Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoveryService ¶
type DiscoveryService interface {
// ListServices returns the names of all registered services.
ListServices(ctx context.Context) ([]string, error)
// DiscoverWithTags discovers service instances matching name + tags.
DiscoverWithTags(ctx context.Context, serviceName string, tags []string) ([]*ServiceInstance, error)
}
DiscoveryService is the interface the dashboard needs from a discovery service. This decouples the dashboard from the discovery extension's separate Go module, allowing the integration to work with any discovery provider that satisfies this contract. The forge extensions/discovery.Service type satisfies this interface.
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
Integration watches a discovery service for services tagged as dashboard contributors and automatically registers/unregisters them.
func NewIntegration ¶
func NewIntegration( discovery DiscoveryService, registry *contributor.ContributorRegistry, tag string, pollInterval time.Duration, proxyTimeout time.Duration, logger forge.Logger, ) *Integration
NewIntegration creates a new discovery integration.
func (*Integration) IgnoreLocalService ¶ added in v1.6.2
func (i *Integration) IgnoreLocalService(serviceID string)
IgnoreLocalService instructs the integration to skip a service ID when scanning discovery. This is used to filter the host's own self-registration out of dashboard contributor candidates. Must be called before Start.
func (*Integration) Start ¶
func (i *Integration) Start(ctx context.Context)
Start begins polling the discovery service for dashboard contributors.
func (*Integration) Stop ¶
func (i *Integration) Stop()
Stop stops the discovery integration. Safe to call multiple times — the dashboard extension's Stop() can fire more than once (forge calls Stop on the extension and the DI container Stop walks the same instance again).
func (*Integration) TrackedCount ¶
func (i *Integration) TrackedCount() int
TrackedCount returns the number of tracked remote contributors.
type LocalServiceIDProvider ¶ added in v1.6.2
type LocalServiceIDProvider interface {
LocalServiceID() string
}
LocalServiceIDProvider is the optional interface a discovery service implements when it can report the host process's own service ID. Used so memory-backed discovery doesn't make the dashboard try to fetch a contributor manifest from itself.
type ServiceInstance ¶
type ServiceInstance struct {
ID string
Name string
Address string
Port int
Tags []string
Metadata map[string]string
Status string // "passing", "warning", "critical", "unknown"
}
ServiceInstance mirrors the minimal fields the dashboard needs from a discovered service. This matches discovery/backends.ServiceInstance without importing the external module.
func (*ServiceInstance) GetMetadata ¶
func (si *ServiceInstance) GetMetadata(key string) (string, bool)
GetMetadata retrieves metadata by key.
func (*ServiceInstance) IsHealthy ¶
func (si *ServiceInstance) IsHealthy() bool
IsHealthy returns true if the service status is "passing".
func (*ServiceInstance) URL ¶
func (si *ServiceInstance) URL(scheme string) string
URL returns the full URL for the service instance.