Skip to content

Commit

Permalink
Fix spelling of per second (#2055)
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
  • Loading branch information
aknuds1 authored May 8, 2020
1 parent 4d5c278 commit d975b1f
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 113 deletions.
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,9 @@ The example belows show all possible statistics returned with their respective d
"totalDuplicates": 0 // Total of duplicates removed from replication
},
"summary": {
"bytesProcessedPerSeconds": 0, // Total of bytes processed per second
"bytesProcessedPerSecond": 0, // Total of bytes processed per second
"execTime": 0, // Total execution time in seconds (float)
"linesProcessedPerSeconds": 0, // Total lines processed per second
"linesProcessedPerSecond": 0, // Total lines processed per second
"totalBytesProcessed":0, // Total amount of bytes processed overall for this request
"totalLinesProcessed":0 // Total amount of lines processed overall for this request
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/logql/marshal/legacy/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ var queryTests = []struct {
"totalDuplicates": 0
},
"summary": {
"bytesProcessedPerSeconds": 0,
"bytesProcessedPerSecond": 0,
"execTime": 0,
"linesProcessedPerSeconds": 0,
"linesProcessedPerSecond": 0,
"totalBytesProcessed":0,
"totalLinesProcessed":0
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/logql/marshal/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ var queryTests = []struct {
"totalDuplicates": 0
},
"summary": {
"bytesProcessedPerSeconds": 0,
"bytesProcessedPerSecond": 0,
"execTime": 0,
"linesProcessedPerSeconds": 0,
"linesProcessedPerSecond": 0,
"totalBytesProcessed":0,
"totalLinesProcessed":0
}
Expand Down Expand Up @@ -169,9 +169,9 @@ var queryTests = []struct {
"totalDuplicates": 0
},
"summary": {
"bytesProcessedPerSeconds": 0,
"bytesProcessedPerSecond": 0,
"execTime": 0,
"linesProcessedPerSeconds": 0,
"linesProcessedPerSecond": 0,
"totalBytesProcessed":0,
"totalLinesProcessed":0
}
Expand Down Expand Up @@ -282,9 +282,9 @@ var queryTests = []struct {
"totalDuplicates": 0
},
"summary": {
"bytesProcessedPerSeconds": 0,
"bytesProcessedPerSecond": 0,
"execTime": 0,
"linesProcessedPerSeconds": 0,
"linesProcessedPerSecond": 0,
"totalBytesProcessed":0,
"totalLinesProcessed":0
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/logql/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
)

var (
bytesPerSeconds = promauto.NewHistogramVec(prometheus.HistogramOpts{
bytesPerSecond = promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "loki",
Name: "logql_querystats_bytes_processed_per_seconds",
Help: "Distribution of bytes processed per second for LogQL queries.",
Expand Down Expand Up @@ -87,12 +87,12 @@ func RecordMetrics(ctx context.Context, p Params, status string, stats stats.Res
"step", p.Step(),
"duration", time.Duration(int64(stats.Summary.ExecTime*float64(time.Second))),
"status", status,
"throughput_mb", float64(stats.Summary.BytesProcessedPerSeconds)/10e6,
"throughput_mb", float64(stats.Summary.BytesProcessedPerSecond)/10e6,
"total_bytes_mb", float64(stats.Summary.TotalBytesProcessed)/10e6,
)

bytesPerSeconds.WithLabelValues(status, queryType, rt, latencyType).
Observe(float64(stats.Summary.BytesProcessedPerSeconds))
bytesPerSecond.WithLabelValues(status, queryType, rt, latencyType).
Observe(float64(stats.Summary.BytesProcessedPerSecond))
execLatency.WithLabelValues(status, queryType, rt).
Observe(stats.Summary.ExecTime)
chunkDownloadLatency.WithLabelValues(status, queryType, rt).
Expand Down
6 changes: 3 additions & 3 deletions pkg/logql/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func TestLogSlowQuery(t *testing.T) {
step: time.Minute,
}, "200", stats.Result{
Summary: stats.Summary{
BytesProcessedPerSeconds: 100000,
ExecTime: 25.25,
TotalBytesProcessed: 100000,
BytesProcessedPerSecond: 100000,
ExecTime: 25.25,
TotalBytesProcessed: 100000,
},
})
require.Equal(t,
Expand Down
8 changes: 4 additions & 4 deletions pkg/logql/stats/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (r Result) Log(log log.Logger) {

func (s Summary) Log(log log.Logger) {
_ = log.Log(
"Summary.BytesProcessedPerSeconds", humanize.Bytes(uint64(s.BytesProcessedPerSeconds)),
"Summary.LinesProcessedPerSeconds", s.LinesProcessedPerSeconds,
"Summary.BytesProcessedPerSecond", humanize.Bytes(uint64(s.BytesProcessedPerSecond)),
"Summary.LinesProcessedPerSecond", s.LinesProcessedPerSecond,
"Summary.TotalBytesProcessed", humanize.Bytes(uint64(s.TotalBytesProcessed)),
"Summary.TotalLinesProcessed", s.TotalLinesProcessed,
"Summary.ExecTime", time.Duration(int64(s.ExecTime*float64(time.Second))),
Expand Down Expand Up @@ -170,10 +170,10 @@ func (r *Result) ComputeSummary(execTime time.Duration) {
r.Ingester.DecompressedLines + r.Ingester.HeadChunkLines
r.Summary.ExecTime = execTime.Seconds()
if execTime != 0 {
r.Summary.BytesProcessedPerSeconds =
r.Summary.BytesProcessedPerSecond =
int64(float64(r.Summary.TotalBytesProcessed) /
execTime.Seconds())
r.Summary.LinesProcessedPerSeconds =
r.Summary.LinesProcessedPerSecond =
int64(float64(r.Summary.TotalLinesProcessed) /
execTime.Seconds())
}
Expand Down
30 changes: 15 additions & 15 deletions pkg/logql/stats/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ func TestSnapshot(t *testing.T) {
TotalDuplicates: 10,
},
Summary: Summary{
ExecTime: 2 * time.Second.Seconds(),
BytesProcessedPerSeconds: int64(42),
LinesProcessedPerSeconds: int64(50),
TotalBytesProcessed: int64(84),
TotalLinesProcessed: int64(100),
ExecTime: 2 * time.Second.Seconds(),
BytesProcessedPerSecond: int64(42),
LinesProcessedPerSecond: int64(50),
TotalBytesProcessed: int64(84),
TotalLinesProcessed: int64(100),
},
}
require.Equal(t, expected, res)
Expand Down Expand Up @@ -116,11 +116,11 @@ func TestResult_Merge(t *testing.T) {
TotalDuplicates: 10,
},
Summary: Summary{
ExecTime: 2 * time.Second.Seconds(),
BytesProcessedPerSeconds: int64(42),
LinesProcessedPerSeconds: int64(50),
TotalBytesProcessed: int64(84),
TotalLinesProcessed: int64(100),
ExecTime: 2 * time.Second.Seconds(),
BytesProcessedPerSecond: int64(42),
LinesProcessedPerSecond: int64(50),
TotalBytesProcessed: int64(84),
TotalLinesProcessed: int64(100),
},
}

Expand Down Expand Up @@ -154,11 +154,11 @@ func TestResult_Merge(t *testing.T) {
TotalDuplicates: 2 * 10,
},
Summary: Summary{
ExecTime: 2 * 2 * time.Second.Seconds(),
BytesProcessedPerSeconds: int64(42), // 2 requests at the same pace should give the same bytes/lines per sec
LinesProcessedPerSeconds: int64(50),
TotalBytesProcessed: 2 * int64(84),
TotalLinesProcessed: 2 * int64(100),
ExecTime: 2 * 2 * time.Second.Seconds(),
BytesProcessedPerSecond: int64(42), // 2 requests at the same pace should give the same bytes/lines per sec
LinesProcessedPerSecond: int64(50),
TotalBytesProcessed: 2 * int64(84),
TotalLinesProcessed: 2 * int64(100),
},
}, res)

Expand Down
Loading

0 comments on commit d975b1f

Please sign in to comment.