Giter Club home page Giter Club logo

go-opentsdb-client's Introduction

go-opentsdb-client

What is opentsdb?

OpenTSDB is a distributed, scalable Time Series Database (TSDB). OpenTSDB allows you to collect thousands of metrics from tens of thousands of hosts and applications, at a high rate (every few seconds). OpenTSDB will never delete or downsample data and can easily store hundreds of billions of data points.

I develop the go-opentsdb-client to simplify the process in your golang project. Before you use these apis, You'd better read OpenTSDB Rest API Doc.

Example Usage

func TestPut(t *testing.T) {
        // create a new client.
        // host: 127.0.0.1
        // port: 4242
        // connectionTimeOut: 3s
        c := NewClient("127.0.0.1", 4242, 3)

        // construct UniMetric data
        metric := &UniMetric{
                MetricName: "test.opentsdb",
                TimeStamp:  1473302029,
                Value:      11111,
                Tags: map[string]interface{}{
                        "host": "localhost",
                        "port": "4240",
                },
        }

        // put metrics to opentsdb
        rr, err := c.Put([]*UniMetric{metric})
        if err != nil {
                log.Logger.Debugf("errInfo: %+v", err)
        }else{
                log.Logger.Debug("put.resp.info", rr.RespInfo)
        }
}

Usually used APIs

// NewClient create a Client obj with host、port、connTimeout
NewClient(host string, port int, dialTimeout int64) *Client

// Put put metrics to oentsdb
func (c *Client) Put(metrics []*UniMetric) (*PutResponse, error)

// QueryByGet query with GET method
func (c *Client) QueryByGet(query *QueryRequestGet) (queryResp *QueryResponse, errResp *ErrorResponse, err error)

// QueryByPost query with GET method
func (c *Client) QueryByPost(query *QueryRequestPost) (queryResp *QueryResponse, errResp *ErrorResponse, err error)

Development Plan

  • Add connection pool
  • Add RESTful API
  • Add connTimeOut and rwTimeOut
  • Read metrics by different way (file, io etc.)

go-opentsdb-client's People

Contributors

maodanp avatar

Watchers

 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.