func (graphite *Graphite) SendMetrics(metrics []Metric) error {
	return graphite.sendMetrics(metrics)
}
Given a slice of Metrics, the SendMetrics method sends the metrics, as a
batch, to the Graphite connection that the method is called upon
package graphite
import (
	"bytes"
	"fmt"
	"log"
	"net"
	"time"
)
type Graphite struct {
	Host     string
	Port     int
	Protocol string
	Timeout  time.Duration
	Prefix   string
	conn     net.Conn
	nop      bool
	DisableLog bool
}
const defaultTimeout = 5
func (graphite *Graphite) IsNop() bool {
	if graphite.nop {
		return true
	}
	return false
}
func (graphite *Graphite) Connect() error {
	if !graphite.IsNop() {
		if graphite.conn != nil {
			graphite.conn.Close()
		}
		address := fmt.Sprintf("%s:%d", graphite.Host, graphite.Port)
		if graphite.Timeout == 0 {
			graphite.Timeout = defaultTimeout * time.Second
		}
		var err error
		var conn net.Conn
		if graphite.Protocol == "udp" {
			udpAddr, err := net.ResolveUDPAddr("udp", address)
			if err != nil {
				return err
			}
			conn, err = net.DialUDP(graphite.Protocol, nil, udpAddr)
		} else {
			conn, err = net.DialTimeout(graphite.Protocol, address, graphite.Timeout)
		}
		if err != nil {
			return err
		}
		graphite.conn = conn
	}
	return nil
}
func (graphite *Graphite) Disconnect() error {
	err := graphite.conn.Close()
	graphite.conn = nil
	return err
}
func (graphite *Graphite) SendMetric(metric Metric) error {
	metrics := make([]Metric, 1)
	metrics[0] = metric
	return graphite.sendMetrics(metrics)
}