version tag

This commit is contained in:
Brad Rydzewski 2019-03-16 12:56:52 -07:00
parent ba750ff0ae
commit 680afa1db1
2 changed files with 13 additions and 5 deletions

View file

@ -11,6 +11,7 @@ import (
"testing"
"github.com/drone/drone/mock"
"github.com/drone/drone/version"
"github.com/golang/mock/gomock"
"github.com/h2non/gock"
)
@ -64,21 +65,21 @@ var sample = `{
"points": [[915148800, 10]],
"type": "gauge",
"host": "test.example.com",
"tags": ["remote:github:cloud","scheduler:internal:agents","license:trial"]
"tags": ["version:` + version.Version.String() + `","remote:github:cloud","scheduler:internal:agents","license:trial"]
},
{
"metric": "drone.repos",
"points": [[915148800, 20]],
"type": "gauge",
"host": "test.example.com",
"tags": ["remote:github:cloud","scheduler:internal:agents","license:trial"]
"tags": ["version:` + version.Version.String() + `","remote:github:cloud","scheduler:internal:agents","license:trial"]
},
{
"metric": "drone.builds",
"points": [[915148800, 30]],
"type": "gauge",
"host": "test.example.com",
"tags": ["remote:github:cloud","scheduler:internal:agents","license:trial"]
"tags": ["version:` + version.Version.String() + `","remote:github:cloud","scheduler:internal:agents","license:trial"]
}
]
}`

View file

@ -6,10 +6,17 @@
package sink
import "fmt"
import (
"fmt"
"github.com/drone/drone/version"
)
func createTags(config Config) []string {
var tags []string
tags := []string{
fmt.Sprintf("version:%s", version.Version),
}
switch {
case config.EnableBitbucket:
tags = append(tags, "remote:bitbucket:cloud")