Skip to content

Commit 76196c8

Browse files
authored
Merge branch 'develop' into Burgyn-patch-1
2 parents a323d16 + 0379c77 commit 76196c8

File tree

112 files changed

+3865
-2905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3865
-2905
lines changed

ReleaseNotes.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
Technical release, version {0}
1+
## :package: Documentation patch (version {0}), technical release
2+
> Read the Docs: [Ocelot 23.3](https://ocelot.readthedocs.io/en/{0}/)
3+
> PDF Doc: [Ocelot 23.3](https://ocelot.readthedocs.io/_/downloads/en/{0}/pdf/)
4+
> Hot fixed version: [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4)
5+
6+
### :information_source: About
7+
This documentation patch pertains to HTML and PDF document layouts.
8+
No NuGet packages have been uploaded.

build.cake

+21-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#tool nuget:?package=ReportGenerator&version=5.2.4
44
#addin nuget:?package=Newtonsoft.Json&version=13.0.3
55
#addin nuget:?package=System.Text.Encodings.Web&version=8.0.0
6-
#addin nuget:?package=Cake.Coveralls&version=1.1.0
6+
#addin nuget:?package=Cake.Coveralls&version=4.0.0
77

88
#r "Spectre.Console"
99
using Spectre.Console
@@ -14,6 +14,9 @@ using System.Linq;
1414
using System.Text.RegularExpressions;
1515

1616
const string Release = "Release"; // task name, target, and Release config name
17+
const string AllFrameworks = "net6.0;net7.0;net8.0";
18+
const string LatestFramework = "net8.0";
19+
1720
var compileConfig = Argument("configuration", Release); // compile
1821

1922
// build artifacts
@@ -47,7 +50,7 @@ var releaseNotes = new List<string>();
4750
// internal build variables - don't change these.
4851
string committedVersion = "0.0.0-dev";
4952
GitVersion versioning = null;
50-
bool IsTechnicalRelease = false;
53+
bool IsTechnicalRelease = true;
5154

5255
var target = Argument("target", "Default");
5356
var slnFile = (target == Release) ? $"./Ocelot.{Release}.sln" : "./Ocelot.sln";
@@ -93,9 +96,10 @@ Task("Compile")
9396
};
9497
if (target != Release)
9598
{
96-
settings.Framework = "net8.0"; // build using .NET 8 SDK only
99+
settings.Framework = LatestFramework; // build using .NET 8 SDK only
97100
}
98-
Information($"Settings {nameof(DotNetBuildSettings.Framework)}: {settings.Framework}");
101+
string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework;
102+
Information($"Settings {nameof(DotNetBuildSettings.Framework)}: {frameworkInfo}");
99103
Information($"Settings {nameof(DotNetBuildSettings.Configuration)}: {settings.Configuration}");
100104
DotNetBuild(slnFile, settings);
101105
});
@@ -344,7 +348,7 @@ Task("RunUnitTests")
344348
.IsDependentOn("Compile")
345349
.Does(() =>
346350
{
347-
var testSettings = new DotNetTestSettings
351+
var settings = new DotNetTestSettings
348352
{
349353
Configuration = compileConfig,
350354
ResultsDirectory = artifactsForUnitTestsDir,
@@ -357,10 +361,12 @@ Task("RunUnitTests")
357361
};
358362
if (target != Release)
359363
{
360-
testSettings.Framework = "net8.0"; // .NET 8 SDK only
364+
settings.Framework = LatestFramework; // .NET 8 SDK only
361365
}
366+
string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework;
367+
Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}");
362368
EnsureDirectoryExists(artifactsForUnitTestsDir);
363-
DotNetTest(unitTestAssemblies, testSettings);
369+
DotNetTest(unitTestAssemblies, settings);
364370

365371
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir)
366372
.First()
@@ -408,15 +414,17 @@ Task("RunAcceptanceTests")
408414
var settings = new DotNetTestSettings
409415
{
410416
Configuration = compileConfig,
411-
Framework = "net8.0", // .NET 8 SDK only
417+
// Framework = LatestFramework, // .NET 8 SDK only
412418
ArgumentCustomization = args => args
413419
.Append("--no-restore")
414420
.Append("--no-build")
415421
};
416422
if (target != Release)
417423
{
418-
settings.Framework = "net8.0"; // .NET 8 SDK only
424+
settings.Framework = LatestFramework; // .NET 8 SDK only
419425
}
426+
string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework;
427+
Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}");
420428
EnsureDirectoryExists(artifactsForAcceptanceTestsDir);
421429
DotNetTest(acceptanceTestAssemblies, settings);
422430
});
@@ -428,15 +436,17 @@ Task("RunIntegrationTests")
428436
var settings = new DotNetTestSettings
429437
{
430438
Configuration = compileConfig,
431-
Framework = "net8.0", // .NET 8 SDK only
439+
// Framework = LatestFramework, // .NET 8 SDK only
432440
ArgumentCustomization = args => args
433441
.Append("--no-restore")
434442
.Append("--no-build")
435443
};
436444
if (target != Release)
437445
{
438-
settings.Framework = "net8.0"; // .NET 8 SDK only
446+
settings.Framework = LatestFramework; // .NET 8 SDK only
439447
}
448+
string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework;
449+
Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}");
440450
EnsureDirectoryExists(artifactsForIntegrationTestsDir);
441451
DotNetTest(integrationTestAssemblies, settings);
442452
});

docs/conf.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

9-
project = 'Ocelot'
10-
copyright = ' 2016-2024 ThreeMammals Ocelot team'
11-
author = 'Tom Pallister, Raman Maksimchuk and Ocelot Core team at ThreeMammals'
9+
project = 'Ocelot Gateway'
10+
copyright = ' 2016-2024, ThreeMammals Ocelot team'
11+
author = 'Tom Pallister, Raman Maksimchuk'
1212
release = '23.3'
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1616

17-
extensions = []
17+
extensions = [
18+
]
1819

1920
templates_path = ['_templates']
2021
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

docs/features/graphql.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ We wanted to show how easy it is to integrate the `GraphQL for .NET <https://git
1212
Please see the sample project `OcelotGraphQL <https://github.com/ThreeMammals/Ocelot/tree/main/samples/OcelotGraphQL>`_.
1313
Using a combination of the `graphql-dotnet <https://github.com/graphql-dotnet/graphql-dotnet>`_ project and Ocelot :doc:`../features/delegatinghandlers` features, this is pretty easy to do.
1414
However we do not intend to integrate more closely with **GraphQL** at the moment.
15-
Check out the samples `README.md <https://github.com/ThreeMammals/Ocelot/blob/main/samples/OcelotGraphQL/README.md>`_ and that should give you enough instruction on how to do this!
15+
Check out the samples `README.md <https://github.com/ThreeMammals/Ocelot/blob/main/samples/GraphQL/README.md>`_ and that should give you enough instruction on how to do this!
1616

1717
Future
1818
------

docs/features/ratelimiting.rst

+44-19
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,25 @@ To implement *rate limiting* for a Route, you need to incorporate the following
2727
"Limit": 1
2828
}
2929
30-
* **ClientWhitelist** - An array containing the whitelisted clients. Clients listed here will be exempt from rate limiting.
31-
For more information on the **ClientIdHeader** option, refer to the :ref:`rl-global-configuration` section.
32-
* **EnableRateLimiting** - This setting enables rate limiting on endpoints.
33-
* **Period** - This parameter defines the duration for which the limit is applicable, such as ``1s`` (seconds), ``5m`` (minutes), ``1h`` (hours), and ``1d`` (days).
34-
If you reach the exact **Limit** of requests, the excess occurs immediately, and the **PeriodTimespan** begins.
35-
You must wait for the **PeriodTimespan** duration to pass before making another request.
36-
Should you exceed the number of requests within the period more than the **Limit** permits, the **QuotaExceededMessage** will appear in the response, accompanied by the **HttpStatusCode**.
37-
* **PeriodTimespan** - This parameter indicates the time in **seconds** after which a retry is permissible.
38-
During this interval, the **QuotaExceededMessage** will appear in the response, accompanied by an **HttpStatusCode**.
30+
* ``ClientWhitelist``: An array containing the whitelisted clients. Clients listed here will be exempt from rate limiting.
31+
For more information on the ``ClientIdHeader`` option, refer to the :ref:`rl-global-configuration` section.
32+
* ``EnableRateLimiting``: This setting enables rate limiting on endpoints.
33+
* ``Period``: This parameter defines the duration for which the limit is applicable, such as ``1s`` (seconds), ``5m`` (minutes), ``1h`` (hours), and ``1d`` (days).
34+
If you reach the exact ``Limit`` of requests, the excess occurs immediately, and the ``PeriodTimespan`` begins.
35+
You must wait for the ``PeriodTimespan`` duration to pass before making another request.
36+
Should you exceed the number of requests within the period more than the ``Limit`` permits, the ``QuotaExceededMessage`` will appear in the response, accompanied by the ``HttpStatusCode``.
37+
* ``PeriodTimespan``: This parameter indicates the time in **seconds** after which a retry is permissible.
38+
During this interval, the ``QuotaExceededMessage`` will appear in the response, accompanied by an ``HttpStatusCode``.
3939
Clients are advised to consult the ``Retry-After`` header to determine the timing of subsequent requests.
40-
* **Limit** - This parameter defines the upper limit of requests a client is allowed to make within a specified **Period**.
40+
* ``Limit``: This parameter defines the upper limit of requests a client is allowed to make within a specified ``Period``.
4141

4242
.. _rl-global-configuration:
4343

4444
Global Configuration
4545
^^^^^^^^^^^^^^^^^^^^
4646

47+
Global options are only accessible in the special :ref:`routing-dynamic` mode.
48+
4749
You can set the following in the ``GlobalConfiguration`` section of `ocelot.json`_:
4850

4951
.. code-block:: json
@@ -58,26 +60,49 @@ You can set the following in the ``GlobalConfiguration`` section of `ocelot.json
5860
}
5961
}
6062
61-
* **DisableRateLimitHeaders** - Determines if the ``X-Rate-Limit`` and ``Retry-After`` headers are disabled.
62-
* **QuotaExceededMessage** - Defines the message displayed when the quota is exceeded. It is optional and the default message is informative.
63-
* **HttpStatusCode** - Indicates the HTTP status code returned during *rate limiting*. The default value is **429** (`Too Many Requests`_).
64-
* **ClientIdHeader** - Specifies the header used to identify clients, with ``ClientId`` as the default.
6563
66-
Future and ASP.NET Core Implementation
67-
--------------------------------------
64+
.. list-table::
65+
:widths: 35 65
66+
:header-rows: 1
67+
68+
* - *Property*
69+
- *Description*
70+
* - ``DisableRateLimitHeaders``
71+
- Determines if the ``X-Rate-Limit`` and ``Retry-After`` headers are disabled
72+
* - ``QuotaExceededMessage``
73+
- Defines the message displayed when the quota is exceeded. It is optional and the default message is informative.
74+
* - ``HttpStatusCode``
75+
- Indicates the HTTP status code returned during *rate limiting*. The default value is **429** (`Too Many Requests`_).
76+
* - ``ClientIdHeader``
77+
- Specifies the header used to identify clients, with ``ClientId`` as the default.
78+
79+
Notes
80+
"""""
81+
82+
1. Global ``RateLimitOptions`` are supported when the :ref:`sd-dynamic-routing` feature is configured with :doc:`../features/servicediscovery`.
83+
Hence, if :doc:`../features/servicediscovery` is not set up, only the options for static routes need to be defined to impose limitations at the route level.
84+
2. Global *Rate Limiting* options may not be practical because they impose limits on all routes.
85+
It's reasonable to assert that in a Microservices architecture, it's an unusual approach to apply the same limitations to all routes.
86+
Configuring per-route limiting could be a more tailored solution.
87+
Global *Rate Limiting* is logical if all routes share the same downstream hosts, thus limiting the usage of a single service.
88+
3. *Rate Limiting* is now built-in with ASP.NET Core 7, as discussed in the following topic below.
89+
Our team holds the view that the ASP.NET ``RateLimiter`` enables global limitations through its rate limiting policies.
90+
91+
Future and ASP.NET Implementation
92+
---------------------------------
6893

6994
The Ocelot team is contemplating a redesign of the *Rate Limiting* feature following the `Announcing Rate Limiting for .NET`_ by Brennan Conroy on July 13th, 2022.
7095
Currently, no decision has been made, and the previous version of the feature remains part of the `20.0`_ release for .NET 7. [#f2]_
7196

72-
Discover the new features being introduced in the ASP.NET Core 7.0 release:
97+
Discover the new features in the ASP.NET Core 7.0 release:
7398

7499
* The `RateLimiter Class <https://learn.microsoft.com/en-us/dotnet/api/system.threading.ratelimiting.ratelimiter>`_, available since ASP.NET Core 7.0
75100
* The `System.Threading.RateLimiting <https://www.nuget.org/packages/System.Threading.RateLimiting>`_ NuGet package
76101
* The `Rate limiting middleware in ASP.NET Core <https://learn.microsoft.com/en-us/aspnet/core/performance/rate-limit>`_ article by Arvin Kahbazi, Maarten Balliauw, and Rick Anderson
77102

78-
While retaining the old implementation as an Ocelot built-in feature makes sense, we plan to transition to the new Rate Limiter from the ``Microsoft.AspNetCore.RateLimiting`` namespace.
103+
While it makes sense to retain the old implementation as a built-in feature of Ocelot, we are planning to transition to the new Rate Limiter from the ``Microsoft.AspNetCore.RateLimiting`` namespace.
79104

80-
Please share your thoughts with us in the `Discussions <https://github.com/ThreeMammals/Ocelot/discussions>`_ space of the repository. |octocat|
105+
We invite you to share your thoughts with us in the `Discussions <https://github.com/ThreeMammals/Ocelot/discussions>`_ space of the repository. |octocat|
81106

82107
""""
83108

docs/features/servicediscovery.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@ However, the quickest and most streamlined approach is to inherit directly from
246246
247247
public class MyConsulServiceBuilder : DefaultConsulServiceBuilder
248248
{
249-
public MyConsulServiceBuilder(Func<ConsulRegistryConfiguration> configurationFactory, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)
250-
: base(configurationFactory, clientFactory, loggerFactory) { }
249+
public MyConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)
250+
: base(contextAccessor, clientFactory, loggerFactory) { }
251+
251252
// I want to use the agent service IP address as the downstream hostname
252-
protected override string GetDownstreamHost(ServiceEntry entry, Node node) => entry.Service.Address;
253+
protected override string GetDownstreamHost(ServiceEntry entry, Node node)
254+
=> entry.Service.Address;
253255
}
254256
255257
**Second**, we must inject the new behavior into DI, as demonstrated in the Ocelot versus Consul setup:
@@ -543,7 +545,7 @@ But you can leave this ``Type`` option for compatibility between both designs.
543545
.. _KV Store: https://developer.hashicorp.com/consul/docs/dynamic-app-config/kv
544546
.. _3 seconds TTL: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+TimeSpan.FromSeconds%283%29&type=code
545547
.. _catalog nodes: https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes
546-
.. _the acceptance test: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+Should_return_service_address_by_overridden_service_builder_when_there_is_a_node&type=code
548+
.. _the acceptance test: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+ShouldReturnServiceAddressByOverriddenServiceBuilderWhenThereIsANode&type=code
547549
.. _346: https://github.com/ThreeMammals/Ocelot/issues/346
548550
.. _909: https://github.com/ThreeMammals/Ocelot/pull/909
549551
.. _954: https://github.com/ThreeMammals/Ocelot/issues/954

0 commit comments

Comments
 (0)