Skip to content

n10ty/opentsdb-go-push

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

OpenTSDB metrics push GO client

OpenTSDB client helps to send standardized metric to /api/put path.

Client has 2 options to send metrics:

  • Enqueue metrics, send when batchSize collected and flush buffer. Use Push to force send current buffer.
  • Send single Metric immediately.

Important

Do not forger invoke Close on service down, to send unfilled buffer

Usage

Import:

go get github.com/n10ty/opentsdb-go-push

Example:

func main() {
    client := opentsdb.NewClient("http://localhost:4242", opentsdb.WithBatchSize(30), opentsdb.WithAuth("user", "pass"))
	err := client.Enqueue(opentsdb.Metric{
		Timestamp: time.Now().Truncate(time.Minute).Unix(),
		Metric:    "http_response_time",
		Value:     39.3,
		Tags: map[string]string{
			"server": "server1",
		},
	})
	if err != nil {
		//...
	}
	client.Push()
}

About

Client to push opentsdb metrics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages