Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong name tag for HTTP metrics from redirects #1474

Closed
na-- opened this issue May 29, 2020 · 1 comment · Fixed by #1570
Closed

Wrong name tag for HTTP metrics from redirects #1474

na-- opened this issue May 29, 2020 · 1 comment · Fixed by #1570
Assignees
Milestone

Comments

@na--
Copy link
Member

na-- commented May 29, 2020

When you make HTTP requests with redirects, the name tag in the generated metrics is wrong - it contains the original URL... For example, if you run the following script:

import http from 'k6/http';

export default function () {
    http.get("https://httpbin.test.k6.io/redirect-to?url=https%3A%2F%2Fhttpbin.test.k6.io%2Fanything");
}

with k6 run --out json=results.json script.js, and then filter the generated metrics with to get the url tags with jq '. | select(.type=="Point" and .metric == "http_reqs") | .data.tags.url' results.json, you'd get this:

"https://httpbin.test.k6.io/redirect-to?url=https%3A%2F%2Fhttpbin.test.k6.io%2Fanything"
"https://httpbin.test.k6.io/anything"

which is perfectly fine, but if you get the name tag with jq '. | select(.type=="Point" and .metric == "http_reqs") | .data.tags.name' results.json, you'd get:

"https://httpbin.test.k6.io/redirect-to?url=https%3A%2F%2Fhttpbin.test.k6.io%2Fanything"
"https://httpbin.test.k6.io/redirect-to?url=https%3A%2F%2Fhttpbin.test.k6.io%2Fanything"

If we had explicitly specified such a name tag, or anything other in the http.get() params, it would be fine. But in this case, the result of these 2 commands should have been identical...

The consequence of this in the cloud is even worse, since the name tag is used for request grouping, it looks like this:
Screenshot_2020-05-29 Test run 739754 - app k6 io

@na-- na-- modified the milestones: v0.27.0, v0.28.0 May 29, 2020
@na-- na-- modified the milestones: v0.28.0, v0.27.1 Jul 21, 2020
@imiric imiric self-assigned this Jul 21, 2020
imiric pushed a commit that referenced this issue Jul 23, 2020
Closes #1474

The root cause was reusing the same 'name' tag for all requests
processed by a transport. In the case of redirects and digest auth the
transport would process more than one request and needs to update the
'name' tag in the same way as 'url' is, but only for the initial
request, as subsequent ones will by dynamically generated.
@na-- na-- modified the milestones: v0.27.1, v0.28.0 Jul 27, 2020
@na--
Copy link
Member Author

na-- commented Jul 27, 2020

Moved it back to v0.28.0, since the fix turned out to be more tricky than expected, and blurred the line between a bugfix and a minor breaking change... 😞

imiric pushed a commit that referenced this issue Sep 4, 2020
Closes #1474

The root cause was reusing the same 'name' tag for all requests
processed by a transport. In the case of redirects and digest auth the
transport would process more than one request and needs to update the
'name' tag in the same way as 'url' is, but only for the initial
request, as subsequent ones will by dynamically generated.
imiric pushed a commit that referenced this issue Sep 4, 2020
Closes #1474

The root cause was reusing the same 'name' tag for all requests
processed by a transport. In the case of redirects and digest auth the
transport would process more than one request and needs to update the
'name' tag in the same way as 'url' is, but only for the initial
request, as subsequent ones will by dynamically generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants