Documentation
¶
Index ¶
- Constants
- Variables
- type Alert
- type AlertIncident
- type AlertUser
- type AlertsResult
- type Cache
- type CacheKeyBuilder
- type Client
- func (c *Client) ClearCache()
- func (c *Client) Close() error
- func (c *Client) GetAlert(ctx context.Context, id string, updatedAt time.Time) (*Alert, error)
- func (c *Client) GetIncident(ctx context.Context, id string, updatedAt time.Time) (*Incident, error)
- func (c *Client) ListAlerts(ctx context.Context, page int) (*AlertsResult, error)
- func (c *Client) ListIncidents(ctx context.Context, page int, sort string) (*IncidentsResult, error)
- func (c *Client) ValidateAPIKey(ctx context.Context) error
- type Incident
- func (i *Incident) Duration() int64
- func (i *Incident) InTriageDuration() int64
- func (i *Incident) MaintenanceDuration() int64
- func (i *Incident) TimeToAcknowledge() float64
- func (i *Incident) TimeToClose() float64
- func (i *Incident) TimeToDetection() float64
- func (i *Incident) TimeToMitigation() float64
- func (i *Incident) TimeToResolution() float64
- func (i *Incident) TimeToTriage() float64
- type IncidentRole
- type IncidentsResult
- type PaginationInfo
- type PersistentCache
- func (c *PersistentCache) Cleanup()
- func (c *PersistentCache) Clear()
- func (c *PersistentCache) Close() error
- func (c *PersistentCache) Delete(key string)
- func (c *PersistentCache) Get(key string) (interface{}, bool)
- func (c *PersistentCache) GetTyped(key string, dest interface{}) bool
- func (c *PersistentCache) Set(key string, value interface{})
Constants ¶
const ( CacheKeyPrefixIncidents = "incidents" CacheKeyPrefixAlerts = "alerts" CacheKeyPrefixIncidentDetail = "incident_detail" CacheKeyPrefixAlertDetail = "alert_detail" )
Cache key prefixes
const DefaultCacheTTL = 5 * time.Minute
DefaultCacheTTL is the default cache duration
Variables ¶
var Version = "dev"
Version is set by the main package to include in User-Agent
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID string
ShortID string
Summary string
Description string
Status string
Source string
CreatedAt time.Time
UpdatedAt time.Time
StartedAt *time.Time
EndedAt *time.Time
ExternalURL string
Services []string
Environments []string
Groups []string
Labels map[string]string
// Detail fields (populated by GetAlert)
Responders []string
Urgency string
DetailLoaded bool
// Additional detail fields
URL string // Rootly URL
ExternalID string // External system ID (e.g., Sentry issue ID)
Noise string // "not_noise", "noise", etc.
IsGroupLeaderAlert bool
GroupLeaderAlertID string
NotifiedUsers []AlertUser // Users who were notified
RelatedIncidents []AlertIncident // Related incidents
DeduplicationKey string
Data map[string]interface{} // Raw alert payload from source
}
type AlertIncident ¶ added in v0.2.0
AlertIncident represents an incident related to an alert
type AlertsResult ¶
type AlertsResult struct {
Alerts []Alert
Pagination PaginationInfo
}
AlertsResult contains alerts and pagination info
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides a simple TTL-based in-memory cache
type CacheKeyBuilder ¶
type CacheKeyBuilder struct {
// contains filtered or unexported fields
}
CacheKeyBuilder builds cache keys from parameters
func NewCacheKey ¶
func NewCacheKey(prefix string) *CacheKeyBuilder
NewCacheKey creates a new cache key builder
func (*CacheKeyBuilder) Build ¶
func (b *CacheKeyBuilder) Build() string
Build generates the cache key string Format: "prefix:key1=value1:key2=value2" (sorted by key)
func (*CacheKeyBuilder) With ¶
func (b *CacheKeyBuilder) With(key string, value interface{}) *CacheKeyBuilder
With adds a parameter to the cache key
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetAlert ¶
GetAlert fetches detailed alert data by ID updatedAt is used for cache invalidation - cache key includes it so changes invalidate the cache
func (*Client) GetIncident ¶
func (c *Client) GetIncident(ctx context.Context, id string, updatedAt time.Time) (*Incident, error)
GetIncident fetches detailed incident data by ID updatedAt is used for cache invalidation - cache key includes it so changes invalidate the cache
func (*Client) ListAlerts ¶
func (*Client) ListIncidents ¶
type Incident ¶
type Incident struct {
ID string
SequentialID string
Title string
Summary string
Status string
Severity string
Kind string
CreatedAt time.Time
UpdatedAt time.Time
StartedAt *time.Time
DetectedAt *time.Time
AcknowledgedAt *time.Time
MitigatedAt *time.Time
ResolvedAt *time.Time
InTriageAt *time.Time
ClosedAt *time.Time
CancelledAt *time.Time
ScheduledFor *time.Time
ScheduledUntil *time.Time
Services []string
Environments []string
Teams []string
SlackChannelURL string
JiraIssueURL string
// Detail fields (populated by GetIncident)
URL string
ShortURL string
Causes []string
IncidentTypes []string
Functionalities []string
Roles []IncidentRole
CommanderName string
CommunicatorName string
CreatedByName string
CreatedByEmail string
DetailLoaded bool
// Additional detail fields
Source string
Private bool
MitigationMessage string
ResolutionMessage string
RetrospectiveProgressStatus string
SlackChannelName string
SlackChannelArchived bool
Labels map[string]string
StartedByName string
StartedByEmail string
MitigatedByName string
MitigatedByEmail string
ResolvedByName string
ResolvedByEmail string
// Integration links
GoogleMeetingURL string
LinearIssueURL string
ZoomMeetingJoinURL string
GithubIssueURL string
GitlabIssueURL string
PagerdutyIncidentURL string
OpsgenieIncidentURL string
AsanaTaskURL string
TrelloCardURL string
ConfluencePageURL string
DatadogNotebookURL string
ServiceNowIncidentURL string
FreshserviceTicketURL string
}
func MockIncidents ¶
func MockIncidents() []Incident
MockIncidents returns sample incident data for testing
func (*Incident) InTriageDuration ¶ added in v0.2.0
InTriageDuration returns time spent in triage in seconds
func (*Incident) MaintenanceDuration ¶ added in v0.2.0
MaintenanceDuration returns scheduled maintenance duration in seconds
func (*Incident) TimeToAcknowledge ¶ added in v0.2.0
TimeToAcknowledge returns time from started_at to acknowledged_at in hours
func (*Incident) TimeToClose ¶ added in v0.2.0
TimeToClose returns time from started_at to closed_at in hours
func (*Incident) TimeToDetection ¶ added in v0.2.0
TimeToDetection returns time from started_at to detected_at in hours
func (*Incident) TimeToMitigation ¶ added in v0.2.0
TimeToMitigation returns time from started_at to mitigated_at in hours
func (*Incident) TimeToResolution ¶ added in v0.2.0
TimeToResolution returns time from started_at to resolved_at in hours
func (*Incident) TimeToTriage ¶ added in v0.2.0
TimeToTriage returns time from in_triage_at to started_at in hours
type IncidentRole ¶
type IncidentsResult ¶
type IncidentsResult struct {
Incidents []Incident
Pagination PaginationInfo
}
IncidentsResult contains incidents and pagination info
type PaginationInfo ¶
type PaginationInfo struct {
CurrentPage int
TotalPages int
TotalCount int
HasNext bool
HasPrev bool
}
PaginationInfo contains pagination state
type PersistentCache ¶
type PersistentCache struct {
// contains filtered or unexported fields
}
PersistentCache provides a TTL-based cache backed by BoltDB
func NewPersistentCache ¶
func NewPersistentCache(ttl time.Duration) (*PersistentCache, error)
NewPersistentCache creates a new persistent cache at ~/.rootly-tui/cache.db
func (*PersistentCache) Cleanup ¶
func (c *PersistentCache) Cleanup()
Cleanup removes expired entries from the cache
func (*PersistentCache) Clear ¶
func (c *PersistentCache) Clear()
Clear removes all items from the cache
func (*PersistentCache) Close ¶
func (c *PersistentCache) Close() error
Close closes the database connection
func (*PersistentCache) Delete ¶
func (c *PersistentCache) Delete(key string)
Delete removes an item from the cache
func (*PersistentCache) Get ¶
func (c *PersistentCache) Get(key string) (interface{}, bool)
Get retrieves an item from the cache
func (*PersistentCache) GetTyped ¶
func (c *PersistentCache) GetTyped(key string, dest interface{}) bool
GetTyped retrieves and unmarshals an item from the cache
func (*PersistentCache) Set ¶
func (c *PersistentCache) Set(key string, value interface{})
Set stores an item in the cache