Skip to content

Commit

Permalink
Add support for IDeferredTracerProviderBuilder for InMemoryExporter (#…
Browse files Browse the repository at this point in the history
…2129)

* Add support for IDeferredTracerProviderBuilder

* Update CHANGELOG.md
  • Loading branch information
utpilla authored Jul 12, 2021
1 parent dd8cee1 commit 5b06d2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Exporter.InMemory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ please check the latest changes

## Unreleased

* Supports OpenTelemetry.Extensions.Hosting based configuration for `InMemoryExporter`
([#2129](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2129))

## 1.1.0-rc1

Released 2021-Jun-25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public static TracerProviderBuilder AddInMemoryExporter(this TracerProviderBuild
throw new ArgumentNullException(nameof(exportedItems));
}

if (builder is IDeferredTracerProviderBuilder deferredTracerProviderBuilder)
{
return deferredTracerProviderBuilder.Configure((sp, builder) =>
{
builder.AddProcessor(new SimpleActivityExportProcessor(new InMemoryExporter<Activity>(exportedItems)));
});
}

return builder.AddProcessor(new SimpleActivityExportProcessor(new InMemoryExporter<Activity>(exportedItems)));
}
}
Expand Down

0 comments on commit 5b06d2a

Please sign in to comment.