-
Notifications
You must be signed in to change notification settings - Fork 114
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
Adds telemetry pipeline #259
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
1f0644d
Adds telemetry pipeline. Adds evaluationevent, publisher interface, a…
rossgrambo 614e9af
Use await insead of .result
rossgrambo 4db49a3
Reverting unused dependency removal
rossgrambo 75cab57
Update src/Microsoft.FeatureManagement/FeatureDefinition.cs
rossgrambo f8e4f7b
Update src/Microsoft.FeatureManagement/FeatureDefinition.cs
rossgrambo 7c77718
Update src/Microsoft.FeatureManagement.AppInsightsTelemetryPublisher/…
rossgrambo 52930c0
Removed factory pattern for publisher DI
rossgrambo cb18586
Update src/Microsoft.FeatureManagement/FeatureManager.cs
rossgrambo 121ca35
Resolve misc. comments
rossgrambo 20b5f82
Merge branch 'rossgrambo/telemetry' of https://github.com/microsoft/F…
rossgrambo e025642
Adjusts descriptions for FeatureDefinition properties
rossgrambo 8ad67b7
Rename AppInsights to ApplicationInsights
rossgrambo fce7274
Resolves project reference in sln
rossgrambo d23357c
Adjusts ServiceCollectionExtensions to use TryAddSingleton
rossgrambo e43e114
Removes langversion from .csproj
rossgrambo 93a88a3
Temp
rossgrambo ba22ed1
Adds explicit null checkts before publishing fields to app insights
rossgrambo 0b5bea4
Addressing misc. comments
rossgrambo 2bfcbc8
Removing project reference for example project
rossgrambo 6cf2ee6
Merge with preview
rossgrambo 5b1842f
Syncing telemetry and variants
rossgrambo ecc898d
Adds null check for feature definitions
rossgrambo 39dd606
Adjusted TelemetryPublishers to no longer be inserted into DI
rossgrambo 9cf586a
Resolving comments
rossgrambo 78d3ba2
Removing Application Insights project
rossgrambo ac3630c
Converts some variables to inline
rossgrambo 0388134
Resolving misc. comments
rossgrambo 2ff83ac
Moves AddTelemetryPublisher to be an extension method
rossgrambo 4a5b135
Removing IVariantFeatureManager GetFeatureNamesAsync definition, as i…
rossgrambo b6e8df0
Remove unused dependency
rossgrambo f70513f
Resolving comments
rossgrambo bf151ac
Remove invisible character changes
rossgrambo edbb8d5
Remove Dependency Injection package
rossgrambo e94ad7f
Update src/Microsoft.FeatureManagement/FeatureManagerSnapshot.cs
rossgrambo 8b0f3ba
Update src/Microsoft.FeatureManagement/IVariantFeatureManager.cs
rossgrambo 5df39c8
Persists cancellation token to PublishEvent and adds null check for n…
rossgrambo 982f313
Adds TargetingContext to the EvaluationResult
rossgrambo 505d834
Resolving comments
rossgrambo fb055fc
Removes TargetingContext from EvaluationEvent for now
rossgrambo 6c3a3ea
Merge branch 'preview' into rossgrambo/telemetry
rossgrambo 7d00c6d
Moves tags, etag, and label under 'TelemetryMetadata'
rossgrambo 9386f6a
Adjusts telemetry metadata to already be a flattened dictionary
rossgrambo 8b8cb74
Removes bind in favor of ToDictionary. Removes unused using
rossgrambo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,10 @@ We support | |
|
||
var enabledFor = new List<FeatureFilterConfiguration>(); | ||
|
||
bool telemetryEnabled = false; | ||
|
||
Dictionary<string, string> telemetryMetadata = null; | ||
|
||
string val = configurationSection.Value; // configuration[$"{featureName}"]; | ||
|
||
if (string.IsNullOrEmpty(val)) | ||
|
@@ -283,6 +287,17 @@ We support | |
variants.Add(variant); | ||
} | ||
} | ||
|
||
telemetryEnabled = configurationSection.GetValue<bool>("TelemetryEnabled"); | ||
|
||
IConfigurationSection telemetryMetadataSection = configurationSection.GetSection("TelemetryMetadata"); | ||
rossgrambo marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should "TelemetryMetadata" be moved into ConfigurationFields.cs as a const string? |
||
|
||
if (telemetryMetadataSection.Exists()) | ||
{ | ||
telemetryMetadata = new Dictionary<string, string>(); | ||
|
||
telemetryMetadata = telemetryMetadataSection.GetChildren().ToDictionary(x => x.Key, x => x.Value); | ||
} | ||
} | ||
|
||
return new FeatureDefinition() | ||
|
@@ -292,7 +307,9 @@ We support | |
RequirementType = requirementType, | ||
Status = featureStatus, | ||
Allocation = allocation, | ||
Variants = variants | ||
Variants = variants, | ||
TelemetryEnabled = telemetryEnabled, | ||
TelemetryMetadata = telemetryMetadata | ||
}; | ||
} | ||
|
||
|
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 | ||
rossgrambo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "TelemetryEnabled" be moved into ConfigurationFields.cs as a const string?