Skip to content

Commit

Permalink
Typos (#2547)
Browse files Browse the repository at this point in the history
* Typos

* Update samples/ReverseProxy.Metrics.Sample/Program.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/Kubernetes.Controller/Client/IResourceInformer.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/Kubernetes.Controller/Client/IResourceInformerRegistration.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/ReverseProxy/Configuration/SessionAffinityConfig.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/ReverseProxy/Forwarder/ForwarderRequestConfig.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/TelemetryConsumption/Sockets/ISocketsTelemetryConsumer.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Update src/ReverseProxy/Utilities/TlsFrameHelper.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

* Typos

* Update src/ReverseProxy/Delegation/HttpSysDelegator.cs

---------

Co-authored-by: Thomas Carlier <thomas.carlier@shortcuts.com.au>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent 12e924f commit cb0cdec
Show file tree
Hide file tree
Showing 37 changed files with 54 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));

//Enable metric collection for all the underlying event counters used by YARP
// Enable metric collection for all the underlying event counters used by YARP
builder.Services.AddAllPrometheusMetrics();

var app = builder.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class PrometheusForwarderMetrics : IMetricsConsumer<ForwarderMetri

private static readonly Counter _requestsFailed = Metrics.CreateCounter(
"yarp_proxy_requests_failed",
"Number of proxy requests that failed"
"Number of proxy requests that have failed"
);

private static readonly Gauge _CurrentRequests = Metrics.CreateGauge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

app.MapReverseProxy(proxyPipeline =>
{
proxyPipeline.UseSessionAffinity(); // Has no affect on delegation destinations because the response doesn't go through YARP
proxyPipeline.UseSessionAffinity(); // Has no effect on delegation destinations because the response doesn't go through YARP
proxyPipeline.UseLoadBalancing();
proxyPipeline.UsePassiveHealthChecks();
proxyPipeline.UseHttpSysDelegation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void OnContentTransferred(DateTime timestamp, bool isRequest, long conten
}
else
{
// We don't get a content stop from http as its returning a stream that is up to the consumer to
// We don't get a content stop from http as it is returning a stream that is up to the consumer to
// read, but we know its ended here.
metrics.HttpResponseContentStopOffset = metrics.CalcOffset(timestamp);
metrics.ResponseBodyLength = contentLength;
Expand Down
2 changes: 1 addition & 1 deletion samples/ReverseProxy.Metrics.Sample/PerRequestMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private PerRequestMetrics() { }
public float HttpRequestStopOffset { get; set; }
public float ProxyStopOffset { get; set; }

//Info about the request
// Info about the request
public ForwarderError Error { get; set; }
public long RequestBodyLength { get; set; }
public long ResponseBodyLength { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion samples/ReverseProxy.Metrics.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
var app = builder.Build();

// Custom middleware that collects and reports the proxy metrics
// Placed at the beginning so it is the first and last thing run for each request
// Placed at the beginning so that it is the first and last thing to run for each request
app.UsePerRequestMetricCollection();

// Middleware used to intercept the WebSocket connection and collect telemetry exposed to WebSocketsTelemetryConsumer
Expand Down
2 changes: 1 addition & 1 deletion src/Kubernetes.Controller/Caching/ICache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Yarp.Kubernetes.Controller.Caching;

/// <summary>
/// ICache service interface holds onto least amount of data necessary
/// ICache service interface holds onto the least amount of data necessary
/// for <see cref="IReconciler"/> to process work.
/// </summary>
public interface ICache
Expand Down
2 changes: 1 addition & 1 deletion src/Kubernetes.Controller/Caching/IngressCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Yarp.Kubernetes.Controller.Caching;

/// <summary>
/// ICache service interface holds onto least amount of data necessary
/// ICache service interface holds onto the least amount of data necessary
/// for <see cref="IReconciler"/> to process work.
/// </summary>
public class IngressCache : ICache
Expand Down
4 changes: 2 additions & 2 deletions src/Kubernetes.Controller/Client/IResourceInformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public interface IResourceInformer

/// <summary>
/// Returns a task that can be awaited to know when the initial listing of resources is complete.
/// Once an await on this method it is safe to assume that all of the knowledge of this resource
/// type has been made available, and everything going forward will be updatres.
/// Once an await on this method is completed it is safe to assume that all the knowledge of this resource
/// type has been made available. Any new changes will be a result of receiving new updates.
/// </summary>
/// <param name="cancellationToken">The cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Task.</returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public interface IResourceInformerRegistration : IDisposable
{
/// <summary>
/// Returns a task that can be awaited to know when the initial listing of resources is complete.
/// Once an await on this method it is safe to assume that all of the knowledge of this resource
/// type has been made available, and everything going forward will be updatres.
/// Once an await on this method is completed it is safe to assume that all the knowledge of this resource
/// type has been made available. Any new changes will be a result of receiving new updates.
/// </summary>
/// <param name="cancellationToken">The cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Task.</returns>
Expand Down
2 changes: 1 addition & 1 deletion src/Kubernetes.Controller/Client/ResourceInformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected override void Dispose(bool disposing)
}
catch (ObjectDisposedException)
{
// ignore redundant exception to allow shutdown sequence to progress uninterupted
// ignore redundant exception to allow shutdown sequence to progress uninterrupted
}
}
base.Dispose(disposing);
Expand Down
6 changes: 3 additions & 3 deletions src/Kubernetes.Controller/Hosting/BackgroundHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class BackgroundHostedService : IHostedService, IDisposable
private bool _disposedValue;
#pragma warning disable CA2213 // Disposable fields should be disposed
private Task _runTask;
#pragma warning restore CA2213 // Disposable fields should be disposed
#pragma warning restore CA2213 // Disposable fields should be disposed

/// <summary>
/// Initializes a new instance of the <see cref="BackgroundHostedService"/> class.
Expand Down Expand Up @@ -169,7 +169,7 @@ protected virtual void Dispose(bool disposing)
}
catch (ObjectDisposedException)
{
// ignore redundant exception to allow shutdown sequence to progress uninterupted
// ignore redundant exception to allow shutdown sequence to progress uninterrupted
}

try
Expand All @@ -178,7 +178,7 @@ protected virtual void Dispose(bool disposing)
}
catch (ObjectDisposedException)
{
// ignore redundant exception to allow shutdown sequence to progress uninterupted
// ignore redundant exception to allow shutdown sequence to progress uninterrupted
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Kubernetes.Controller/Queues/IWorkQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface IWorkQueue<TItem> : IDisposable
void ShutDown();

/// <summary>
/// Shuttings down.
/// Shutting down.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
bool ShuttingDown();
Expand Down
4 changes: 2 additions & 2 deletions src/Kubernetes.Controller/Queues/WorkQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void Add(TItem item)
}

/// <summary>
/// Dones the specified item.
/// Done the specified item.
/// </summary>
/// <param name="item">The item.</param>
public void Done(TItem item)
Expand Down Expand Up @@ -150,7 +150,7 @@ public void ShutDown()
}

/// <summary>
/// Shuttings down.
/// Shutting down.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool ShuttingDown()
Expand Down
4 changes: 2 additions & 2 deletions src/Kubernetes.Controller/Rate/Limiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Limiter(Limit limit, int burst, TimeProvider timeProvider = default)
}

/// <summary>
/// Check to allow one token effective immediately.
/// Checks if a token is available effective immediately. If so, it is consumed.
/// </summary>
/// <returns><c>true</c> if a token is available and used, <c>false</c> otherwise.</returns>
public bool Allow()
Expand Down Expand Up @@ -183,7 +183,7 @@ public async Task WaitAsync(int count, CancellationToken cancellationToken)
}

/// <summary>
/// reserveN is a helper method for AllowN, ReserveN, and WaitN.
/// reserveN is a helper method for AllowN, ReserveN, and WaitN.
/// maxFutureReserve specifies the maximum reservation wait duration allowed.
/// reserveN returns Reservation, not *Reservation, to avoid allocation in AllowN and WaitN.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Kubernetes.Controller/Services/IngressController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Yarp.Kubernetes.Controller.Services;

/// <summary>
/// Controller receives notifications from informers. The data which is needed for processing is
/// saved in a <see cref="ICache"/> instance and resources which need to be reconciled are
/// saved in an <see cref="ICache"/> instance and resources which need to be reconciled are
/// added to an <see cref="ProcessingRateLimitedQueue{QueueItem}"/>. The background task dequeues
/// items and passes them to an <see cref="IReconciler"/> service for processing.
/// </summary>
Expand Down Expand Up @@ -193,7 +193,7 @@ public override async Task RunAsync(CancellationToken cancellationToken)
await registration.ReadyAsync(cancellationToken).ConfigureAwait(false);
}

// At this point we know that all of the Ingress and Endpoint caches are at least in sync
// At this point we know that all the Ingress and Endpoint caches are at least in sync
// with cluster's state as of the start of this controller.
_registrationsReady = true;
NotificationIngressChanged();
Expand Down
4 changes: 2 additions & 2 deletions src/ReverseProxy/Configuration/ConfigValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ConfigValidator(ITransformBuilder transformBuilder,
_clusterValidators = clusterValidators?.ToArray() ?? throw new ArgumentNullException(nameof(clusterValidators));
}

// Note this performs all validation steps without short circuiting in order to report all possible errors.
// Note this performs all validation steps without short-circuiting in order to report all possible errors.
public async ValueTask<IList<Exception>> ValidateRouteAsync(RouteConfig route)
{
_ = route ?? throw new ArgumentNullException(nameof(route));
Expand Down Expand Up @@ -58,7 +58,7 @@ public async ValueTask<IList<Exception>> ValidateRouteAsync(RouteConfig route)
return errors;
}

// Note this performs all validation steps without short circuiting in order to report all possible errors.
// Note this performs all validation steps without short-circuiting in order to report all possible errors.
public async ValueTask<IList<Exception>> ValidateClusterAsync(ClusterConfig cluster)
{
_ = cluster ?? throw new ArgumentNullException(nameof(cluster));
Expand Down
4 changes: 2 additions & 2 deletions src/ReverseProxy/Configuration/InMemoryConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ public InMemoryConfig(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterCo
public IReadOnlyList<RouteConfig> Routes { get; }

/// <summary>
/// A snapshot of the list of Clusters which are collections of interchangable destination endpoints
/// A snapshot of the list of Clusters which are collections of interchangeable destination endpoints
/// </summary>
public IReadOnlyList<ClusterConfig> Clusters { get; }

/// <summary>
/// Fired to indicate the the proxy state has changed, and that this snapshot is now stale
/// Fired to indicate the proxy state has changed, and that this snapshot is now stale
/// </summary>
public IChangeToken ChangeToken { get; }

Expand Down
2 changes: 1 addition & 1 deletion src/ReverseProxy/Configuration/SessionAffinityConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed record SessionAffinityConfig
public string? Policy { get; init; }

/// <summary>
/// Strategy handling missing destination for an affinitized request.
/// Strategy for handling a missing destination for an affinitized request.
/// </summary>
public string? FailurePolicy { get; init; }

Expand Down
2 changes: 1 addition & 1 deletion src/ReverseProxy/Delegation/HttpSysDelegator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static void Delegate(
{
Log.QueueNoLongerExists(logger, destination.GetHttpSysDelegationQueue(), destination.Model?.Config?.Address, ex);

// The target queue is gone, detach from it so we can try to re-attach
// The target queue is gone. Detach from it so that we can try to re-attach.
queue.Detach(queueState);

// Attempt to delegate one more time which will try re-initialize the queue
Expand Down
2 changes: 1 addition & 1 deletion src/ReverseProxy/Forwarder/ForwarderRequestConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public sealed record ForwarderRequestConfig
/// <summary>
/// How long a request is allowed to remain idle between any operation completing, after which it will be canceled.
/// The default is 100 seconds. The timeout will reset when response headers are received or after successfully reading or
/// writing any request, response, or streaming data like gRPC or WebSockets. TCP keep-alives and HTTP/2 protocol pings will
/// writing any request, response, or streaming data like gRPC or WebSockets. TCP keep-alive packets and HTTP/2 protocol pings will
/// not reset the timeout, but WebSocket pings will.
/// </summary>
public TimeSpan? ActivityTimeout { get; init; }
Expand Down
10 changes: 5 additions & 5 deletions src/ReverseProxy/Forwarder/HttpForwarder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public async ValueTask<ForwarderError> SendAsync(
}

// :: Step 9: Wait for completion of step 2: copying request body Client --► Proxy --► Destination
// NOTE: It is possible for the request body to NOT be copied even when there was an incoming requet body,
// NOTE: It is possible for the request body to NOT be copied even when there was an incoming request body,
// e.g. when the request includes header `Expect: 100-continue` and the destination produced a non-1xx response.
// We must only wait for the request body to complete if it actually started,
// otherwise we run the risk of waiting indefinitely for a task that will never complete.
Expand Down Expand Up @@ -502,7 +502,7 @@ private void FixupUpgradeRequestHeaders(HttpContext context, HttpRequestMessage
// If we generate an HttpContent without a Content-Length then for HTTP/1.1 HttpClient will add a Transfer-Encoding: chunked header
// even if it's a GET request. Some servers reject requests containing a Transfer-Encoding header if they're not expecting a body.
// Try to be as specific as possible about the client's intent to send a body. The one thing we don't want to do is to start
// reading the body early because that has side-effects like 100-continue.
// reading the body early because that has side effects like 100-continue.
var request = context.Request;
var hasBody = true;
var contentLength = request.Headers.ContentLength;
Expand Down Expand Up @@ -541,7 +541,7 @@ private void FixupUpgradeRequestHeaders(HttpContext context, HttpRequestMessage
{
hasBody = contentLength > 0;
}
// Kestrel HTTP/2: There are no required headers that indicate if there is a request body so we need to sniff other fields.
// Kestrel HTTP/2: There are no required headers that indicate if there is a request body, so we need to sniff other fields.
else if (!ProtocolHelper.IsHttp2OrGreater(request.Protocol))
{
hasBody = false;
Expand Down Expand Up @@ -828,7 +828,7 @@ private ForwarderError FixupUpgradeResponseHeaders(HttpContext context, HttpResp
Debug.Assert(success);
var accept = context.Response.Headers[HeaderNames.SecWebSocketAccept];
var expectedAccept = ProtocolHelper.CreateSecWebSocketAccept(key.ToString());
if (!string.Equals(expectedAccept, accept, StringComparison.Ordinal)) // Base64 is case sensitive
if (!string.Equals(expectedAccept, accept, StringComparison.Ordinal)) // Base64 is case-sensitive
{
context.Response.Clear();
context.Response.StatusCode = StatusCodes.Status502BadGateway;
Expand Down Expand Up @@ -930,7 +930,7 @@ private async ValueTask<ForwarderError> HandleResponseBodyErrorAsync(HttpContext
return error;
}

// The response has already started, we must forcefully terminate it so the client doesn't get the
// The response has already started, we must forcefully terminate it so the client doesn't get
// the mistaken impression that the truncated response is complete.
ResetOrAbort(context, isCancelled: responseBodyCopyResult == StreamCopyResult.Canceled);

Expand Down
2 changes: 1 addition & 1 deletion src/ReverseProxy/Health/ClusterDestinationsUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void UpdateInternal(ClusterState cluster, IReadOnlyList<DestinationState
// the semaphore's count is still 0. However, T2 could have already made some progress and didn't observe updates made
// by T3.
// By releasing the semaphore under the lock, we make sure that in the above situation T3 will proceed till the lock and
// its updates will be observed anyways.
// its updates will be observed anyway.
updateLock.Release();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReverseProxy/Health/EntityActionScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private static async Task TimerCallback(object? state)
}
catch (Exception ex)
{
// We are running on the ThreadPool, don't propagate excetions
// We are running on the ThreadPool, don't propagate exceptions
Debug.Fail(ex.ToString()); // TODO: Log
if (scheduler._entries.TryRemove(pair))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class TransportFailureRateHealthPolicyOptions
public int MinimalTotalCountThreshold { get; set; } = 10;

/// <summary>
/// Default failure rate limit for a destination to be marked as unhealhty that is applied if it's not set on a cluster's metadata.
/// Default failure rate limit for a destination to be marked as unhealthy that is applied if it's not set on a cluster's metadata.
/// It's calculated as a percentage of failed requests out of all requests proxied to the same destination in the <see cref="DetectionWindowSize"/> period.
/// The value is in range (0,1). The default is 0.3 (30%).
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed class RoundRobinLoadBalancingPolicy : ILoadBalancingPolicy
// Increment returns the new value and we want the first return value to be 0.
var offset = counter.Increment() - 1;

// Preventing negative indicies from being computed by masking off sign.
// Preventing negative indices from being computed by masking off sign.
// Ordering of index selection is consistent across all offsets.
// There may be a discontinuity when the sign of offset changes.
return availableDestinations[(offset & 0x7FFFFFFF) % availableDestinations.Count];
Expand Down
4 changes: 2 additions & 2 deletions src/ReverseProxy/Management/IProxyStateLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IProxyStateLookup
bool TryGetRoute(string id, [NotNullWhen(true)] out RouteModel? route);

/// <summary>
/// Enumerates all current routes. This is thread safe but the collection may change mid enumeration if the configuration is reloaded.
/// Enumerates all current routes. This is thread safe but the collection may change mid-enumeration if the configuration is reloaded.
/// </summary>
IEnumerable<RouteModel> GetRoutes();

Expand All @@ -28,7 +28,7 @@ public interface IProxyStateLookup
bool TryGetCluster(string id, [NotNullWhen(true)] out ClusterState? cluster);

/// <summary>
/// Enumerates all current clusters. This is thread safe but the collection may change mid enumeration if the configuration is reloaded.
/// Enumerates all current clusters. This is thread safe but the collection may change mid-enumeration if the configuration is reloaded.
/// </summary>
IEnumerable<ClusterState> GetClusters();
}
Loading

0 comments on commit cb0cdec

Please sign in to comment.