/usr/share/gocode/src/github.com/influxdb/enterprise-client/v1/usage_test.go is in golang-github-influxdb-enterprise-client-dev 0.0~git20151113.0.25665cb-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | package client_test
import (
"fmt"
"io/ioutil"
"testing"
"github.com/influxdb/enterprise-client/v1"
"github.com/stretchr/testify/require"
)
func Test_Usage_Path(t *testing.T) {
r := require.New(t)
u := client.Usage{Product: "influxdb"}
r.Equal("/usage/influxdb", u.Path())
}
// Example of saving Usage data to Enterprise
func Example_saveUsage() {
c := client.New("token-goes-here")
// override the URL for testing
c.URL = "https://enterprise.staging.influxdata.com"
u := client.Usage{
Product: "influxdb",
Data: []client.UsageData{
{
Tags: client.Tags{
"version": "0.9.5",
"arch": "amd64",
"os": "linux",
},
Values: client.Values{
"cluster_id": "23423",
"server_id": "1",
"num_databases": 3,
"num_measurements": 2342,
"num_series": 87232,
},
},
},
}
res, err := c.Save(u)
fmt.Printf("err: %s\n", err)
b, _ := ioutil.ReadAll(res.Body)
fmt.Printf("b: %s\n", b)
}
|