Skip to content

Add support for Kestrel ConnectionFilters - #109

Merged
mikeharder merged 9 commits into
devfrom
mikeharder/connectionfilter
Aug 1, 2016
Merged

mikeharder merged 9 commits into
devfrom
mikeharder/connectionfilter

Conversation

@mikeharder

Copy link
Copy Markdown
Contributor
  • Add connectionFilter option to Benchmarks and automation
  • Add class Benchmarks.PassthroughConnectionFilter which just wraps the previous stream in a passthrough stream
  • Add scenario for Plaintext with PassthroughConnectionFilter to makefile.shade target run by CI machine

@halter73, @DamianEdwards, @nathana1, @rynowak

Comment thread src/Benchmarks/Program.cs Outdated
private static IConnectionFilter GetConnectionFilter(IConfigurationRoot config, IConnectionFilter prevFilter)
{
var connectionFilterValue = config["connectionFilter"];
if (String.IsNullOrEmpty(connectionFilterValue))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: lowercase S (we changed to that style)

Comment thread src/Benchmarks/Program.cs
}
else
{
var connectionFilterType = Type.GetType(connectionFilterValue, throwOnError: true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you envision us having different connection filters with no arguments? Why not make it a boolean flag? On or off?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could see us testing other connection filters like Logging, or a dev may want to add a custom connection filter to a branch of Benchmarks and test that. Making the connection filter a type string gives more flexibility without needing to change the BenchmarksDriver or BenchmarksServer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The problem is that those connection filters are non trivial to create as they have arguments. You'll end up hard coding the construction of specific filters. For example, logging https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Microsoft.AspNetCore.Server.Kestrel/Filter/LoggingConnectionFilter.cs, you'd have a pass an ILogger and for SSL https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Microsoft.AspNetCore.Server.Kestrel.Https/HttpsConnectionFilter.cs, you need to pass options. That's why the extension methods exist.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Benchmarking the logging filter probably isn't too important. HTTPS is handled by another PR. We can always change it later, but I think this is fine for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

While I agree we may never actually use this to test another connection filter, it seems like a better design than adding a very specific parameter (and column in SQL) like "passthroughConnectionFilter".

@rynowak

rynowak commented Aug 1, 2016

Copy link
Copy Markdown
Contributor

:shipit: - all my feedback here is pretty minor and all about how to approach our future needs

@mikeharder
mikeharder merged commit dfc3cd6 into dev Aug 1, 2016
@mikeharder
mikeharder deleted the mikeharder/connectionfilter branch August 1, 2016 18:52
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.

5 participants