This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/tests/urlgen/urlgen.go is in golang-github-influxdb-influxdb-dev 1.1.1+dfsg1-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
49
50
51
52
53
54
55
56
57
58
package main

import (
	"encoding/json"
	"flag"
	"fmt"
	"time"
)

func main() {
	var (
		intervalN = flag.Int("interval", 10, "interval")
		seriesN   = flag.Int("series", 1, "Number of unique series to generate.")
		clientN   = flag.Int("clients", 10, "Number of clients to simulate.")
		host      = flag.String("host", "localhost:8086", "Target host")
	)
	flag.Parse()

	// Calculate time so that the last point ends now.
	n := (*clientN) * (*seriesN) * (*intervalN)
	t := time.Now().UTC().Add(-time.Duration(n) * time.Second)

	for i := 0; i < *clientN; i++ {
		for j := 0; j < *seriesN; j++ {
			points := make([]*Point, 0)
			for k := 0; k < *intervalN; k++ {
				t = t.Add(1 * time.Second)
				points = append(points, &Point{
					Measurement: "cpu",
					Time:        t,
					Tags:        map[string]string{"host": fmt.Sprintf("server%d", j+1)},
					Fields:      map[string]interface{}{"value": 100},
				})
			}
			batch := &Batch{
				Database:        "db",
				RetentionPolicy: "raw",
				Points:          points,
			}
			buf, _ := json.Marshal(batch)

			fmt.Printf("http://%s/write POST %s\n", *host, buf)
		}
	}
}

type Batch struct {
	Database        string   `json:"database"`
	RetentionPolicy string   `json:"retentionPolicy"`
	Points          []*Point `json:"points"`
}

type Point struct {
	Measurement string                 `json:"measurement"`
	Time        time.Time              `json:"time"`
	Tags        map[string]string      `json:"tags"`
	Fields      map[string]interface{} `json:"fields"`
}