-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stempler-feat/counter-only-relabels (#128)'
- Loading branch information
Showing
8 changed files
with
111 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Feature: Config file allows relabeling that only apply to the request counter | ||
|
||
Scenario: Labels are added request counter | ||
Given a running exporter listening with configuration file "test-configuration-only-counter-relabel.hcl" | ||
When the following HTTP request is logged to "access.log" | ||
""" | ||
172.17.0.1 - - [23/Jun/2016:16:04:20 +0000] "GET /users HTTP/1.1" 200 612 "-" "curl/7.29.0" "-" 10 10 | ||
172.17.0.1 - foo [23/Jun/2016:16:04:20 +0000] "GET /groups HTTP/1.1" 200 518 "-" "curl/7.29.0" "-" 10 10 | ||
""" | ||
Then the exporter should report value 1 for metric nginx_http_response_count_total{method="GET",path="/groups",status="200",user="foo"} | ||
And the exporter should report value 1 for metric nginx_http_response_count_total{method="GET",path="/users",status="200",user="other"} | ||
|
||
Scenario: Labels are not add added to size counter | ||
Given a running exporter listening with configuration file "test-configuration-only-counter-relabel.hcl" | ||
When the following HTTP request is logged to "access.log" | ||
""" | ||
172.17.0.1 - - [23/Jun/2016:16:04:20 +0000] "GET /users HTTP/1.1" 200 612 "-" "curl/7.29.0" "-" 10 10 | ||
172.17.0.1 - foo [23/Jun/2016:16:04:20 +0000] "GET /groups HTTP/1.1" 200 518 "-" "curl/7.29.0" "-" 10 10 | ||
""" | ||
Then the exporter should report value 518 for metric nginx_http_response_size_bytes{method="GET",status="200",user="foo"} | ||
And the exporter should report value 612 for metric nginx_http_response_size_bytes{method="GET",status="200",user="other"} | ||
|
||
Scenario: Labels are not add added to histograms or summaries | ||
Given a running exporter listening with configuration file "test-configuration-only-counter-relabel.hcl" | ||
When the following HTTP request is logged to "access.log" | ||
""" | ||
172.17.0.1 - - [23/Jun/2016:16:04:20 +0000] "GET /users HTTP/1.1" 200 612 "-" "curl/7.29.0" "-" 10 10 | ||
172.17.0.1 - foo [23/Jun/2016:16:04:20 +0000] "GET /groups HTTP/1.1" 200 518 "-" "curl/7.29.0" "-" 10 10 | ||
""" | ||
Then the exporter should report value 1 for metric nginx_http_upstream_time_seconds_hist_count{method="GET",status="200",user="foo"} | ||
And the exporter should report value 1 for metric nginx_http_upstream_time_seconds_hist_count{method="GET",status="200",user="other"} | ||
And the exporter should report value 1 for metric nginx_http_upstream_time_seconds_count{method="GET",status="200",user="foo"} | ||
And the exporter should report value 1 for metric nginx_http_upstream_time_seconds_count{method="GET",status="200",user="other"} | ||
And the exporter should report value 1 for metric nginx_http_response_time_seconds_hist_count{method="GET",status="200",user="foo"} | ||
And the exporter should report value 1 for metric nginx_http_response_time_seconds_hist_count{method="GET",status="200",user="other"} | ||
And the exporter should report value 1 for metric nginx_http_response_time_seconds_count{method="GET",status="200",user="foo"} | ||
And the exporter should report value 1 for metric nginx_http_response_time_seconds_count{method="GET",status="200",user="other"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
port = 4040 | ||
enable_experimental = true | ||
|
||
namespace "nginx" { | ||
source { | ||
files = [".behave-sandbox/access.log"] | ||
} | ||
format = "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\" $request_time $upstream_response_time" | ||
|
||
relabel "user" { | ||
from = "remote_user" | ||
whitelist = ["foo", "bar"] | ||
} | ||
|
||
relabel "path" { | ||
from = "request" | ||
split = 2 | ||
|
||
only_counter = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters