Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

No default environment in exe-hosting #44

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Vostok.Hosting/VostokHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public async Task StartAsync(string shutdownMessage = null)
{
VostokHostingEnvironment.Current = HostingEnvironment;
HostingEnvironment.Log.Info($"Starting service: {HostingEnvironment.Project}/{HostingEnvironment.Service}");
HostingEnvironment.Log.Info($"Environment: {HostingEnvironment.Environment}");
if (string.IsNullOrEmpty(HostingEnvironment.Environment))
HostingEnvironment.Log.Warn("Environment: <unspecified>. Attention! No metrics/logs/traces will be sent to airlock!");
else
HostingEnvironment.Log.Info($"Environment: {HostingEnvironment.Environment}");

try
{
Expand Down
4 changes: 1 addition & 3 deletions Vostok.Hosting/VostokHostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public IVostokHost Build()
var hostConfigurator = new HostConfigurator(hostingEnvironment);
foreach (var configurationDelegate in configureHostDelegates)
configurationDelegate(context, hostConfigurator);
if (string.IsNullOrEmpty(hostingEnvironment.Environment))
hostingEnvironment.Environment = VostokEnvironmentNames.Production;

var airlockConfigurator = new AirlockConfigurator();
foreach (var configurationDelegate in configureAirlockDelegates)
Expand All @@ -103,7 +101,7 @@ public IVostokHost Build()
var metricsConfigurator = new MetricsConfigurator(metricConfiguration);
foreach (var configurationDelegate in configureMetricsDelegates)
configurationDelegate(context, metricsConfigurator);
metricConfiguration.Reporter = new AirlockMetricReporter(hostingEnvironment.AirlockClient, RoutingKey.CreatePrefix(hostingEnvironment.Project, hostingEnvironment.Environment, hostingEnvironment.Service));
metricConfiguration.Reporter = new AirlockMetricReporter(hostingEnvironment.AirlockClient, RoutingKey.TryCreatePrefix(hostingEnvironment.Project, hostingEnvironment.Environment, hostingEnvironment.Service));
hostingEnvironment.MetricScope = new RootMetricScope(metricConfiguration);

return new VostokHost(hostingEnvironment, new TApp());
Expand Down