diff --git a/CHANGELOG.md b/CHANGELOG.md index 56aa2d8f..c9be2ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGELOG +## v0.2.4 + +* Remove dependency to app from API client (client package) + +## v0.2.3 + +* Fix nil exception when looking for memory data + +## v0.2.2 + +* Update client package to fit new API + ## v0.2.1 * Change runner PATH model diff --git a/client/client.go b/client/client.go index a50f8231..a34cce6c 100644 --- a/client/client.go +++ b/client/client.go @@ -7,11 +7,17 @@ import ( "net/url" "strconv" - "github.com/Scalingo/acadock-monitoring/mem" "gopkg.in/errgo.v1" ) -type MemoryUsage mem.Usage +type MemoryUsage struct { + MemoryUsage int64 `json:"memory_usage"` + SwapMemoryUsage int64 `json:"swap_memory_usage"` + MemoryLimit int64 `json:"memory_limit"` + SwapMemoryLimit int64 `json:"swap_memory_limit"` + MaxMemoryUsage int64 `json:"max_memory_usage"` + MaxSwapMemoryUsage int64 `json:"max_swap_memory_usage"` +} type Client struct { Endpoint string diff --git a/mem/mem.go b/mem/mem.go index dcf46347..661ea97a 100644 --- a/mem/mem.go +++ b/mem/mem.go @@ -6,6 +6,7 @@ import ( "strconv" "sync" + "github.com/Scalingo/acadock-monitoring/client" "github.com/Scalingo/acadock-monitoring/config" "github.com/Scalingo/acadock-monitoring/docker" ) @@ -19,14 +20,7 @@ const ( LXC_MAX_SWAP_MEM_FILE = "memory.memsw.max_usage_in_bytes" ) -type Usage struct { - MemoryUsage int64 `json:"memory_usage"` - SwapMemoryUsage int64 `json:"swap_memory_usage"` - MemoryLimit int64 `json:"memory_limit"` - SwapMemoryLimit int64 `json:"swap_memory_limit"` - MaxMemoryUsage int64 `json:"max_memory_usage"` - MaxSwapMemoryUsage int64 `json:"max_swap_memory_usage"` -} +type Usage client.MemoryUsage func GetUsage(id string) (Usage, error) { usage := Usage{}