diff --git a/librato.go b/librato.go index 904c41e..b91b7af 100644 --- a/librato.go +++ b/librato.go @@ -12,6 +12,7 @@ import ( "encoding/json" "errors" "fmt" + "runtime" "strings" "time" @@ -21,6 +22,10 @@ import ( // ////////////////////////////////////////////////////////////////////////////////// // +const VERSION = "1.0" + +// ////////////////////////////////////////////////////////////////////////////////// // + // Measurement is interface for different type of measurements type Measurement interface { Validate() error @@ -214,6 +219,10 @@ var APIEndpoint = "https://metrics-api.librato.com" // List of sources var sources []DataSource +// User agent +var userAgent = fmt.Sprintf("ek-librato/%s (go; %s; %s-%s)", + VERSION, runtime.Version(), runtime.GOARCH, runtime.GOOS) + // ////////////////////////////////////////////////////////////////////////////////// // // NewMetrics create new metrics struct for async metrics sending @@ -469,6 +478,7 @@ func execRequest(method, url string, data interface{}) []error { BasicAuthPassword: Token, ContentType: "application/json", + UserAgent: userAgent, } if data != nil {