Documentation
¶
Index ¶
- Variables
- func CalculateMetricsAggregates(metrics []types.ProcessedMetric) map[string]types.MetricAggregate
- type CostAggregate
- type ProcessedAggregates
- type ProcessedCluster
- type ProcessedCost
- type ProcessedCostBreakdown
- type ProcessedMSKSource
- type ProcessedOSKCluster
- type ProcessedOSKSource
- type ProcessedRegion
- type ProcessedRegionCosts
- type ProcessedSource
- type ProcessedState
- type ReportService
- func (rs *ReportService) FilterClusterMetrics(processedState ProcessedState, clusterID string, sourceType string, ...) (*types.ProcessedClusterMetrics, error)
- func (rs *ReportService) FilterConnectMetrics(processedState ProcessedState, clusterID string, sourceType string, ...) (*types.ConnectClusterMetrics, error)
- func (rs *ReportService) FilterMetrics(processedState ProcessedState, regionName, clusterName string, ...) (*types.ProcessedClusterMetrics, error)
- func (rs *ReportService) FilterRegionCosts(processedState ProcessedState, regionName string, ...) (*ProcessedRegionCosts, error)
- func (rs *ReportService) ProcessState(state types.State) ProcessedState
- type ServiceCostAggregates
Constants ¶
This section is empty.
Variables ¶
var ErrNoConnectMetricsCollected = errors.New("no Connect metrics collected for cluster")
ErrNoConnectMetricsCollected reports that a cluster exists but has never had any self-managed Connect metrics collected. It is deliberately distinct from an empty date-filtered result (a cluster that HAS metrics, none of which fall in the queried window): the former warrants a "run a scan" hint, the latter is a valid empty 200. The API layer maps this sentinel to the scan-guidance response via errors.Is.
Functions ¶
func CalculateMetricsAggregates ¶ added in v0.8.1
func CalculateMetricsAggregates(metrics []types.ProcessedMetric) map[string]types.MetricAggregate
CalculateMetricsAggregates returns avg, min, max, P95, P99, and count per metric label. Percentiles use the nearest-rank method — see nearestRankIndex.
Types ¶
type CostAggregate ¶ added in v0.8.6
type ProcessedAggregates ¶ added in v0.8.6
type ProcessedAggregates struct {
AWSCertificateManager ServiceCostAggregates `json:"AWS Certificate Manager"`
AmazonManagedStreamingForApacheKafka ServiceCostAggregates `json:"Amazon Managed Streaming for Apache Kafka"`
EC2Other ServiceCostAggregates `json:"EC2 - Other"`
ElasticLoadBalancing ServiceCostAggregates `json:"Amazon Elastic Load Balancing"`
AmazonVPC ServiceCostAggregates `json:"Amazon Virtual Private Cloud"`
}
ProcessedAggregates represents the specific services we query
func NewProcessedAggregates ¶ added in v0.8.6
func NewProcessedAggregates() ProcessedAggregates
NewProcessedAggregates creates a new ProcessedAggregates with all maps initialized
func (*ProcessedAggregates) ForService ¶ added in v0.8.6
func (a *ProcessedAggregates) ForService(name string) *ServiceCostAggregates
ForService returns a pointer to the ServiceCostAggregates for the given service name, or nil if the service is not recognized.
type ProcessedCluster ¶ added in v0.8.6
type ProcessedCluster struct {
Name string `json:"name"`
Arn string `json:"arn"`
Region string `json:"region"`
ClusterMetrics types.ProcessedClusterMetrics `json:"metrics"` // Flattened from raw CloudWatch metrics
AWSClientInformation types.AWSClientInformation `json:"aws_client_information"`
KafkaAdminClientInformation types.KafkaAdminClientInformation `json:"kafka_admin_client_information"`
DiscoveredClients []types.DiscoveredClient `json:"discovered_clients"`
}
ProcessedCluster contains the complete cluster data with flattened metrics This is the full cluster information with processed metrics, unlike the simplified version in types.go
type ProcessedCost ¶ added in v0.8.6
type ProcessedCost struct {
Start string `json:"start"`
End string `json:"end"`
Service string `json:"service"`
UsageType string `json:"usage_type"`
Values ProcessedCostBreakdown `json:"values"`
}
type ProcessedCostBreakdown ¶ added in v0.8.6
type ProcessedMSKSource ¶ added in v0.8.6
type ProcessedMSKSource struct {
Regions []ProcessedRegion `json:"regions"`
}
ProcessedMSKSource contains processed MSK data (regions)
type ProcessedOSKCluster ¶ added in v0.8.6
type ProcessedOSKCluster struct {
ID string `json:"id"`
BootstrapServers []string `json:"bootstrap_servers"`
KafkaAdminClientInformation types.KafkaAdminClientInformation `json:"kafka_admin_client_information"`
ClusterMetrics *types.ProcessedClusterMetrics `json:"metrics,omitempty"`
DiscoveredClients []types.DiscoveredClient `json:"discovered_clients"`
Metadata types.OSKClusterMetadata `json:"metadata"`
}
ProcessedOSKCluster represents an OSK cluster in the API response
type ProcessedOSKSource ¶ added in v0.8.6
type ProcessedOSKSource struct {
Clusters []ProcessedOSKCluster `json:"clusters"`
}
ProcessedOSKSource contains processed OSK data (flat cluster array)
type ProcessedRegion ¶ added in v0.8.6
type ProcessedRegion struct {
Name string `json:"name"`
Configurations []kafka.DescribeConfigurationRevisionOutput `json:"configurations"`
Costs ProcessedRegionCosts `json:"costs"` // Flattened from raw AWS Cost Explorer data
Clusters []ProcessedCluster `json:"clusters"` // Simplified from full DiscoveredCluster data
}
ProcessedRegion mirrors DiscoveredRegion but with flattened costs and simplified clusters
type ProcessedRegionCosts ¶ added in v0.8.6
type ProcessedRegionCosts struct {
Region string `json:"region"`
Metadata types.CostMetadata `json:"metadata"`
Results []ProcessedCost `json:"results"`
Aggregates ProcessedAggregates `json:"aggregates"`
QueryInfo types.CostQueryInfo `json:"query_info"`
}
type ProcessedSource ¶ added in v0.8.6
type ProcessedSource struct {
Type types.SourceType `json:"type"`
MSKData *ProcessedMSKSource `json:"msk_data,omitempty"`
OSKData *ProcessedOSKSource `json:"osk_data,omitempty"`
}
ProcessedSource represents a unified source (MSK or OSK) with discriminated union
type ProcessedState ¶ added in v0.8.6
type ProcessedState struct {
Sources []ProcessedSource `json:"sources"`
SchemaRegistries *types.SchemaRegistriesState `json:"schema_registries,omitempty"`
KcpBuildInfo interface{} `json:"kcp_build_info,omitempty"`
Timestamp time.Time `json:"timestamp"`
SchemaVersion int `json:"schema_version"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
UpgradedFrom string `json:"upgraded_from,omitempty"`
}
ProcessedState represents the transformed output data structure This is what comes OUT of the frontend/API after processing the raw State data Same structure as State but with costs and metrics flattened for easier frontend consumption
type ReportService ¶
type ReportService struct{}
func NewReportService ¶
func NewReportService() *ReportService
func (*ReportService) FilterClusterMetrics ¶
func (rs *ReportService) FilterClusterMetrics(processedState ProcessedState, clusterID string, sourceType string, startTime, endTime *time.Time) (*types.ProcessedClusterMetrics, error)
filterClusterMetrics filters the processed state by cluster ID and date range sourceType can be "msk", "osk", or "auto" (auto-detects based on identifier pattern)
func (*ReportService) FilterConnectMetrics ¶ added in v0.8.6
func (rs *ReportService) FilterConnectMetrics(processedState ProcessedState, clusterID string, sourceType string, startTime, endTime *time.Time) (*types.ConnectClusterMetrics, error)
FilterConnectMetrics filters self-managed Connect metrics for a cluster by cluster ID and date range. Connect is Kafka-distribution agnostic, so the same metrics live on the shared KafkaAdminClientInformation for both MSK and OSK clusters; sourceType selects which source set to search (and which identifier to match: MSK by ARN, OSK by cluster ID). Each branch searches only its own source set, so a cluster identifier never resolves across source types.
func (*ReportService) FilterMetrics ¶
func (rs *ReportService) FilterMetrics(processedState ProcessedState, regionName, clusterName string, startTime, endTime *time.Time) (*types.ProcessedClusterMetrics, error)
filterMetrics filters the processed state by region, cluster, and date range
func (*ReportService) FilterRegionCosts ¶
func (rs *ReportService) FilterRegionCosts(processedState ProcessedState, regionName string, startTime, endTime *time.Time) (*ProcessedRegionCosts, error)
FilterRegionCosts filters the processed state to return cost data for a specific region
func (*ReportService) ProcessState ¶
func (rs *ReportService) ProcessState(state types.State) ProcessedState
type ServiceCostAggregates ¶ added in v0.8.6
type ServiceCostAggregates struct {
UnblendedCost map[string]any `json:"unblended_cost"`
BlendedCost map[string]any `json:"blended_cost"`
AmortizedCost map[string]any `json:"amortized_cost"`
NetAmortizedCost map[string]any `json:"net_amortized_cost"`
NetUnblendedCost map[string]any `json:"net_unblended_cost"`
}
ServiceCostAggregates represents cost aggregates for a single service Uses explicit fields for each metric type instead of a map