dotnet / dotnet/extensions

Reload configuration in RandomProbabilisticSampler only when T is changed

Open
#6,581 0 comments 0 reactions 0 assignees View on GitHub
area-telemetry untriaged
Dominant language
C#
Stars
3.2k
Forks
894
Avg merge
1d 12h
Merged PRs (30d)
23

Description

Currently, configuration [is](https://source.dot.net/#Microsoft.Extensions.Telemetry/Sampling/RandomProbabilisticSampler.cs,365c43912fa08496,references) reloaded when any change in `IConfiguration` occurs due to [poor](https://github.com/dotnet/runtime/issues/109445) design of `IOptionsMonitor`. Please optimize the code in RandomProbabilisticSampler so that it reloads configuration only when the actual type `T` changes or logger filter configuration is updated. This is necessary to limit the number of memory allocations for new arrays whenever configurations changes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.