usecase

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAlertRepeatInterval 은 계속 발생 중인 경보를 다시 알리는 간격이다(Alertmanager 기본 repeat_interval 과 같다).
	DefaultAlertRepeatInterval = 4 * time.Hour
	// DefaultResolveGrace 는 이만큼 보이지 않아야 해제한다. Alertmanager 는 경보를 메모리에만 들고 있어
	// 재시작하면 Prometheus 가 다시 보낼 때까지(1분 안팎) 빈 목록을 준다 — 그것을 해제로 읽으면
	// "해제" 와 "발생" 이 한꺼번에 나간다.
	DefaultResolveGrace = 3 * time.Minute
)
View Source
const StackIDNone = "none"

StackIDNone 은 스택 없는 앱(직접 배포 · 스택이 지워진 앱)을 고르는 stack_id 값이다.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSecurityQuery added in v0.6.0

type AppSecurityQuery struct {
	OrgID       string
	ClusterID   string
	StackID     string
	Query       string
	ProblemOnly bool
}

AppSecurityQuery 는 앱 축 조회의 조건이다. ClusterID · StackID · Query 는 범위 필터, ProblemOnly 는 표만 줄인다 — 지표 · 적용률 · 묶음 머리는 범위 필터만 따른다(설계 §3).

type AppSecurityView added in v0.6.0

type AppSecurityView struct {
	GeneratedAt time.Time
	Truncated   bool
	Summary     domain.AppSecuritySummary
	Coverage    domain.StageCoverage
	Groups      []domain.AppSecurityGroup
	// Apps 는 위험순 그대로다. 화면은 받은 순서를 쓰고 묶기만 한다.
	Apps []domain.AppSecurityPosture
}

AppSecurityView 는 앱 축 화면 하나다.

type CollectResult added in v0.6.0

type CollectResult struct {
	// Skipped 는 다른 레플리카가 이번 주기를 돌고 있어 건너뛰었다는 뜻이다.
	Skipped     bool
	Stacks      int
	Unreachable int
	Fired       int
	Repeated    int
	Resolved    int
	Closed      int
}

CollectResult 는 한 번 돈 결과다(로그용).

type CollectStackAlerts added in v0.6.0

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

CollectStackAlerts 는 스택마다 Alertmanager 의 활성 경보를 가져와 기록하고, 심각한 것을 조직의 알림 채널로 보낸다(nullus-plan#87). 규칙은 스택 Prometheus 의 기본 규칙이다 — 플랫폼은 평가하지 않는다.

한 번 돌 때:

  1. 스택마다 활성 경보를 가져와 거른다(심각만, 잡음 제외).
  2. 새로 보이면 기록하고 발생 알림, 계속 보이면 repeat 이 지났을 때 다시 알림.
  3. 기록엔 열려 있는데 이번에 안 보이면 해제하고 해제 알림. **Alertmanager 에 닿지 못한 스택은 건너뛴다** — 모르는 것을 없는 것으로 읽으면 장애가 나는 순간 모든 경보가 해제됐다고 알린다.
  4. 목록에 없는 스택(지워졌거나 모니터링을 끈 스택)의 열린 경보는 알리지 않고 닫는다.

API 레플리카가 여럿이면 잠금(CycleLock)을 잡은 하나만 돈다. 그래도 알림 차례와 해제는 저장소가 원자적으로 가린다(잠금이 없거나 풀린 틈에도 한 번만 알린다).

발송은 수집이 끝난 뒤 한꺼번에(동시에), 수집 ctx 와 따로 보낸다 — 응답 없는 채널 하나가 수집 시간을 다 써서 다른 스택을 건너뛰거나, 차례를 잡은 알림이 수집 ctx 와 함께 취소되지 않게.

func NewCollectStackAlerts added in v0.6.0

func (*CollectStackAlerts) Run added in v0.6.0

func (*CollectStackAlerts) WithLock added in v0.6.0

WithLock 은 레플리카 하나만 돌게 하는 잠금을 배선한다.

type CreateAlertRule

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

func NewCreateAlertRule

func NewCreateAlertRule(alertRuleRepo port.AlertRuleRepository) *CreateAlertRule

func (*CreateAlertRule) Execute

type CreateAlertRuleInput

type CreateAlertRuleInput struct {
	Name              string
	MetricName        string
	WarningThreshold  float64
	CriticalThreshold float64
	Channel           domain.AlertChannel
	Enabled           bool
}

type CreateAlertRuleOutput

type CreateAlertRuleOutput struct {
	Rule *domain.AlertRule
}

type DeleteAlertRule

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

func NewDeleteAlertRule

func NewDeleteAlertRule(alertRuleRepo port.AlertRuleRepository) *DeleteAlertRule

func (*DeleteAlertRule) Execute

func (uc *DeleteAlertRule) Execute(ctx context.Context, input DeleteAlertRuleInput) error

type DeleteAlertRuleInput

type DeleteAlertRuleInput struct {
	ID string
}

type GetAlertRule

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

func NewGetAlertRule

func NewGetAlertRule(alertRuleRepo port.AlertRuleRepository) *GetAlertRule

func (*GetAlertRule) Execute

type GetAlertRuleInput

type GetAlertRuleInput struct {
	ID string
}

type GetAlertRuleOutput

type GetAlertRuleOutput struct {
	Rule *domain.AlertRule
}

type GetAppSecurity added in v0.6.0

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

GetAppSecurity 는 보안 대시보드의 앱 축(파이프라인 보안 게이트)이다.

func NewGetAppSecurity added in v0.6.0

func NewGetAppSecurity(apps port.AppSecuritySource, scope port.ScopeResolver) *GetAppSecurity

NewGetAppSecurity 는 유스케이스를 만든다.

func (*GetAppSecurity) Execute added in v0.6.0

Execute 는 조직의 앱을 범위로 거르고, 셀 · 위험 순위 · 지표 · 묶음을 계산한다.

type GetDashboard

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

GetDashboard retrieves the platform observability dashboard.

func NewGetDashboard

func NewGetDashboard(dashboardRepo port.DashboardRepository, opts ...GetDashboardOption) *GetDashboard

NewGetDashboard constructs a GetDashboard use case.

func (*GetDashboard) Execute

func (uc *GetDashboard) Execute(ctx context.Context, orgID string) (*GetDashboardOutput, error)

Execute returns the current dashboard data for the organization.

type GetDashboardOption

type GetDashboardOption func(*GetDashboard)

GetDashboardOption configures optional GetDashboard collaborators.

func WithToolHealth

func WithToolHealth(repo port.ToolHealthRepository) GetDashboardOption

WithToolHealth supplies live OSS health. Without it the dashboard reports whatever tool health the dashboard repository carries (the simulated fallback).

type GetDashboardOutput

type GetDashboardOutput struct {
	Dashboard *domain.Dashboard
}

GetDashboardOutput holds the result of the GetDashboard use case.

type GetStackSecurity added in v0.6.0

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

GetStackSecurity 는 보안 대시보드의 설치 OSS 축(스택 설치 이미지 보고)이다. admin · devops 만 부른다 — 지금 /stacks 를 쓸 수 없는 역할에 이 숫자를 보이지 않는다(설계 결정 11). 역할 검사는 라우트가 한다.

func NewGetStackSecurity added in v0.6.0

func NewGetStackSecurity(stacks port.StackSecuritySource, scope port.ScopeResolver) *GetStackSecurity

NewGetStackSecurity 는 유스케이스를 만든다.

func (*GetStackSecurity) Execute added in v0.6.0

Execute 는 조직의 스택을 범위로 거르고 등급 · 지표를 계산한다.

type ListAlertRules

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

func NewListAlertRules

func NewListAlertRules(alertRuleRepo port.AlertRuleRepository) *ListAlertRules

func (*ListAlertRules) Execute

type ListAlertRulesOutput

type ListAlertRulesOutput struct {
	Rules []*domain.AlertRule
}

type ListAlerts

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

func NewListAlerts

func NewListAlerts(alertRepo port.AlertRepository) *ListAlerts

func (*ListAlerts) Execute

func (uc *ListAlerts) Execute(ctx context.Context) (*ListAlertsOutput, error)

type ListAlertsOutput

type ListAlertsOutput struct {
	Alerts []*domain.Alert
}

type ListStackAlerts added in v0.6.0

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

ListStackAlerts 는 알림 이력 화면의 스택 경보 목록이다.

func NewListStackAlerts added in v0.6.0

func NewListStackAlerts(repo StackAlertLister) *ListStackAlerts

func (*ListStackAlerts) Execute added in v0.6.0

func (uc *ListStackAlerts) Execute(ctx context.Context, orgID string, openOnly bool, limit int) ([]*domain.StackAlert, error)

type StackAlertLister added in v0.6.0

type StackAlertLister interface {
	List(ctx context.Context, orgID string, openOnly bool, limit int) ([]*domain.StackAlert, error)
}

StackAlertLister 는 조직의 스택 경보 기록이다(port.StackAlertRepository 의 조회 부분).

type StackSecurityQuery added in v0.6.0

type StackSecurityQuery struct {
	OrgID     string
	ClusterID string
	StackID   string
}

StackSecurityQuery 는 설치 OSS 축 조회의 조건이다.

type StackSecurityView added in v0.6.0

type StackSecurityView struct {
	GeneratedAt time.Time
	Summary     domain.StackSecuritySummary
	Stacks      []domain.StackSecurityPosture
}

StackSecurityView 는 설치 OSS 축 화면 하나다.

type UpdateAlertRule

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

func NewUpdateAlertRule

func NewUpdateAlertRule(alertRuleRepo port.AlertRuleRepository) *UpdateAlertRule

func (*UpdateAlertRule) Execute

type UpdateAlertRuleInput

type UpdateAlertRuleInput struct {
	ID                string
	Name              *string
	MetricName        *string
	WarningThreshold  *float64
	CriticalThreshold *float64
	Channel           *domain.AlertChannel
	Enabled           *bool
}

type UpdateAlertRuleOutput

type UpdateAlertRuleOutput struct {
	Rule *domain.AlertRule
}

Jump to

Keyboard shortcuts

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