Sample code demonstrating how to use ThrottlingTroll with ASP.NET Core.
As a prerequisite, you will need minimum .NET 6.0 installed.
- Either open ThrottlingTroll-AspDotNetCore-Samples.sln in your Visual Studio and press F5, or go to
ThrottlingTrollSampleWeb
folder and typedotnet run
in your terminal window. - Open
http://localhost:5085/swagger
in your browser and try making calls.
By default the default MemoryCacheCounterStore is used. If you want to use RedisCounterStore, add RedisConnectionString
setting to appsettings.json file. For a local Redis server that connection string usually looks like localhost:6379
.
The project is already instrumented with OpenTelemetry and Zipkin exporter, so all you have to do is:
-
Run Zipkin locally, e.g.:
curl -sSL https://zipkin.io/quickstart.sh | bash -s java -jar zipkin.jar
-
Open Zipkin UI (http://localhost:9411/zipkin).
-
Observe traces, e.g.: