Coder Social home page Coder Social logo

graphsom's Introduction

graphsom

graphsom is a flexible metrics management system for Erlang applications. It's main goal is for easier collection, management and reporting of metrics to various backends.

Getting started guide

Features

  • Metric Systems Support

    • Folsom Metrics:
      • All metric types: gauge, counter, meter, histogram and history
      • All VM metrics: memory,statistics, process_info, system_info and port_info
      • Support for custom handlers for folsom metric types
    • A simple callback-based Graphsom Metrics API is available for custom user-defined metrics
  • Visualization Backends

Folsom Metrics API

Create some folsom metrics (folsom API):

    
folsom_metrics:new_counter(metric_name_1).
folsom_metrics:new_meter(metric_name_2).

Update values for the metrics:

	
folsom_metrics:notify({metric_name_1, {inc, 100}}).
folsom_metrics:notify({metric_name_2, 300}).

Register folsom metric with graphsom for reporting:

graphsom:register_folsom_metric(metric_name_1).

De-register folsom metric:

graphsom:deregister_folsom_metric(metric_name_1).

To get the list of currently registered folsom metrics

    
graphsom:registered_metrics().

To register a specific folsom type handler:

graphsom:register_folsom_type_handler(TYPE, MODULE, FUN).

The API can be used to register a handler for all registered folsom metrics of a certain type. Graphsom calls MODULE:FUN/2 with metric name and type to get its value.

Custom Metrics API

Graphsom metrics API is offered when a custom user-defined metric needs to be reported.

To register a custom metric:

    
graphsom:register_graphsom_metric(METRIC_NAME, MODULE, FUN, PARAMS).

Graphsom expects a property list as a response to the callback MODULE:FUN with PARAMS as parameters. Note that FUN must be exported by the module MODULE with the a correct arity.

For example, we can use Graphsom API to report the number children of a worker_sup supervisor, i.e., the result of

    
supervisor:count_children(worker_sup).
[{specs,2},{active,2},{supervisors,1},{workers,1}]

This can be directly registered with graphsom as follows:

    
graphsom:register_graphsom_metric(worker_count, supervisor, count_children, [worker_sup]).

Reporting Metrics

Interval-Based Reporting

Tell graphsom to start reporting. All registered metrics are reported periodically after a configurable interval.

graphsom:start_reporting().

Manual Reporting

graphsom:report_now().

Check graphite for the values!!

Configuration

The configuration parameters for graphsom can be added to application config file ([RELEASE]/files/sys.config). An example configuration:

{graphsom, [
         {report_interval, 30000},     %% report interval (ms)
         {graphite_host, "techtraits.com"}, %% defaults to localhost
         {graphite_port, 2003},        %% defaults to 2003
         {graphite_prefix, "graphsom"}, %% prefix added to all metrics
         {vm_metrics, [memory, statistics]},   %% defaults to []
         {report_all_folsom_metrics, false}   %% defaults to false
        ]}
  • graphite_prefix can be used to specify the prefix prepended to all metric names. For example, "response_time" would be reported as "graphsom.response_time".

  • vm_metrics can be used to report folsom VM metrics

  • If report_all_folsom_metrics is set to true, graphsom reports all folsom metrics that exist at the time of reporting. Alternatively, register_folsom_metric API can be used for reporting selective metrics to graphite.

Authors

Bilal Sheikh ([email protected])
Usman Ismail ([email protected])

graphsom's People

Contributors

bilal avatar usmanismail avatar tarekz avatar

Watchers

edwardttril avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.