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

Add streams support in Generic Journey #279

Merged
merged 5 commits into from
Aug 11, 2022

Conversation

dmlemeshko
Copy link
Member

Summary

Updating GenericJourney in order to support new JSON structure and be able to run requests in parallel.

This PR comes along with elastic/kibana/pull/138263 and can be tested as soon as this one is merged.

Checklist

Delete any items that are not applicable to this PR.

  • Branch is successfully tested on Kibana CI
  • Unit tests are added

.disableFollowRedirect
// Mimic real Chrome browser
.maxConnectionsPerHostLikeChrome
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatling should allow up to 6 connections per host name by default, but I thought it is better to use Chrome value for visibility. But it basically changes nothing https://github.com/gatling/gatling/blob/045603bc5c9d4466cb97d1e54902451f9b18dadd/gatling-http/src/main/scala/io/gatling/http/protocol/HttpProtocolBuilder.scala#L108

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea but I wonder whether we should use it as it's a deprecated property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny I missed that comment. I will just remove it, let's use the default value

@dmlemeshko dmlemeshko self-assigned this Aug 8, 2022
Comment on lines 113 to 117
val pauseDuration =
Math.max(0L, request.timestamp.getTime - priorTimestamp.getTime)
Math.max(0L, stream.startTime.getTime - priorDate.getTime)
if (pauseDuration > 0L) {
steps = steps.pause(pauseDuration.toString, TimeUnit.MILLISECONDS)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope that using previous stream end time (point in time when the last request was finished) and the next stream start time (point in time when the first request was started) difference is valid for pause between requests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

@@ -59,26 +59,27 @@ object ApiCall {
if (request.headers.contains("Kbn-Version"))
defaultHeaders + ("Kbn-Version" -> config.version)
else defaultHeaders
val path = request.path.replaceAll(".+?(?=\\/bundles)", "");
Copy link
Member Author

@dmlemeshko dmlemeshko Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since from build to build full path for bundles will have different prefix (sequence of digits), I think it is better to cut digits part and make it consistent in report. thoughts?

> GET /bundles/plugin/kibanaOverview/kibana/kibanaOverv... (OK=17     KO=0     )
> GET /bundles/plugin/newsfeed/kibana/newsfeed.plugin.j... (OK=17     KO=0     )
> GET /bundles/plugin/ux/8.0.0/ux.plugin.js                (OK=17     KO=0     )

Alternatively, the full one is /9007199254740991/bundles/plugin/security/8.0.0/security.plugin.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your suggestion makes sense to me as it keeps paths consistent over time. We could probably pick a different name for path to convey that this is only used for reporting and not the actual full request path used on the wire.

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a few suggestions.

.disableFollowRedirect
// Mimic real Chrome browser
.maxConnectionsPerHostLikeChrome
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea but I wonder whether we should use it as it's a deprecated property?

config: KibanaConfiguration
): ChainBuilder = {
val defaultHeaders = request.headers.-(
// Workaround for https://github.com/gatling/gatling/issues/3783
val httpParentRequest = httpRequest(requests(0).http, config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using array indices we could also use .head and .tail which would improve readability IMHO.

@@ -59,26 +59,27 @@ object ApiCall {
if (request.headers.contains("Kbn-Version"))
defaultHeaders + ("Kbn-Version" -> config.version)
else defaultHeaders
val path = request.path.replaceAll(".+?(?=\\/bundles)", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your suggestion makes sense to me as it keeps paths consistent over time. We could probably pick a different name for path to convey that this is only used for reporting and not the actual full request path used on the wire.

Comment on lines 113 to 117
val pauseDuration =
Math.max(0L, request.timestamp.getTime - priorTimestamp.getTime)
Math.max(0L, stream.startTime.getTime - priorDate.getTime)
if (pauseDuration > 0L) {
steps = steps.pause(pauseDuration.toString, TimeUnit.MILLISECONDS)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating. The changes look fine to me. I left one nit but no need for another review round.

val defaultHeaders = request.headers.-(
// Workaround for https://github.com/gatling/gatling/issues/3783
val httpParentRequest = httpRequest(requests.head.http, config)
val children = requests.drop(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: You can use .tail here.

@dmlemeshko
Copy link
Member Author

I'm merging this PR and will address #281 in a separate effort and it requires some investigation and extra testing. We still can run without static bundle requests and do not face Java heap space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants