[Hosting] Throw startup exceptions#4006
Merged
CodeBlanch merged 6 commits intoopen-telemetry:mainfrom Dec 14, 2022
Merged
Conversation
alanwest
approved these changes
Dec 14, 2022
utpilla
reviewed
Dec 14, 2022
src/OpenTelemetry.Extensions.Hosting/Implementation/HostingExtensionsEventSource.cs
Outdated
Show resolved
Hide resolved
utpilla
reviewed
Dec 14, 2022
| [NonEvent] | ||
| public void FailedInitialize(Exception ex) | ||
| [Event(1, Message = "OpenTelemetry TraverProvider and/or MeterProvider were not found in application services. SDK will remain disabled.", Level = EventLevel.Warning)] | ||
| public void SdkNotRegistered() |
Contributor
There was a problem hiding this comment.
Have dedicated events for TracerProvider and MeterProvider instead of using the same?
utpilla
approved these changes
Dec 14, 2022
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4006 +/- ##
==========================================
+ Coverage 85.46% 85.48% +0.01%
==========================================
Files 289 289
Lines 11237 11229 -8
==========================================
- Hits 9604 9599 -5
+ Misses 1633 1630 -3
|
cijothomas
reviewed
Dec 15, 2022
| } | ||
| // The sole purpose of this HostedService is to ensure all | ||
| // instrumentations, exporters, etc., are created and started. | ||
| Initialize(this.serviceProvider); |
Member
There was a problem hiding this comment.
nit: add a comment saying intentionally not catching ex, to let it bubble up.
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Relates to #3753
Changes
IHostedServiceused byOpenTelemetry.Extensions.Hostingwill now throw if it blows up startingTracerProviderorMeterProvider.Details
If you do this today using the "Sdk.Create" style you will get a
NotSupportedException:If you do this today using the hosting style an internal log is written but otherwise nothing happens:
The goal of the change is to make the behavior consistent and notify users when they have made a mistake.
The above example is a dev issue but other kinds of problems will also now blow up the process. Bad configuration, invalid permissions, port issues, etc. Discussing with @alanwest we felt it was better to surface these types of issues immediately and prevent the process from starting.
TODOs
CHANGELOG.mdupdated for non-trivial changes