Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cmd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ccache parser and exporter

A ccache parser and Prometheus exporter.

Branch Status
master Travis build status

Metrics exposed

Counters:

  • ccache_call_total
  • ccache_call_hit_total
  • ccache_called_for_link_total
  • ccache_called_for_preprocessing_total
  • ccache_unsupported_code_directive_total
  • ccache_no_input_file_total
  • ccache_cleanups_performed_total

Gauges:

  • ccache_cache_hit_ratio
  • ccache_cache_size_bytes
  • ccache_cache_size_max_bytes
  • ccache_cached_files

Building

# get the sources
$ git clone https://github.com/virtualtam/ccache_exporter.git

# build the parser and exporter
$ make build

Parser usage

$ ccache -s | ccacheparser | jq

{
  "cache_directory": "/home/virtualtam/.ccache",
  "primary_config": "/home/virtualtam/.ccache/ccache.conf",
  "secondary_config_readonly": "/etc/ccache.conf",
  "stats_time": "2018-09-24T21:19:07.997866938+02:00",
  "stats_zero_time": "2018-09-23T01:18:52+02:00",
  "cache_hit_direct": 124,
  "cache_hit_preprocessed": 8,
  "cache_miss": 297,
  "cache_hit_rate": 30.77,
  "called_for_link": 39,
  "called_for_preprocessing": 263,
  "unsupported_code_directive": 5,
  "no_input_file": 83,
  "cleanups_performed": 0,
  "files_in_cache": 926,
  "cache_size": "17.5 MB",
  "cache_size_bytes": 17500000,
  "max_cache_size": "15.0 GB",
  "max_cache_size_bytes": 15000000000
}

Running with Docker Compose

The provided docker-compose.yml script defines the following monitoring stack:

  • ccache-exporter service bind-mounted on the user's (hint: that's you \o/) $HOME directory;
  • node-exporter service to gather system metrics;
  • prometheus database, preconfigured to scrap exported ccache metrics;
  • grafana dashboard, preconfigured to use prometheus as a data source and display ccache metrics in the corresponding dashboard.

To pull Docker images and start the services:

$ docker-compose pull
$ docker-compose up -d

Once the stack is up, the following services will be exposed:

Then, login to Grafana with the default credentials (admin/admin) and load the ccache dashboard:

dashboard.jpg