apphealthsync

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package apphealthsync samples runtime-owned health for cloud's ephemeral cache.

Index

Constants

View Source
const (
	Version1 uint = 1

	TypeSamples = "app.health.samples"
	TypeDemand  = "app.health.demand"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BackgroundSeconds int `json:"background_seconds"`
}

Config supplies the quiet-cluster cadence when the session opens.

type Demand

type Demand struct {
	SessionID       string `json:"session_id"`
	IntervalSeconds int    `json:"interval_seconds"`
	LeaseSeconds    int    `json:"lease_seconds"`
}

Demand temporarily accelerates sampling for a viewed cluster. SessionID prevents a queued request from activating a replacement connection.

type Link interface {
	OfferCapability(uplink.CapabilityOffer)
	OnSession(func(context.Context, uplink.Session))
	Handle(string, uplink.MessageHandler)
	SendMessageBlocking(context.Context, string, any) error
}

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

func NewReporter

func NewReporter(log *slog.Logger, source Source) *Reporter

func (*Reporter) Register

func (r *Reporter) Register(_ context.Context, link Link) error

type Sample

type Sample struct {
	Name string `json:"name"`

	// Health is one of the apphealth values. It is computed by the same code
	// that answers `miren app list`, so the CLI and the console cannot
	// disagree about whether an app is fine.
	Health string `json:"health"`

	ReadyInstances   int32 `json:"ready_instances"`
	DesiredInstances int32 `json:"desired_instances"`
}

Sample is one app's health as the runtime classifies it.

There is no cluster or organization field. Cloud derives both from the authenticated identity on the socket: a cluster is never trusted to say which tenant its data belongs to, only what its own apps are doing.

type SampleBatch

type SampleBatch struct {
	ObservedAt time.Time `json:"observed_at"`
	Apps       []Sample  `json:"apps"`
}

SampleBatch is one message's worth of samples.

They share one ObservedAt because they come from a single derivation of the cluster's state. Cloud applies last-writer-wins with it, so a message delayed behind a fresher one cannot reinstate health that was already corrected.

type Source

type Source interface {
	ListAppHealth(context.Context) ([]apphealth.State, error)
}

Source shares the classifier used by the app list.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL