[Logs] Add extension for registering OpenTelemetryLoggerProvider with ILoggingBuilder - #3489
Merged
cijothomas merged 6 commits intoJul 28, 2022
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3489 +/- ##
=======================================
Coverage 86.49% 86.49%
=======================================
Files 272 272
Lines 9931 9939 +8
=======================================
+ Hits 8590 8597 +7
- Misses 1341 1342 +1
|
alanwest
reviewed
Jul 28, 2022
Comment on lines
-40
to
+48
| public static ILoggingBuilder AddOpenTelemetry(this ILoggingBuilder builder, Action<OpenTelemetryLoggerOptions>? configure = null) | ||
| public static ILoggingBuilder AddOpenTelemetry(this ILoggingBuilder builder, Action<OpenTelemetryLoggerOptions>? configure) |
cijothomas
approved these changes
Jul 28, 2022
2 tasks
AsherBond
pushed a commit
to OTEL-California/opentelemetry-specification
that referenced
this pull request
Jun 29, 2026
## Changes Update the compliance matrix for .NET as of 1.16.0 of the .NET SDK. I got Copilot to do most of the work of researching what was missing that had been implementing and finding the relevant PRs that implemented then. I cross checked the PRs _looked_ correct, but some of it might be incorrect, particularly things that seem to have been implemented for a while and predate my contributions to OTel. I then had Claude review the changes and cross-reference, which fixed some of the entries, but again there might still be some mistakes. ~~Some of the entries might only be available as experimental features, so maybe they shouldn't be updated?~~ Experimental entries removed, now marked as ~~strikethrough~~ below. Entries updated with relevant PR links where appropriate below. /cc @open-telemetry/dotnet-maintainers ### Traces - Get a Tracer with schema_url: open-telemetry/opentelemetry-dotnet#6736 - Get a Tracer with scope attributes: open-telemetry/opentelemetry-dotnet#6137 - Associate Tracer with InstrumentationScope: open-telemetry/opentelemetry-dotnet#239 - Fetch InstrumentationScope from ReadableSpan: open-telemetry/opentelemetry-dotnet#679 ### Metrics - Associate Meter with InstrumentationScope: open-telemetry/opentelemetry-dotnet#6714 - Gauge instrument is supported: open-telemetry/opentelemetry-dotnet#5867 - Valid instrument created / warning for duplicate name: open-telemetry/opentelemetry-dotnet#2916 - Duplicate instrument registration resolved by first-seen: open-telemetry/opentelemetry-dotnet#2916 - Instrument names conform to specified syntax: open-telemetry/opentelemetry-dotnet#3821 - Instrument supports advisory ExplicitBucketBoundaries: open-telemetry/opentelemetry-dotnet#5854 - Instrument supports advisory Attributes: Not implemented - name/version/schema_url create InstrumentationScope: open-telemetry/opentelemetry-dotnet#6714 - ~~View allows configuring name, description, attributes, aggregation: open-telemetry/opentelemetry-dotnet#2396 - ~~View allows configuring exemplar reservoir: open-telemetry/opentelemetry-dotnet#5558 - Metrics Reader supports default aggregation config: open-telemetry/opentelemetry-dotnet#6778 - Metrics Reader supports default temporality config: open-telemetry/opentelemetry-dotnet#4667 - ~~ExemplarReservoir interface/extension point: open-telemetry/opentelemetry-dotnet#5542 - ~~ExemplarReservoir has offer method: open-telemetry/opentelemetry-dotnet#5542 - SimpleFixedSizeExemplarReservoir: open-telemetry/opentelemetry-dotnet#4256 - AlignedHistogramBucketExemplarReservoir: open-telemetry/opentelemetry-dotnet#4119 ### Logs - ~~LoggerProvider.GetLogger: open-telemetry/opentelemetry-dotnet#4422 - LoggerProvider.GetLogger accepts attributes: Not implemented - LoggerProvider.Shutdown: open-telemetry/opentelemetry-dotnet#5648 - LoggerProvider.ForceFlush: open-telemetry/opentelemetry-dotnet#5648 - Logger.Emit(LogRecord) with Exception parameter: Not implemented - ~~LogRecord.Set EventName: open-telemetry/opentelemetry-dotnet#6306 - Logger.Enabled: Not implemented - Ergonomic API (ILogger bridge): open-telemetry/opentelemetry-dotnet#3489 - SimpleLogRecordProcessor: open-telemetry/opentelemetry-dotnet#1622 - BatchLogRecordProcessor: open-telemetry/opentelemetry-dotnet#1622 - Can plug custom LogRecordProcessor: open-telemetry/opentelemetry-dotnet#4916 - LogRecordProcessor.Enabled: Not implemented - Can plug custom LogRecordExporter: open-telemetry/opentelemetry-dotnet#1622 ### Context Propagation - Jaeger Propagator: open-telemetry/opentelemetry-dotnet#3309 - TextMapPropagator: open-telemetry/opentelemetry-dotnet#1427 ### Environment Variables - OTEL_SDK_DISABLED: open-telemetry/opentelemetry-dotnet#6568 - OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT: open-telemetry/opentelemetry-dotnet#4887 - OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT: open-telemetry/opentelemetry-dotnet#4887 - OTEL_TRACES_SAMPLER: open-telemetry/opentelemetry-dotnet#5448 - OTEL_TRACES_SAMPLER_ARG: open-telemetry/opentelemetry-dotnet#5448 - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION: open-telemetry/opentelemetry-dotnet#6778 ### Exporters — OTLP - OTLP/HTTP gzip Content-Encoding support: open-telemetry/opentelemetry-dotnet#7055 - ~~Honors retryable responses with backoff: open-telemetry/opentelemetry-dotnet#5495 - ~~Honors non-retryable responses: open-telemetry/opentelemetry-dotnet#5495 - ~~Honors throttling response: open-telemetry/opentelemetry-dotnet#5495 - Metric Exporter configurable temporality preference: open-telemetry/opentelemetry-dotnet#4667 - Metric Exporter configurable default aggregation: open-telemetry/opentelemetry-dotnet#6778 ### Exporters — Zipkin - InstrumentationScope mapping: open-telemetry/opentelemetry-dotnet#5473 ### Exporters — Prometheus - Metadata Deduplication: open-telemetry/opentelemetry-dotnet#7237 - otel_scope_name and otel_scope_version labels: open-telemetry/opentelemetry-dotnet#7237 - otel_scope_[attribute] labels: open-telemetry/opentelemetry-dotnet#7237 - Prometheus Counters have _total suffix by default: open-telemetry/opentelemetry-dotnet#5305 - Prometheus Counters _total suffixing can be disabled: open-telemetry/opentelemetry-dotnet#5305 - Colliding sanitized attribute keys are merged: open-telemetry/opentelemetry-dotnet#7239 - Exemplars for Histograms and Monotonic sums: open-telemetry/opentelemetry-dotnet#7222 - target_info metric from Resource: open-telemetry/opentelemetry-dotnet#5407 ### OpenTracing Compatibility - Create OpenTracing Shim: open-telemetry/opentelemetry-dotnet#197 - Tracer shim: open-telemetry/opentelemetry-dotnet#197 - Span shim: open-telemetry/opentelemetry-dotnet#197 - SpanContext shim: open-telemetry/opentelemetry-dotnet#197 - ScopeManager shim: open-telemetry/opentelemetry-dotnet#197 - Error mapping for attributes/events: open-telemetry/opentelemetry-dotnet#197
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.
Following up on #3454 (comment)
Changes
OpenTelemetryLoggerProviderwith anILoggingBuilder. You don't really need this extension to do that, but I think it helps with discoverability and our documentation/examples to have it.Details
Here is the use case I am thinking about.
The Serilog startup pattern configures the log pipeline before the host builder. That sort of prescribes that users will need to manually build their own
OpenTelemetryLoggerProvider. What this new extension does is just smooth that out.Public API
The reason that one method is being removed is I first tried this...
...which gave me the warning:
Symbol 'AddOpenTelemetry' violates the backcompat requirement: 'Public API with optional parameter(s) should have the most parameters amongst its public overloads'. See 'https://github.com/dotnet/roslyn/blob/master/docs/Adding%20Optional%20Parameters%20in%20Public%20API.md' for details.The layout of the new methods fixes that. Checked with @tarekgh. New design should be mostly safe. If users were calling these methods with reflection and specifically checking the metadata for "optional" parameter, they would break. But I feel like that is a super edge case. Anyone just compiling should be fine.
TODOs
CHANGELOG.mdupdated for non-trivial changes