Skip to content

Commit

Permalink
Fix typos (#4070)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Taillefer <mataille@microsoft.com>
  • Loading branch information
geeknoid and Martin Taillefer authored Jun 13, 2023
1 parent 2826b86 commit 3b66871
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public class HttpClientLatencyTelemetryOptions
/// <remarks>
/// Detailed breakdowns add checkpoints for HTTP operations, such as connection open and request headers sent.
/// </remarks>
public bool EnableDetailedLatencyBreadkdown { get; set; } = true;
public bool EnableDetailedLatencyBreakdown { get; set; } = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public HttpLatencyTelemetryHandler(HttpRequestLatencyListener latencyListener, I
_handlerStart = tokenIssuer.GetCheckpointToken(HttpCheckpoints.HandlerRequestStart);
_applicationName = appMetdata.Value.ApplicationName;

if (telemetryOptions.EnableDetailedLatencyBreadkdown)
if (telemetryOptions.EnableDetailedLatencyBreakdown)
{
_latencyListener.Enable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"Properties": [
{
"Member": "bool Microsoft.Extensions.Http.Telemetry.Latency.HttpClientLatencyTelemetryOptions.EnableDetailedLatencyBreadkdown { get; set; }",
"Member": "bool Microsoft.Extensions.Http.Telemetry.Latency.HttpClientLatencyTelemetryOptions.EnableDetailedLatencyBreakdown { get; set; }",
"Stage": "Stable"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal sealed class LatencyConsoleExporter : ILatencyDataExporter
private readonly bool _outputMeasures;
private long _sampleCount = -1;

public LatencyConsoleExporter(IOptions<LarencyConsoleOptions> options)
public LatencyConsoleExporter(IOptions<LatencyConsoleOptions> options)
{
var o = options.Value;
_outputCheckpoints = o.OutputCheckpoints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl
{
_ = Throw.IfNull(services);

_ = services.AddOptions<LarencyConsoleOptions>();
_ = services.AddOptions<LatencyConsoleOptions>();
services.TryAddSingleton<ILatencyDataExporter, LatencyConsoleExporter>();

return services;
Expand All @@ -36,10 +36,10 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl
/// Add latency data exporter for the console.
/// </summary>
/// <param name="services">Dependency injection container.</param>
/// <param name="configure"><see cref="LarencyConsoleOptions"/> configuration delegate.</param>
/// <param name="configure"><see cref="LatencyConsoleOptions"/> configuration delegate.</param>
/// <returns>Provided service collection with <see cref="LatencyConsoleExporter"/> added.</returns>
/// <exception cref="ArgumentNullException">Either <paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.</exception>
public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceCollection services, Action<LarencyConsoleOptions> configure)
public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceCollection services, Action<LatencyConsoleOptions> configure)
{
_ = Throw.IfNull(services);
_ = Throw.IfNull(configure);
Expand All @@ -53,10 +53,10 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl
/// Add latency data exporter for the console.
/// </summary>
/// <param name="services">Dependency injection container.</param>
/// <param name="section">Configuration of <see cref="LarencyConsoleOptions"/>.</param>
/// <param name="section">Configuration of <see cref="LatencyConsoleOptions"/>.</param>
/// <returns>Provided service collection with <see cref="LatencyConsoleExporter"/> added.</returns>
/// <exception cref="ArgumentNullException">Either <paramref name="services"/> or <paramref name="section"/> is <see langword="null"/>.</exception>
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LarencyConsoleOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LatencyConsoleOptions))]
[UnconditionalSuppressMessage(
"Trimming",
"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code",
Expand All @@ -66,7 +66,7 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl
_ = Throw.IfNull(services);
_ = Throw.IfNull(section);

_ = services.Configure<LarencyConsoleOptions>(section);
_ = services.Configure<LatencyConsoleOptions>(section);

return AddConsoleLatencyDataExporter(services);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.Extensions.Telemetry.Console;
/// <summary>
/// Options for console latency data exporter.
/// </summary>
public class LarencyConsoleOptions
public class LatencyConsoleOptions
{
/// <summary>
/// Gets or sets a value indicating whether to emit latency checkpoint information to the console.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"Name": "Microsoft.Extensions.Telemetry.Console, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Types": [
{
"Type": "class Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions",
"Type": "class Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions.LarencyConsoleOptions();",
"Member": "Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions.LatencyConsoleOptions();",
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "bool Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions.OutputCheckpoints { get; set; }",
"Member": "bool Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions.OutputCheckpoints { get; set; }",
"Stage": "Stable"
},
{
"Member": "bool Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions.OutputMeasures { get; set; }",
"Member": "bool Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions.OutputMeasures { get; set; }",
"Stage": "Stable"
},
{
"Member": "bool Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions.OutputTags { get; set; }",
"Member": "bool Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions.OutputTags { get; set; }",
"Stage": "Stable"
}
]
Expand All @@ -34,7 +34,7 @@
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Telemetry.Console.LatencyConsoleExtensions.AddConsoleLatencyDataExporter(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<Microsoft.Extensions.Telemetry.Console.LarencyConsoleOptions> configure);",
"Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Telemetry.Console.LatencyConsoleExtensions.AddConsoleLatencyDataExporter(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<Microsoft.Extensions.Telemetry.Console.LatencyConsoleOptions> configure);",
"Stage": "Stable"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void HttpClientLatencyTelemtry_AddToServiceCollection()

var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value;
Assert.NotNull(options);
Assert.True(options.EnableDetailedLatencyBreadkdown);
Assert.True(options.EnableDetailedLatencyBreakdown);

var handler = sp.GetRequiredService<HttpLatencyTelemetryHandler>();
Assert.NotNull(handler);
Expand Down Expand Up @@ -77,13 +77,13 @@ public void HttpClientLatencyTelemtryExtensions_Add_InvokesConfig()
.AddDefaultHttpClientLatencyTelemetry(a =>
{
invoked = true;
a.EnableDetailedLatencyBreadkdown = false;
a.EnableDetailedLatencyBreakdown = false;
})
.BuildServiceProvider();

var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value;
Assert.NotNull(options);
Assert.False(options.EnableDetailedLatencyBreadkdown);
Assert.False(options.EnableDetailedLatencyBreakdown);
Assert.True(invoked);
}

Expand All @@ -92,7 +92,7 @@ public void RequestLatencyExtensions_Add_BindsToConfigSection()
{
HttpClientLatencyTelemetryOptions expectedOptions = new()
{
EnableDetailedLatencyBreadkdown = false
EnableDetailedLatencyBreakdown = false
};

var config = GetConfigSection(expectedOptions);
Expand All @@ -103,15 +103,15 @@ public void RequestLatencyExtensions_Add_BindsToConfigSection()

var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value;
Assert.NotNull(options);
Assert.Equal(expectedOptions.EnableDetailedLatencyBreadkdown, options.EnableDetailedLatencyBreadkdown);
Assert.Equal(expectedOptions.EnableDetailedLatencyBreakdown, options.EnableDetailedLatencyBreakdown);
}

private static IConfigurationSection GetConfigSection(HttpClientLatencyTelemetryOptions options)
{
return new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
{ $"{nameof(HttpClientLatencyTelemetryOptions)}:{nameof(options.EnableDetailedLatencyBreadkdown)}", options.EnableDetailedLatencyBreadkdown.ToString(CultureInfo.InvariantCulture) },
{ $"{nameof(HttpClientLatencyTelemetryOptions)}:{nameof(options.EnableDetailedLatencyBreakdown)}", options.EnableDetailedLatencyBreakdown.ToString(CultureInfo.InvariantCulture) },
})
.Build()
.GetSection($"{nameof(HttpClientLatencyTelemetryOptions)}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void HttpLatencyTelemetryHandler_IfDetailsDisabled_DoesNotEnableListener(
var sop = new Mock<IOptions<ApplicationMetadata>>();
sop.Setup(a => a.Value).Returns(new ApplicationMetadata());
var hop = new Mock<IOptions<HttpClientLatencyTelemetryOptions>>();
hop.Setup(a => a.Value).Returns(new HttpClientLatencyTelemetryOptions { EnableDetailedLatencyBreadkdown = false });
hop.Setup(a => a.Value).Returns(new HttpClientLatencyTelemetryOptions { EnableDetailedLatencyBreakdown = false });
var lcti = HttpMockProvider.GetTokenIssuer();

using var listener = HttpMockProvider.GetListener(context, lcti.Object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task ConsoleExporter_Export_OutputsData()

var ld = GetLatencyData();

var options = Microsoft.Extensions.Options.Options.Create(new LarencyConsoleOptions
var options = Microsoft.Extensions.Options.Options.Create(new LatencyConsoleOptions
{
OutputCheckpoints = true,
OutputTags = true,
Expand All @@ -93,7 +93,7 @@ public async Task ConsoleExporter_Export_OutputsLongData()

var ld = GetLongLatencyData();

var options = Microsoft.Extensions.Options.Options.Create(new LarencyConsoleOptions
var options = Microsoft.Extensions.Options.Options.Create(new LatencyConsoleOptions
{
OutputCheckpoints = true,
OutputTags = true,
Expand All @@ -115,7 +115,7 @@ public async Task ConsoleExporter_Export_OutputsTruncatedData()

var ld = GetLatencyData();

var options = Microsoft.Extensions.Options.Options.Create(new LarencyConsoleOptions
var options = Microsoft.Extensions.Options.Options.Create(new LatencyConsoleOptions
{
OutputCheckpoints = false,
OutputTags = false,
Expand All @@ -137,7 +137,7 @@ public async Task ConsoleExporter_Export_OutputsEmptyData()

var ld = GetEmptyLatencyData();

var options = Microsoft.Extensions.Options.Options.Create(new LarencyConsoleOptions
var options = Microsoft.Extensions.Options.Options.Create(new LatencyConsoleOptions
{
OutputCheckpoints = true,
OutputTags = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void ConsoleExporterExtensions_Add_InvokesConfig()
[Fact]
public void ConsoleExporterExtensions_Add_BindsToConfigSection()
{
LarencyConsoleOptions expectedOptions = new()
LatencyConsoleOptions expectedOptions = new()
{
OutputTags = true
};
Expand All @@ -59,19 +59,19 @@ public void ConsoleExporterExtensions_Add_BindsToConfigSection()
using var provider = new ServiceCollection()
.AddConsoleLatencyDataExporter(config)
.BuildServiceProvider();
var actualOptions = provider.GetRequiredService<IOptions<LarencyConsoleOptions>>();
var actualOptions = provider.GetRequiredService<IOptions<LatencyConsoleOptions>>();

Assert.True(actualOptions.Value.OutputTags);
}

private static IConfigurationSection GetConfigSection(LarencyConsoleOptions options)
private static IConfigurationSection GetConfigSection(LatencyConsoleOptions options)
{
return new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
{ $"{nameof(LarencyConsoleOptions)}:{nameof(options.OutputTags)}", options.OutputTags.ToString(null) },
{ $"{nameof(LatencyConsoleOptions)}:{nameof(options.OutputTags)}", options.OutputTags.ToString(null) },
})
.Build()
.GetSection($"{nameof(LarencyConsoleOptions)}");
.GetSection($"{nameof(LatencyConsoleOptions)}");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class LatencyConsoleOptionsTests
[Fact]
public void ConsoleExporterOptions_BasicTest()
{
var o = new LarencyConsoleOptions();
var o = new LatencyConsoleOptions();
Assert.True(o.OutputCheckpoints);
Assert.True(o.OutputTags);
Assert.True(o.OutputMeasures);
Expand Down

0 comments on commit 3b66871

Please sign in to comment.