Skip to content

lodastack/sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

golang SDK

example code:


import "github.com/lodastack/sdk-go"

type Metric struct {
	Name      string            `json:"name"`
	Timestamp int64             `json:"timestamp"`
	Tags      map[string]string `json:"tags"`
	Value     interface{}       `json:"value"`
	Offset    int64             `json:"offset,omitempty"`
}

func Send(ns string, from string, loss int) error {
	m := Metric{
		Name:      "ping.loss",
		Timestamp: time.Now().Unix(),
		Tags: map[string]string{
			"from": from,
		},
		Value: loss,
	}
	data, err := json.Marshal([]Metric{m})
	if err != nil {
		return err
	}
	return sdk.Post(ns, data)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages