Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf67beca

Browse files
[release/9.0] Readd DiagnosticSource to KestrelServerImpl (#60202)
* Readd DiagnosticSource to KestrelServerImpl* null---------Co-authored-by: Brennan <brecon@microsoft.com>
1 parent8b2b207 commitf67beca

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

‎src/Servers/Kestrel/Core/src/Internal/KestrelServerImpl.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public KestrelServerImpl(
3939
IEnumerable<IMultiplexedConnectionListenerFactory>multiplexedFactories,
4040
IHttpsConfigurationServicehttpsConfigurationService,
4141
ILoggerFactoryloggerFactory,
42+
DiagnosticSource?diagnosticSource,
4243
KestrelMetricsmetrics)
43-
:this(transportFactories,multiplexedFactories,httpsConfigurationService,CreateServiceContext(options,loggerFactory,diagnosticSource:null,metrics))
44+
:this(transportFactories,multiplexedFactories,httpsConfigurationService,CreateServiceContext(options,loggerFactory,diagnosticSource,metrics))
4445
{
4546
}
4647

@@ -111,7 +112,8 @@ private static ServiceContext CreateServiceContext(IOptions<KestrelServerOptions
111112

112113
publicKestrelServerOptionsOptions=>ServiceContext.ServerOptions;
113114

114-
privateServiceContextServiceContext{get;}
115+
// Internal for testing
116+
internalServiceContextServiceContext{get;}
115117

116118
privateKestrelTraceTrace=>ServiceContext.Log;
117119

‎src/Servers/Kestrel/Core/src/KestrelServer.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public KestrelServer(IOptions<KestrelServerOptions> options, IConnectionListener
3636
Array.Empty<IMultiplexedConnectionListenerFactory>(),
3737
newSimpleHttpsConfigurationService(),
3838
loggerFactory,
39+
diagnosticSource:null,
3940
newKestrelMetrics(newDummyMeterFactory()));
4041
}
4142

‎src/Servers/Kestrel/Core/test/KestrelServerTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ private static KestrelServerImpl CreateKestrelServer(
309309
multiplexedFactories,
310310
httpsConfigurationService,
311311
loggerFactory??newLoggerFactory(new[]{newKestrelTestLoggerProvider()}),
312+
diagnosticSource:null,
312313
metrics??newKestrelMetrics(newTestMeterFactory()));
313314
}
314315

‎src/Servers/Kestrel/Kestrel/test/WebHostBuilderKestrelExtensionsTests.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
usingSystem.Collections;
5+
usingSystem.IO.Pipelines;
56
usingMicrosoft.AspNetCore.Connections;
67
usingMicrosoft.AspNetCore.Hosting;
78
usingMicrosoft.AspNetCore.Hosting.Server;
89
usingMicrosoft.AspNetCore.Server.Kestrel.Core;
10+
usingMicrosoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
911
usingMicrosoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.Internal;
1012
usingMicrosoft.AspNetCore.Server.Kestrel.Transport.Sockets;
1113
usingMicrosoft.Extensions.DependencyInjection;
@@ -107,6 +109,11 @@ public void ServerIsKestrelServerImpl()
107109
.UseKestrel()
108110
.Configure(app=>{});
109111

110-
Assert.IsType<KestrelServerImpl>(hostBuilder.Build().Services.GetService<IServer>());
112+
varserver=Assert.IsType<KestrelServerImpl>(hostBuilder.Build().Services.GetService<IServer>());
113+
114+
Assert.NotNull(server.ServiceContext.DiagnosticSource);
115+
Assert.IsType<KestrelMetrics>(server.ServiceContext.Metrics);
116+
Assert.Equal(PipeScheduler.ThreadPool,server.ServiceContext.Scheduler);
117+
Assert.Equal(TimeProvider.System,server.ServiceContext.TimeProvider);
111118
}
112119
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp