Skip to content

Commit

Permalink
Remove dependency from API client, to avoid an external entity to req…
Browse files Browse the repository at this point in the history
…uire the whole app
  • Loading branch information
Soulou committed Nov 3, 2015
1 parent f179be8 commit 5c82a93
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 8 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions mem/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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{}
Expand Down

0 comments on commit 5c82a93

Please sign in to comment.