#Metrics-Collector
Metrics-Collector is one of the components of CF app-autoscaler
. It is used to collect application metrics from CF loggretator. The current version only supports memory metrics, it will be extended to include other metrics like throughput and response time at a later time.
- Go 1.5 or above
- Cloud Foundry relese 235 or later
- clone
app-autoscaler
project:git clone https://github.com/cloudfoundry-incubator/app-autoscaler.git
- change directory to
app-autoscaler
- pull the submodules :
git submodule update --init --recursive
- add
app-autoscaler
directory to your $GOPATH - change directory to
src/metrics-collector
- build the project:
go build -o out/mc
- test the project:
- install ginko:
go install github.com/onsi/ginkgo/ginkgo
- run tests:
ginkgo -r
- install ginko:
Firstly a configuration file needs to be created. Examples can be found under example-config
directory. Here is an example:
cf:
api: "https://api.bosh-lite.com"
grant_type: "password"
user: "admin"
pass: "admin"
server:
port: 8080
logging:
level: "info"
The config parameters are explained as below
- cf : cloudfoundry config
api
: API endpoint of cloudfoundrygrant_type
: the grant type when you login into coud foundry, can be "password" or "client_credentials"user
: the user name when using password grant to login cloudfoundrypass
: the password when using password grant to login cloudfoundryclient_id
: the client id when using client_credentials grant to login cloudfoundrysecret
: the client secret when using client_credentials grant to login cloudfoundry- server: API sever config
port
: the port API sever will listen to- logging: config for logging
level
: the level of logging, can be 'debug', 'info', 'error' or 'fatal'
To run the metrics-collector, use `./out/mc -c config_file_name'
Metrics Collector exposes the following APIs for other CF App-Autoscaler components to retrieve metrics.
PATH | METHOD | Description |
---|---|---|
/v1/apps/{appid}/metrics/memory | GET | Get the latest memroy metric of an application |