server

package
v0.0.0-...-d1c08c1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server holds all dependencies for HTTP handlers

func NewServer

func NewServer(
	amClient *alertmanager.Client,
	grafanaClient *grafana.Client,
	exporter *metrics.Exporter,
	reconciler *sync.Reconciler,
) *Server

NewServer creates a new server with all dependencies

func (*Server) HealthzHandler

func (s *Server) HealthzHandler(w http.ResponseWriter, r *http.Request)

HealthzHandler provides a Kubernetes-style liveness probe endpoint Returns 200 OK if the service is running and ready to accept traffic

func (*Server) MetricsHandler

func (s *Server) MetricsHandler(w http.ResponseWriter, r *http.Request)

MetricsHandler serves Prometheus metrics for reconciliation

func (*Server) ReadyzHandler

func (s *Server) ReadyzHandler(w http.ResponseWriter, r *http.Request)

ReadyzHandler provides a Kubernetes-style readiness probe endpoint Returns 200 OK if the service is ready to accept traffic

type WebhookEvent

type WebhookEvent struct {
	Event struct {
		Type  string `json:"type"`
		Time  string `json:"time"`
		Until string `json:"until"`
	} `json:"event"`
	User struct {
		ID       string `json:"id"`
		Username string `json:"username"`
		Email    string `json:"email"`
	} `json:"user"`
	AlertGroup struct {
		ID             string                 `json:"id"`
		IntegrationID  string                 `json:"integration_id"`
		TeamID         string                 `json:"team_id"`
		RouteID        string                 `json:"route_id"`
		AlertsCount    int                    `json:"alerts_count"`
		State          string                 `json:"state"`
		CreatedAt      string                 `json:"created_at"`
		ResolvedAt     *string                `json:"resolved_at"`
		ResolvedBy     *string                `json:"resolved_by"`
		AcknowledgedAt *string                `json:"acknowledged_at"`
		AcknowledgedBy *string                `json:"acknowledged_by"`
		Labels         map[string]interface{} `json:"labels"`
		Title          string                 `json:"title"`
		Permalinks     struct {
			Slack    *string `json:"slack"`
			SlackApp *string `json:"slack_app"`
			Telegram *string `json:"telegram"`
			Web      string  `json:"web"`
		} `json:"permalinks"`
		SilencedAt string `json:"silenced_at"`
		LastAlert  struct {
			ID           string `json:"id"`
			AlertGroupID string `json:"alert_group_id"`
			CreatedAt    string `json:"created_at"`
			Payload      struct {
				Alerts []struct {
					EndsAt       string            `json:"endsAt"`
					Labels       map[string]string `json:"labels"`
					Status       string            `json:"status"`
					StartsAt     string            `json:"startsAt"`
					Annotations  map[string]string `json:"annotations"`
					Fingerprint  string            `json:"fingerprint"`
					GeneratorURL string            `json:"generatorURL"`
				} `json:"alerts"`
				Status            string            `json:"status"`
				Version           string            `json:"version"`
				GroupKey          string            `json:"groupKey"`
				Receiver          string            `json:"receiver"`
				NumFiring         int               `json:"numFiring"`
				ExternalURL       string            `json:"externalURL"`
				GroupLabels       map[string]string `json:"groupLabels"`
				NumResolved       int               `json:"numResolved"`
				CommonLabels      map[string]string `json:"commonLabels"`
				TruncatedAlerts   int               `json:"truncatedAlerts"`
				CommonAnnotations map[string]string `json:"commonAnnotations"`
			} `json:"payload"`
		} `json:"last_alert"`
		ResolutionNotes []struct {
			ID        string `json:"id"`
			Author    string `json:"author"`
			CreatedAt string `json:"created_at"`
			Text      string `json:"text"`
		} `json:"resolution_notes"`
	} `json:"alert_group"`
	AlertGroupID string `json:"alert_group_id"`
}

WebhookEvent represents the incoming webhook payload from Grafana IRM

type WebhookHandler

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

WebhookHandler handles incoming webhook requests from Grafana IRM

func NewWebhookHandler

func NewWebhookHandler(amClient *alertmanager.Client, grafanaClient *grafana.Client) *WebhookHandler

NewWebhookHandler creates a new webhook handler

func (*WebhookHandler) HandleWebhook

func (h *WebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook processes incoming webhook events

func (*WebhookHandler) RegisterRoutes

func (h *WebhookHandler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers the webhook routes

Jump to

Keyboard shortcuts

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