handlers

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAlertsQueryRequest added in v1.0.0

func ValidateAlertsQueryRequest(req *gen.AlertsQueryRequest) error

ValidateAlertsQueryRequest validates an alerts query request.

func ValidateAndSetLimit

func ValidateAndSetLimit(limit *int) error

ValidateAndSetLimit validates and sets default for limit

func ValidateAndSetSortOrder

func ValidateAndSetSortOrder(sortOrder *string) error

ValidateAndSetSortOrder validates and sets default for sort order

func ValidateIncidentPutRequest added in v1.0.0

func ValidateIncidentPutRequest(req *gen.IncidentPutRequest) error

ValidateIncidentPutRequest validates an incident update (PUT) request.

func ValidateIncidentsQueryRequest added in v1.0.0

func ValidateIncidentsQueryRequest(req *gen.IncidentsQueryRequest) error

ValidateIncidentsQueryRequest validates an incidents query request.

func ValidateLogLevels

func ValidateLogLevels(logLevels []string) error

ValidateLogLevels validates the log levels array

func ValidateLogsQueryRequest

func ValidateLogsQueryRequest(req *types.LogsQueryRequest) error

ValidateLogsQueryRequest validates the LogsQueryRequest

func ValidateMetricsQueryRequest

func ValidateMetricsQueryRequest(req *types.MetricsQueryRequest) error

ValidateMetricsQueryRequest validates the MetricsQueryRequest

func ValidateRuntimeTopologyRequest added in v1.1.0

func ValidateRuntimeTopologyRequest(req *types.RuntimeTopologyRequest) error

ValidateRuntimeTopologyRequest validates the request body for POST /api/v1alpha1/metrics/runtime-topology. Runtime topology requires the project + environment to be specified explicitly; namespace alone is not enough to scope a cell diagram.

func ValidateTimeRange

func ValidateTimeRange(startTime, endTime string) error

ValidateTimeRange validates start and end time strings

func ValidateTracesQueryRequest

func ValidateTracesQueryRequest(req *gen.TracesQueryRequest) error

ValidateTracesQueryRequest validates a traces query request

Types

type Handler

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

Handler contains the HTTP handlers for the public observer API (v1/v1alpha1). Routes are JWT-protected. Authorization is enforced by the service layer — pass authz-wrapped services (e.g. NewAlertIncidentServiceWithAuthz) rather than bare service instances.

func NewHandler

func NewHandler(
	healthService service.HealthChecker,
	logsService service.LogsQuerier,
	metricsService service.MetricsQuerier,
	alertIncidentService service.AlertIncidentService,
	tracesService service.TracesQuerier,
	logger *slog.Logger,
) *Handler

NewHandler creates a new public Handler instance.

func (*Handler) GetSpanDetailsForTrace

func (h *Handler) GetSpanDetailsForTrace(w http.ResponseWriter, r *http.Request)

GetSpanDetailsForTrace handles GET /api/v1alpha1/traces/{traceId}/spans/{spanId}

func (*Handler) Health

func (h *Handler) Health(w http.ResponseWriter, r *http.Request)

Health handles GET /health

func (*Handler) QueryAlerts added in v1.0.0

func (h *Handler) QueryAlerts(w http.ResponseWriter, r *http.Request)

QueryAlerts handles POST /api/v1alpha1/alerts/query

func (*Handler) QueryIncidents added in v1.0.0

func (h *Handler) QueryIncidents(w http.ResponseWriter, r *http.Request)

QueryIncidents handles POST /api/v1alpha1/incidents/query

func (*Handler) QueryLogs

func (h *Handler) QueryLogs(w http.ResponseWriter, r *http.Request)

QueryLogs handles POST /api/v1/logs/query

func (*Handler) QueryMetrics

func (h *Handler) QueryMetrics(w http.ResponseWriter, r *http.Request)

QueryMetrics handles POST /api/v1/metrics/query

func (*Handler) QueryRuntimeTopology added in v1.1.0

func (h *Handler) QueryRuntimeTopology(w http.ResponseWriter, r *http.Request)

QueryRuntimeTopology handles POST /api/v1alpha1/metrics/runtime-topology.

func (*Handler) QuerySpansForTrace

func (h *Handler) QuerySpansForTrace(w http.ResponseWriter, r *http.Request)

QuerySpansForTrace handles POST /api/v1alpha1/traces/{traceId}/spans/query

func (*Handler) QueryTraces

func (h *Handler) QueryTraces(w http.ResponseWriter, r *http.Request)

QueryTraces handles POST /api/v1alpha1/traces/query

func (*Handler) UpdateIncident added in v1.0.0

func (h *Handler) UpdateIncident(w http.ResponseWriter, r *http.Request)

UpdateIncident handles PUT /api/v1alpha1/incidents/{incidentId} Note: the incident ID is read from the path via r.PathValue to be compatible with http.ServeMux routing.

type InternalHandler added in v1.0.0

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

InternalHandler contains the HTTP handlers that run on the internal port (8081) without JWT authentication. It manages alert rules and processes incoming webhooks.

func NewInternalHandler added in v1.0.0

func NewInternalHandler(
	alertService service.AlertRuleService,
	logger *slog.Logger,
) *InternalHandler

NewInternalHandler creates a new InternalHandler instance.

func (*InternalHandler) CreateAlertRule added in v1.0.0

func (h *InternalHandler) CreateAlertRule(w http.ResponseWriter, r *http.Request)

CreateAlertRule handles POST /api/v1alpha1/alerts/sources/{sourceType}/rules

func (*InternalHandler) DeleteAlertRule added in v1.0.0

func (h *InternalHandler) DeleteAlertRule(w http.ResponseWriter, r *http.Request)

DeleteAlertRule handles DELETE /api/v1alpha1/alerts/sources/{sourceType}/rules/{ruleName}

func (*InternalHandler) GetAlertRule added in v1.0.0

func (h *InternalHandler) GetAlertRule(w http.ResponseWriter, r *http.Request)

GetAlertRule handles GET /api/v1alpha1/alerts/sources/{sourceType}/rules/{ruleName}

func (*InternalHandler) HandleAlertWebhook added in v1.0.0

func (h *InternalHandler) HandleAlertWebhook(w http.ResponseWriter, r *http.Request)

HandleAlertWebhook handles POST /api/v1alpha1/alerts/webhook

func (*InternalHandler) UpdateAlertRule added in v1.0.0

func (h *InternalHandler) UpdateAlertRule(w http.ResponseWriter, r *http.Request)

UpdateAlertRule handles PUT /api/v1alpha1/alerts/sources/{sourceType}/rules/{ruleName}

Jump to

Keyboard shortcuts

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