-
Notifications
You must be signed in to change notification settings - Fork 19
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
Introduce OpenFeature.Extensions.Hosting
package
#264
Comments
Ran across this while working on open-feature/dotnet-sdk-contrib#127, but tldr; libraries don't need the implementation package, so reduce to the abstractions package to remove transitive dependencies on: - Microsoft.Extensions.DependencyInjection - Microsoft.Extensions.Options - (and a few others depending on the TFM) Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, but tldr; libraries don't need the implementation package, so reduce to the abstractions package to remove transitive dependencies on: - Microsoft.Extensions.DependencyInjection - Microsoft.Extensions.Options - (and a few others depending on the TFM) Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, but tldr; libraries don't need the implementation package, so reduce to the abstractions package to remove transitive dependencies on: - Microsoft.Extensions.DependencyInjection - Microsoft.Extensions.Options - (and a few others depending on the TFM) Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
Ran across this while working on open-feature/dotnet-sdk-contrib#127, and tldr; if there's more than one project under `src/`, having the `<PackageId>` hard-coded in `build/Common.prod.props` causes MSBuild to panic. There are two options to fix this: 1. ```diff - <PackageId>OpenFeature</PackageId> + <PackageId>$(MSBuildProjectName)</PackageId> ``` 2. ```diff - <PackageId>OpenFeature</PackageId> ``` Since NuGet defaults `PackageId` to the assembly name, I'm opting for (2), but if I've overlooked some nuance/custom build steps that require setting `PackageId` explicitly, then we could just as well fallback to (1). Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
See: open-feature/dotnet-sdk-contrib#127 Signed-off-by: Austin Drenski <[email protected]>
Hey guys, I noticed this was added to the 2.0 release although I don't see it in the changelog. I suspect this was scoped out of 2.0. The abstractions provided would be useful! Do you have plans to include it in a future release? If so, is there anything I can do to help? Thanks! |
Hey @kylejuliandev, @askpt is working on a draft PR. Feel free to review the PR and provide feedback. |
Hello everyone, At ServiceTitan, we're in the process of integrating OpenFeature with LaunchDarkly, and after reviewing this PR, I made some modifications to fit our needs due to time constraints. I created a new package, which we're currently using internally. During this process, I rewrote certain sections and noticed that the dependency on "Hosting" seemed unnecessary. I've since separated the project into two packages: DependencyInjection and Hosting, and introduced the following interface in the DependencyInjection package: /// <summary>
/// Defines the contract for managing the lifecycle of a feature API.
/// </summary>
public interface IFeatureLifecycleManager
{
/// <summary>
/// Ensures the feature provider is properly initialized and ready for use.
/// </summary>
/// <param name="cancellationToken">Cancellation token for the operation.</param>
/// <returns>A Task for the asynchronous initialization operation.</returns>
ValueTask EnsureInitializedAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Gracefully shuts down the feature API.
/// </summary>
/// <param name="cancellationToken">Cancellation token for the operation.</param>
/// <returns>A Task for the asynchronous shutdown operation.</returns>
ValueTask ShutdownAsync(CancellationToken cancellationToken = default);
} I’d love to share the full code and gather your feedback. If it aligns with the direction of OpenFeature, we can explore how to integrate it directly. |
Thanks @arttonoyan ! Frankly, most of my experience in .NET dependency injection is based on older libraries, namely the Unity container. I'm not yet up-to-date on At the end of the day, I think we want:
I'm not sure if it's necessary to use abstractions from both of these packages to accomplish the above - we may only need the DI package. |
Thank you, @toddbaert, for your response. It would certainly be ideal to have Dependency Injection (DI) directly implemented in the OpenFeature package. However, since that's not available at the moment, I believe it's important not to modify the core code just yet. For now, having a separate DI package makes integration easier and quicker without tightly coupling it to the main codebase. I've already implemented this approach with a separate package, though the specific name isn't important - it could be something like A good reason for not merging the DI and Hosting packages is that Dependency Injection (DI) focuses on providing a mechanism to resolve services during application setup, which can be used independently of runtime environments. Moreover, DI and hosting are fundamentally different concerns. In many cases, teams might want to manage services separately, or there might be different hosting versions in use. In such cases, it would be better to have a separate package for DI, without forcing teams to adopt Also, in this case, we can add settings to configure the Anyway, this is just my opinion, and there may be better arguments for why Hosting should be included. Currently, we are using the following packages, and many teams have already adopted this setup successfully: dotnet add package ServiceTitan.Standalone.Platform.OpenFeature
dotnet add package ServiceTitan.Standalone.Platform.OpenFeature.Hosting
dotnet add package ServiceTitan.Standalone.Platform.OpenFeature.LaunchDarkly Here is a simple Setup:builder.Services.AddOpenFeature(featureBuilder => {
featureBuilder
.AddHostedFeatureLifecycle() // From Hosting package
.AddContext((context, serviceProvider) => {
// Context settings are applied here. Each feature flag evaluation will
// automatically have access to these context parameters.
// Do something with the service provider.
context
.Set("kind", "tenant")
.Set("key", "<some key>")
})
.AddLaunchDarkly(builder.Configuration["LaunchDarkly:SdkKey"], cfg => cfg.StartWaitTime(TimeSpan.FromSeconds(10)));
}); This approach has worked well for us, and I believe it provides flexibility for teams that may want to keep DI and hosting concerns separate. |
@arttonoyan, I would be more than happy if you could add a PR for the DI implementation. At the moment, I am fighting the I understand your points around |
Thanks, @askpt! I'll create the PR within the next two days. This is our first simple version, and it currently covers our needs. However, I believe that in the near future, we will require a multi-provider version to connect to different projects in LaunchDarkly (as each project has its own SDK key). We will also need to use event handling. |
Team! @askpt @toddbaert @kinyoklion @lukas-reining |
Originally posted by @austindrenski in open-feature/dotnet-sdk-contrib#125 (comment)
The text was updated successfully, but these errors were encountered: