A usage tracking service that can persist to disk very efficiently or to a database
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
trail-register-client
trail-register
.gitignore
LICENSE.md
README.md
pom.xml
schema.sql

README.md

Trail Register

Trail Register is a usage tracking tool. Named after the log books placed at trailheads that are used partly to track trail usage.

Getting Started

Trail Register can be run via docker or with the standalone jar directly.

Docker:

docker run -d -p 4567:4567 -v /data/trail-register:/data reicoop/trail-register

Java

java -jar trail-register.jar

Clustering

Trail register can also be run in a clustered mode for high availability. In this mode writes are independent to each node in the cluster, since this a write heavy system. Reads are done by the node doing the same read to all of its peers and adding them together.

Load balancing must be handled externally by some other tool such as HA-Proxy, nginx, or an F5.

Docker:

docker run -d -p 4567:4567 -e PEERS=${HOST}:4567,${HOST}:4568 reicoop/trail-register
docker run -d -p 4568:4567 -e PEERS=${HOST}:4567,${HOST}:4568 reicoop/trail-register

REST Endpoints

GET /

lists applications
Example Response: ["app1", "app2"]

GET /$app

lists environments for an application
Example Response: ["env1", "env2"]

GET /$app/$env

lists categories used in an environment
Example Response: ["category1", "category2"]

GET /$app/$env/$category[?days=30]

lists all usages by key for a given category.
Example Response: {"key1": 7, "key2":25}

GET /$app/$env/$category/$key[?days=30][&by_date=false]

lists all usages for given key for a given category.
Example Response: 12
Example Response (by date): {"20150910": 7, "20150919":5}

POST /$app/$env/$category/$key

records a single usage for the given key

POST /$app/$env/$category

records usages for the given keys
Example Request: {"key1": 7, "key2":5}

POST /$app/$env

records usages for the given keys by category
Example Request: {"category1": {"key1": 7, "key2":5}, "category2": {"key1": 4, "key2":8}}

GET /health

Example Response: UP

GET /_stats

returns timing info per endpoint