-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds telemetry pipeline. Adds evaluationevent, publisher interface, and a publisher instance for app insights. * Use await insead of .result * Reverting unused dependency removal * Update src/Microsoft.FeatureManagement/FeatureDefinition.cs Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com> * Update src/Microsoft.FeatureManagement/FeatureDefinition.cs Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com> * Update src/Microsoft.FeatureManagement.AppInsightsTelemetryPublisher/TelemetryPublisherAppInsights.cs Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com> * Removed factory pattern for publisher DI * Update src/Microsoft.FeatureManagement/FeatureManager.cs Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com> * Resolve misc. comments * Adjusts descriptions for FeatureDefinition properties * Rename AppInsights to ApplicationInsights * Resolves project reference in sln * Adjusts ServiceCollectionExtensions to use TryAddSingleton * Removes langversion from .csproj * Temp * Adds explicit null checkts before publishing fields to app insights * Addressing misc. comments * Removing project reference for example project * Syncing telemetry and variants * Adds null check for feature definitions * Adjusted TelemetryPublishers to no longer be inserted into DI * Resolving comments * Removing Application Insights project * Converts some variables to inline * Resolving misc. comments * Moves AddTelemetryPublisher to be an extension method * Removing IVariantFeatureManager GetFeatureNamesAsync definition, as it should it it's own PR * Remove unused dependency * Resolving comments * Remove invisible character changes * Remove Dependency Injection package * Update src/Microsoft.FeatureManagement/FeatureManagerSnapshot.cs * Update src/Microsoft.FeatureManagement/IVariantFeatureManager.cs * Persists cancellation token to PublishEvent and adds null check for null publisher collection * Adds TargetingContext to the EvaluationResult * Resolving comments * Removes TargetingContext from EvaluationEvent for now * Moves tags, etag, and label under 'TelemetryMetadata' * Adjusts telemetry metadata to already be a flattened dictionary * Removes bind in favor of ToDictionary. Removes unused using --------- Co-authored-by: Jimmy Campbell <jimmyca@microsoft.com>
- Loading branch information
1 parent
1828686
commit e7184f2
Showing
12 changed files
with
483 additions
and
182 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
40 changes: 40 additions & 0 deletions
40
src/Microsoft.FeatureManagement/FeatureManagementBuilderExtensions.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.FeatureManagement.Telemetry; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.FeatureManagement | ||
{ | ||
/// <summary> | ||
/// Extensions used to add feature management functionality. | ||
/// </summary> | ||
public static class FeatureManagementBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Adds a telemetry publisher to the feature management system. | ||
/// </summary> | ||
/// <param name="builder">The <see cref="IFeatureManagementBuilder"/> used to customize feature management functionality.</param> | ||
/// <returns>A <see cref="IFeatureManagementBuilder"/> that can be used to customize feature management functionality.</returns> | ||
public static IFeatureManagementBuilder AddTelemetryPublisher<T>(this IFeatureManagementBuilder builder) where T : ITelemetryPublisher | ||
{ | ||
builder.AddTelemetryPublisher(sp => ActivatorUtilities.CreateInstance(sp, typeof(T)) as ITelemetryPublisher); | ||
|
||
return builder; | ||
} | ||
|
||
private static IFeatureManagementBuilder AddTelemetryPublisher(this IFeatureManagementBuilder builder, Func<IServiceProvider, ITelemetryPublisher> factory) | ||
{ | ||
builder.Services.Configure<FeatureManagementOptions>(options => | ||
{ | ||
if (options.TelemetryPublisherFactories == null) | ||
{ | ||
options.TelemetryPublisherFactories = new List<Func<IServiceProvider, ITelemetryPublisher>>(); | ||
} | ||
options.TelemetryPublisherFactories.Add(factory); | ||
}); | ||
|
||
return builder; | ||
} | ||
} | ||
} |
This file contains 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
Oops, something went wrong.