/usr/share/gocode/src/github.com/influxdata/influxdb/stress/v2/statement/influxql.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 59 60 61 62 63 64 65 66 67 68 69 | package statement
import (
"log"
"time"
"github.com/influxdata/influxdb/stress/v2/stress_client"
)
// InfluxqlStatement is a Statement Implementation that allows statements that parse in InfluxQL to be passed directly to the target instance
type InfluxqlStatement struct {
StatementID string
Query string
Tracer *stressClient.Tracer
}
func (i *InfluxqlStatement) tags() map[string]string {
tags := make(map[string]string)
return tags
}
// SetID statisfies the Statement Interface
func (i *InfluxqlStatement) SetID(s string) {
i.StatementID = s
}
// Run statisfies the Statement Interface
func (i *InfluxqlStatement) Run(s *stressClient.StressTest) {
// Set the tracer
i.Tracer = stressClient.NewTracer(i.tags())
// Make the Package
p := stressClient.NewPackage(stressClient.Query, []byte(i.Query), i.StatementID, i.Tracer)
// Increment the tracer
i.Tracer.Add(1)
// Send the Package
s.SendPackage(p)
// Wait for all operations to finish
i.Tracer.Wait()
}
// Report statisfies the Statement Interface
// No test coverage, fix
func (i *InfluxqlStatement) Report(s *stressClient.StressTest) (out string) {
allData := s.GetStatementResults(i.StatementID, "query")
iqlr := &influxQlReport{
statement: i.Query,
columns: allData[0].Series[0].Columns,
values: allData[0].Series[0].Values,
}
iqlr.responseTime = time.Duration(responseTimes(iqlr.columns, iqlr.values)[0].Value)
switch countSuccesses(iqlr.columns, iqlr.values) {
case 0:
iqlr.success = false
case 1:
iqlr.success = true
default:
log.Fatal("Error fetching response for InfluxQL statement")
}
return iqlr.String()
}
|