Set sentry environment to be develop/nightly based on config file (#703)
* Set sentry environment to be develop/nightly based on config file Also add details on sqlite version and database migration. The separate ReconfigureSentry class is required because ReconfigureLogging happens before the database has been resolved, so you can't access IMainDatabase there * Set environment to develop/nightly in frontend toopull/710/head
parent
054d1600a2
commit
d5c69d0375
@ -0,0 +1,39 @@
|
||||
using NLog;
|
||||
using NzbDrone.Common.Instrumentation.Sentry;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation
|
||||
{
|
||||
public class ReconfigureSentry : IHandleAsync<ApplicationStartedEvent>
|
||||
{
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
private readonly IMainDatabase _database;
|
||||
|
||||
public ReconfigureSentry(IConfigFileProvider configFileProvider,
|
||||
IMainDatabase database)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Reconfigure()
|
||||
{
|
||||
// Extended sentry config
|
||||
var sentry = LogManager.Configuration.FindTargetByName<SentryTarget>("sentryTarget");
|
||||
sentry.FilterEvents = _configFileProvider.FilterSentryEvents;
|
||||
sentry.UpdateBranch = _configFileProvider.Branch;
|
||||
sentry.DatabaseVersion = _database.Version;
|
||||
sentry.DatabaseMigration = _database.Migration;
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
}
|
||||
|
||||
public void HandleAsync(ApplicationStartedEvent message)
|
||||
{
|
||||
Reconfigure();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue