Using Ghostferry in Custom Applications

For an example application, see ghostferry-copydb.

Consuming Ghostferry Metrics

Ghostferry provides optional metrics to your application.

Start consuming the metrics:

sink := make(chan interface{}, 512)
metrics := ghostferry.SetGlobalMetrics("myApp", sink)

go func(){
  for {
    switch metric := (<-sink).(type) {
    case ghostferry.CountMetric:
      // Do something with the metric
    case ghostferry.GaugeMetric:
      // Do something with the metric
    case ghostferry.TimerMetric:
      // Do something with the metric
    }
  }
}()

Emit additional metrics:

metrics.Count("myOwnCustomMetrics", 42, nil, 1.0)

This site uses Just the Docs, a documentation theme for Jekyll.