Documentation
¶
Index ¶
- func GetDLTAudit(ctx context.Context, ws domain.Workspace, startTime, endTime time.Time, ...) (domain.AuditReport, error)
- func GetWarehouseAudit(ctx context.Context, ws domain.Workspace, startTime, endTime time.Time, ...) (domain.AuditReport, error)
- type CostManager
- type DLTAuditSettings
- type Explorer
- type UsageStore
- type WarehouseAuditSettings
- type WarehouseBestPracticesInfo
- type WarehouseProvisioningInfo
- type WarehouseRuntimeStats
- type WarehouseSizeInfo
- type WarehouseStaleResourceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDLTAudit ¶
func GetDLTAudit( ctx context.Context, ws domain.Workspace, startTime, endTime time.Time, costManager CostManager, settings DLTAuditSettings, ) (domain.AuditReport, error)
GetDLTAudit computes DLT pipelines audit for a workspace over the period.
func GetWarehouseAudit ¶
func GetWarehouseAudit( ctx context.Context, ws domain.Workspace, startTime, endTime time.Time, costManager CostManager, explorer Explorer, settings WarehouseAuditSettings, ) (domain.AuditReport, error)
GetWarehouseAudit performs a comprehensive audit of SQL warehouses for the given workspace and time period, analyzing runtime patterns, sizing, best practices, stale resources, and provisioning
Types ¶
type CostManager ¶
type CostManager interface {
GetResourcesCost(
ctx context.Context,
res domain.WorkspaceResources,
startTime, endTime time.Time,
) ([]domain.ResourceCost, error)
GetUsageStats(ctx context.Context, startTime *time.Time) (*domain.UsageStats, error)
GetUsage(ctx context.Context, startTime, endTime time.Time) ([]domain.ResourceCost, error)
}
func NewCostManager ¶
func NewCostManager(usageStore UsageStore) CostManager
type DLTAuditSettings ¶
type DLTAuditSettings struct {
// MaintenanceRatioThreshold is the minimum share of maintenance events (0..1) to flag overhead.
MaintenanceRatioThreshold float64
// MinMaintenanceEvents is the minimum count of maintenance events to consider for overhead findings.
MinMaintenanceEvents int
// LongRunAvgSecondsThreshold is the average update duration in seconds above which updates are flagged as long-running.
LongRunAvgSecondsThreshold float64
}
DLTAuditSettings holds configurable thresholds for DLT audit findings.
type Explorer ¶
type UsageStore ¶
type UsageStore interface {
GetResourcesUsage(ctx context.Context, resources []string, startTime, endTime time.Time) ([]store.UsageRecord, error)
GetUsage(ctx context.Context, startTime, endTime time.Time) ([]store.UsageRecord, error)
GetUsageStats(ctx context.Context, startTime *time.Time) (*store.UsageStats, error)
}
UsageStore is the minimal interface required by CostManager for reading usage Implemented by both Databricks SQL and DuckDB usage stores
type WarehouseAuditSettings ¶
type WarehouseAuditSettings struct {
// MaxRuntimeHours is the threshold for flagging warehouses with excessive runtime (default: 8.0)
MaxRuntimeHours float64
// MaxIdleHours is the threshold for flagging warehouses with excessive idle time (default: 2.0)
MaxIdleHours float64
// IdleTimeThreshold is the percentage threshold for idle time vs active time (default: 0.5 = 50%)
IdleTimeThreshold float64
// StaleResourceDays is the number of days to consider a warehouse stale (default: 30)
StaleResourceDays int
// TopLargestCount is the number of largest warehouses to identify (default: 5)
TopLargestCount int
// MinQueryCountThreshold is the minimum query count for provisioning analysis (default: 10)
MinQueryCountThreshold int
}
WarehouseAuditSettings contains configurable thresholds for warehouse audit analysis
func DefaultWarehouseAuditSettings ¶
func DefaultWarehouseAuditSettings() WarehouseAuditSettings
DefaultWarehouseAuditSettings returns the default configuration for warehouse audits
type WarehouseBestPracticesInfo ¶
type WarehouseBestPracticesInfo struct {
WarehouseID string
Name string
AutoStopMins int
HasAutoStop bool
EnableServerless bool
WarehouseType string
ComplianceScore float64
MissingPractices []string
TotalCost float64
UsageHours float64
Currency string
}
WarehouseBestPracticesInfo represents best practices compliance information for a warehouse
type WarehouseProvisioningInfo ¶
type WarehouseProvisioningInfo struct {
WarehouseID string
Name string
Size string
NodeCount int
MaxClusters int
QueryCount int
TotalCost float64
UsageHours float64
Currency string
AvgResourceUtilization float64
QueryComplexityScore float64
ProvisioningScore float64 // Higher score = more over-provisioned
IsOverProvisioned bool
IsUnderProvisioned bool
RecommendedSize string
PotentialSavings float64
}
WarehouseProvisioningInfo represents provisioning analysis information for a warehouse
type WarehouseRuntimeStats ¶
type WarehouseRuntimeStats struct {
WarehouseID string
TotalRuntimeHours float64
TotalIdleHours float64
IdleTimePercent float64
RecordCount int
Currency string
}
WarehouseRuntimeStats holds runtime analysis data for a warehouse
type WarehouseSizeInfo ¶
type WarehouseSizeInfo struct {
WarehouseID string
Name string
Size string // e.g., "2X-Small", "Small", "Medium", "Large", etc.
MinClusters int
MaxClusters int
NodeCount int // Calculated based on size and cluster configuration
IsServerless bool
TotalCost float64
UsageHours float64
Currency string
SizeScore float64 // Calculated score for ranking by size
}
WarehouseSizeInfo represents warehouse size and configuration information
type WarehouseStaleResourceInfo ¶
type WarehouseStaleResourceInfo struct {
WarehouseID string
Name string
LastActivityTime *time.Time
CreatedTime *time.Time
DaysSinceActivity int
DaysSinceCreation int
QueryCount int
HasActivity bool
IsStale bool
IsOrphaned bool
NeverStarted bool
TotalCost float64
UsageHours float64
Currency string
}
WarehouseStaleResourceInfo represents stale resource analysis information for a warehouse