Update exporter extension DI sample#7302
Conversation
|
The human behind this PR needs to sign the CLA. |
| internal static class MyExporterExtensions | ||
| { | ||
| public static TracerProviderBuilder AddMyExporter(this TracerProviderBuilder builder) | ||
| public static TracerProviderBuilder AddMyExporter( |
There was a problem hiding this comment.
Should we consider adding an overload method, so anyone who needs a simpler option can use the current implementation?
There was a problem hiding this comment.
Thanks, yes — I added a follow-up commit that keeps the simple AddMyExporter() overload on the original direct processor path, and makes the DI/options path explicit through overloads that take Action<MyExporterOptions> (optionally with a name).
Verification: git diff --check passes. Full dotnet verification is still blocked locally because this checkout pins SDK 10.0.300 in global.json, and no compatible SDK is installed here.
This follow-up was Codex-assisted, with the final diff reviewed before pushing.
Fixes #4128.
Updates the
MyExporterExtensionssample so it demonstrates the dependency-injection-aware registration pattern described in the same guide.Changes:
AddMyExporterTracerProviderBuilder.ConfigureServicesAddProcessor(serviceProvider => ...)factory overloadOpenTelemetry.Api.ProviderBuilderExtensionsfrom the sample project so the DI builder extensions are availableVerification:
git diff --checkdotnet --versioncould not run because this checkout requires SDK10.0.300viaglobal.json, and no compatible .NET SDK is installed locally.This was implemented with Codex assistance, with the final diff reviewed manually and kept to the exporter registration docs sample.