Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

0.6.0 (preview 6)

Pre-release
Pre-release
Compare
Choose a tag to compare
@palkan palkan released this 02 May 16:23
· 778 commits to master since this release

Features

This pre-release introduces an experimental mruby integration.

NOTE: Experimental means that the final API may (and likely will) change.

You can write custom Ruby script to implement statistics logging.

For example, to provide Librato-comatible output you can write a custom formatter like this:

# my-metrics-formatter.rb
# This MetricsFormatter name is required!
module MetricsFormatter
  KEYS = %w(clients_num clients_unique_num goroutines_num)

  # `data` is a Hash containing all the metrics data
  def self.call(data)
    parts = []

    data.each do |key, value|
      parts << "sample##{key}=#{value}" if KEYS.include?(key)
    end

    parts.join(' ')
  end
end

And then use it like this:

anycable-go --metrics_log_formatter="my-metrics-formatter.rb"

>INFO 2018-04-27T14:11:59.701Z sample#clients_num=0 sample#clients_uniq_num=0 sample#goroutines_num=0

NOTE: pre-compiled binaries with mruby support are currently only available for Linux AMD64 and MacOS AMD64 (versions with -mrb suffix). For Heroku buildpack use HEROKU_ANYCABLE_GO_VERSION=0.6.0-preview6-mrb.