graphite-golang

A lightweight Graphite client for Golang

  • 所有者: marpaia/graphite-golang
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

graphite-golang

This is a lightweight Graphite API client written in Go that implements Carbon
submission functionality. I wrote this a long time ago as a dependency for a side
project a long time ago. You shouldn't rely on this for any production use-case.

Installation

Use go-get to install graphite-golang

go get github.com/marpaia/graphite-golang

External dependencies

This project has no external dependencies other than the Go standard library.

Documentation

Like most every other Golang project, this projects documentation can be found
on godoc at godoc.org/github.com/marpaia/graphite-golang.

Examples

package mylib

import (
    "github.com/marpaia/graphite-golang"
    "log"
)

func init() {

    // load your configuration file / mechanism
    config := newConfig()

    // try to connect a graphite server
    if config.GraphiteEnabled {
        Graphite, err = graphite.NewGraphite(config.Graphite.Host, config.Graphite.Port)
    } else {
        Graphite = graphite.NewGraphiteNop(config.Graphite.Host, config.Graphite.Port)
    }
    // if you couldn't connect to graphite, use a nop
    if err != nil {
        Graphite = graphite.NewGraphiteNop(config.Graphite.Host, config.Graphite.Port)
    }

    log.Printf("Loaded Graphite connection: %#v", Graphite)
    Graphite.SimpleSend("stats.graphite_loaded", "1")
}

func doWork() {
    // this will work just fine, regardless of if you're working with a graphite
    // nop or not
    Graphite.SimpleSend("stats.doing_work", "1")
}

主要指标

概览
名称与所有者marpaia/graphite-golang
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2013-11-09 02:22:55
推送于2019-05-19 02:48:12
最后一次提交2019-05-18 20:48:11
发布数0
用户参与
星数110
关注者数5
派生数44
提交数43
已启用问题?
问题数7
打开的问题数2
拉请求数16
打开的拉请求数0
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?