-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[logs] Mitigate unwanted object creation during configuration reload #5514
Merged
CodeBlanch
merged 19 commits into
open-telemetry:main
from
CodeBlanch:sdk-log-options-reload
Apr 12, 2024
Merged
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3c7f674
Fixes for log options reload.
CodeBlanch 38ddd36
Add code comments.
CodeBlanch 081a06f
CHANGELOG patch.
CodeBlanch ceaef66
Merge from main.
CodeBlanch 57ee199
Add trim annotations.
CodeBlanch 51ae4e9
Tweaks.
CodeBlanch 63194a2
Adjust CHANGELOG.
CodeBlanch 5c95b81
Revert changes to DelegatingOptionsFactory.
CodeBlanch e467ecc
CHANGELOG tweaks.
CodeBlanch d7022bb
Merge branch 'main' into sdk-log-options-reload
CodeBlanch 702274e
CHANGELOG tweaks.
CodeBlanch 0302dcd
Merge branch 'sdk-log-options-reload' of https://github.com/CodeBlanc…
CodeBlanch 2d99b73
Update src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs
CodeBlanch 686339e
Code review.
CodeBlanch a048557
Tweak CHANGELOG.
CodeBlanch a1c1acd
Revert "Tweak CHANGELOG."
CodeBlanch a1d7461
Revert "Code review."
CodeBlanch 57acafd
Code review.
CodeBlanch cbbbbaa
Merge branch 'main' into sdk-log-options-reload
CodeBlanch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#nullable enable | ||
|
||
#if NET6_0_OR_GREATER | ||
using System.Diagnostics.CodeAnalysis; | ||
#endif | ||
|
||
namespace Microsoft.Extensions.Options; | ||
|
||
#if NET6_0_OR_GREATER | ||
internal sealed class SingletonOptionsMonitor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptionsMonitor<TOptions> | ||
#else | ||
internal sealed class SingletonOptionsMonitor<TOptions> : IOptionsMonitor<TOptions> | ||
#endif | ||
where TOptions : class | ||
{ | ||
private readonly TOptions instance; | ||
|
||
public SingletonOptionsMonitor(IOptions<TOptions> options) | ||
{ | ||
this.instance = options.Value; | ||
} | ||
|
||
public TOptions CurrentValue => this.instance; | ||
|
||
public TOptions Get(string? name) => this.instance; | ||
|
||
public IDisposable? OnChange(Action<TOptions, string?> listener) => null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the description (which is phrased as a behavior change) here might be confusing to users - most of them probably don't even know about
OpenTelemetryLoggerOptions
.Consider being more explicit here by starting with "Fixed an issue ..." (whether
OpenTelemetryLoggerOptions
will be created or not is an implementation detail that we might change later if we figured out how to properly support dynamic configuration reload).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New version pushed