Documentation ¶
Index ¶
- Constants
- func MetricsData(containerStatsMap map[string]*ContainerStats, metadata ecsutil.TaskMetadata, ...) []pmetric.Metrics
- type CPUStats
- type CPUUsage
- type ContainerStats
- type DiskStats
- type ECSMetrics
- type IoServiceBytesRecursive
- type MemoryStats
- type NetworkRateStats
- type NetworkStats
- type StatsProvider
- type TaskStats
Constants ¶
const TaskStatsPath = "/task/stats"
Variables ¶
This section is empty.
Functions ¶
func MetricsData ¶
func MetricsData(containerStatsMap map[string]*ContainerStats, metadata ecsutil.TaskMetadata, logger *zap.Logger) []pmetric.Metrics
MetricsData generates OTLP metrics from endpoint raw data
Types ¶
type CPUStats ¶
type CPUStats struct { CPUUsage *CPUUsage `json:"cpu_usage,omitempty"` OnlineCpus *uint64 `json:"online_cpus,omitempty"` SystemCPUUsage *uint64 `json:"system_cpu_usage,omitempty"` CPUUtilized *uint64 CPUReserved *uint64 }
CPUStats defines Cpu stats
type CPUUsage ¶
type CPUUsage struct { TotalUsage *uint64 `json:"total_usage,omitempty"` UsageInKernelmode *uint64 `json:"usage_in_kernelmode,omitempty"` UsageInUserMode *uint64 `json:"usage_in_usermode,omitempty"` PerCPUUsage []*uint64 `json:"percpu_usage,omitempty"` }
CPUUsage defines raw Cpu usage
type ContainerStats ¶
type ContainerStats struct { Name string `json:"name"` ID string `json:"id"` Read time.Time `json:"read"` PreviousRead time.Time `json:"preread"` Memory *MemoryStats `json:"memory_stats,omitempty"` Disk *DiskStats `json:"blkio_stats,omitempty"` Network map[string]NetworkStats `json:"networks,omitempty"` NetworkRate *NetworkRateStats `json:"network_rate_stats,omitempty"` CPU *CPUStats `json:"cpu_stats,omitempty"` PreviousCPU *CPUStats `json:"precpu_stats,omitempty"` }
ContainerStats defines the structure for container stats
type DiskStats ¶
type DiskStats struct {
IoServiceBytesRecursives []IoServiceBytesRecursive `json:"io_service_bytes_recursive,omitempty"`
}
DiskStats defines the storage stats
type ECSMetrics ¶
type ECSMetrics struct { MemoryUsage uint64 MemoryMaxUsage uint64 MemoryLimit uint64 MemoryUtilized uint64 MemoryReserved uint64 CPUTotalUsage uint64 CPUUsageInKernelmode uint64 CPUUsageInUserMode uint64 CPUOnlineCpus uint64 SystemCPUUsage uint64 NumOfCPUCores uint64 CPUReserved float64 CPUUtilized float64 CPUUsageInVCPU float64 NetworkRateRxBytesPerSecond float64 NetworkRateTxBytesPerSecond float64 NetworkRxBytes uint64 NetworkRxPackets uint64 NetworkRxErrors uint64 NetworkRxDropped uint64 NetworkTxBytes uint64 NetworkTxPackets uint64 NetworkTxErrors uint64 NetworkTxDropped uint64 StorageReadBytes uint64 StorageWriteBytes uint64 }
ECSMetrics defines the structure container/task level metrics
type IoServiceBytesRecursive ¶
type IoServiceBytesRecursive struct { Major *uint64 `json:"major,omitempty"` Minor *uint64 `json:"minor,omitempty"` Op string `json:"op,omitempty"` Value *uint64 `json:"value,omitempty"` }
IoServiceBytesRecursive defines the IO device stats
type MemoryStats ¶
type MemoryStats struct { Usage *uint64 `json:"usage,omitempty"` MaxUsage *uint64 `json:"max_usage,omitempty"` Limit *uint64 `json:"limit,omitempty"` MemoryUtilized *uint64 MemoryReserved *uint64 Stats map[string]uint64 `json:"stats,omitempty"` }
MemoryStats defines the memory stats
type NetworkRateStats ¶
type NetworkRateStats struct { RxBytesPerSecond *float64 `json:"rx_bytes_per_sec,omitempty"` TxBytesPerSecond *float64 `json:"tx_bytes_per_sec,omitempty"` }
NetworkRateStats doesn't come from docker stat. The rates are being calculated in ECS agent
type NetworkStats ¶
type NetworkStats struct { RxBytes *uint64 `json:"rx_bytes,omitempty"` RxPackets *uint64 `json:"rx_packets,omitempty"` RxErrors *uint64 `json:"rx_errors,omitempty"` RxDropped *uint64 `json:"rx_dropped,omitempty"` TxBytes *uint64 `json:"tx_bytes,omitempty"` TxPackets *uint64 `json:"tx_packets,omitempty"` TxErrors *uint64 `json:"tx_errors,omitempty"` TxDropped *uint64 `json:"tx_dropped,omitempty"` }
NetworkStats defines the network stats
type StatsProvider ¶
type StatsProvider struct {
// contains filtered or unexported fields
}
StatsProvider wraps a RestClient, returning an unmarshaled metadata and docker stats
func NewStatsProvider ¶
func NewStatsProvider(rc ecsutil.RestClient, logger *zap.Logger) *StatsProvider
NewStatsProvider returns a new stats provider
func (*StatsProvider) GetStats ¶
func (p *StatsProvider) GetStats() (map[string]*ContainerStats, ecsutil.TaskMetadata, error)
GetStats calls the ecs task metadata endpoint and unmarshals the data
type TaskStats ¶
type TaskStats struct { Memory MemoryStats NetworkRate NetworkRateStats Network NetworkStats CPU CPUStats StorageReadBytes *uint64 StorageWriteBytes *uint64 }
TaskStats defines the stats for a task