Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
karolz-ms committed Feb 28, 2017
1 parent bed899c commit ae91d82
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
using System.Text.RegularExpressions;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.ServiceFabric;
using Validation;

namespace Microsoft.Diagnostics.EventFlow.ServiceFabric
{
public static class ServiceFabricDiagnosticPipelineFactory
{
public static readonly string ConfigurationPackageName = "Config";
public static readonly string FabricConfigurationValueReference = @"servicefabric:/(?<section>\w+)/(?<name>\w+)";

public static DiagnosticPipeline CreatePipeline(string healthEntityName, string configurationFileName = "eventFlowConfig.json")
Expand All @@ -29,7 +29,7 @@ public static DiagnosticPipeline CreatePipeline(string healthEntityName, string
var healthReporter = new ServiceFabricHealthReporter(healthEntityName);

CodePackageActivationContext activationContext = FabricRuntime.GetActivationContext();
ConfigurationPackage configPackage = activationContext.GetConfigurationPackageObject(ConfigurationPackageName);
ConfigurationPackage configPackage = activationContext.GetConfigurationPackageObject(ServiceFabricConfigurationProvider.DefaultConfigurationPackageName);
string configFilePath = Path.Combine(configPackage.Path, configurationFileName);
if (!File.Exists(configFilePath))
{
Expand All @@ -40,7 +40,7 @@ public static DiagnosticPipeline CreatePipeline(string healthEntityName, string

ConfigurationBuilder configBuilder = new ConfigurationBuilder();
configBuilder.AddJsonFile(configFilePath);
configBuilder.AddServiceFabric(ConfigurationPackageName);
configBuilder.AddServiceFabric(ServiceFabricConfigurationProvider.DefaultConfigurationPackageName);
IConfigurationRoot configurationRoot = configBuilder.Build().ApplyFabricConfigurationOverrides(healthReporter);

return DiagnosticPipelineFactory.CreatePipeline(configurationRoot, new ServiceFabricHealthReporter(healthEntityName));
Expand Down Expand Up @@ -82,6 +82,9 @@ internal static IConfigurationRoot ApplyFabricConfigurationOverrides(this IConfi
}
catch (RegexMatchTimeoutException)
{
healthReporter.ReportWarning(
$"Configuration entry with key '{kvp.Key}' and value '{kvp.Value}' could not be checked if it represents a configuration value reference--a timeout occurred when the value was being parsed.",
EventFlowContextIdentifiers.Configuration);
continue;
}
}
Expand Down

0 comments on commit ae91d82

Please sign in to comment.