Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ssncferreira committed Feb 2, 2022
1 parent 230b103 commit d422760
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clients/pkg/logentry/stages/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ func getFloat(unk interface{}) (float64, error) {
// getFloatFromString converts string into float64
// Two types of string formats are supported:
// * strings that represent floating point numbers, e.g., "0.804"
// * duration format strings, e.g., "0.5ms", "10d".
// * duration format strings, e.g., "0.5ms", "10h".
// Valid time units are "ns", "us", "ms", "s", "m", "h".
// Values in this format are converted as a floating point number of seconds.
// E.g., "0.5ms" is converted to 0.0005
func getFloatFromString(str string) (float64, error) {
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func TestMetricStage_Process(t *testing.T) {
"contains_false": "contains(keys(@),'nope')",
},
}
regexLogFixture := `11.11.11.11 - frank [25/Jan/2000:14:00:01 -0500] "GET /1986.js HTTP/1.1" 200 932ms"`
regexHTTPFixture := `11.11.11.11 - frank [25/Jan/2000:14:00:01 -0500] "GET /1986.js HTTP/1.1" 200 932ms"`
regexConfig := map[string]interface{}{
"expression": "(?P<get>\"GET).*HTTP/1.1\" (?P<status>\\d*) (?P<time>\\d*ms)",
}
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestMetricStage_Process(t *testing.T) {
t.Fatalf("failed to create stage with metrics: %v", err)
}
out := processEntries(jsonStage, newEntry(nil, labelFoo, logFixture, time.Now()))
out[0].Line = regexLogFixture
out[0].Line = regexHTTPFixture
out = processEntries(regexStage, out...)
out = processEntries(metricStage, out...)
out[0].Labels = labelFu
Expand Down

0 comments on commit d422760

Please sign in to comment.