api

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const HealthCheckPath = "/healthz"
View Source
const ReadinessCheckPath = "/readyz"

Variables

This section is empty.

Functions

func APIKeyAuthMiddleware added in v1.1.0

func APIKeyAuthMiddleware(config types.JobConfiguration) echo.MiddlewareFunc

APIKeyAuthMiddleware returns an Echo middleware that checks for the API key in the request headers.

func HealthMetricsMiddleware added in v1.3.3

func HealthMetricsMiddleware(healthMetrics *HealthMetrics) echo.MiddlewareFunc

HealthMetricsMiddleware tracks success and error rates for readiness probe

func Healthz added in v1.3.3

func Healthz() func(c echo.Context) error

Healthz is the liveness probe endpoint

func Readyz added in v1.3.3

func Readyz(jobServer *jobserver.JobServer, healthMetrics *HealthMetrics) func(c echo.Context) error

Readyz is the readiness probe endpoint

func Start

func Start(ctx context.Context, listenAddress, dataDIR string, standalone bool, config types.JobConfiguration) error

Types

type HealthMetrics added in v1.3.3

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

HealthMetrics tracks health-related metrics for the service

func NewHealthMetrics added in v1.3.3

func NewHealthMetrics() *HealthMetrics

NewHealthMetrics creates a new health metrics tracker

func (*HealthMetrics) GetStats added in v1.3.3

func (hm *HealthMetrics) GetStats() map[string]interface{}

GetStats returns current health statistics

func (*HealthMetrics) IsHealthy added in v1.3.3

func (hm *HealthMetrics) IsHealthy() bool

IsHealthy checks if the service is healthy based on error rate

func (*HealthMetrics) RecordError added in v1.3.3

func (hm *HealthMetrics) RecordError()

RecordError records an error

func (*HealthMetrics) RecordSuccess added in v1.3.3

func (hm *HealthMetrics) RecordSuccess()

RecordSuccess records a successful request

type HealthzResponse added in v1.3.3

type HealthzResponse struct {
	Status  string `json:"status"`
	Service string `json:"service"`
}

HealthzResponse represents the liveness probe response

type ReadinessChecks added in v1.3.3

type ReadinessChecks struct {
	JobServer string                 `json:"job_server"`
	ErrorRate string                 `json:"error_rate"`
	Stats     map[string]interface{} `json:"stats,omitempty"`
}

ReadinessChecks contains individual readiness check results

type ReadyzResponse added in v1.3.3

type ReadyzResponse struct {
	Service string          `json:"service"`
	Ready   bool            `json:"ready"`
	Checks  ReadinessChecks `json:"checks"`
}

ReadyzResponse represents the readiness probe response

Jump to

Keyboard shortcuts

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