Added integration to deskmetrics

This commit is contained in:
kay.one 2012-01-25 17:29:55 -08:00
parent b225db9aaf
commit 7a83a46d31
8 changed files with 138 additions and 64 deletions

View File

@ -19,61 +19,6 @@
GetProcessorFrequency Screen resolution GetComponentName GetProcessorFrequency Screen resolution GetComponentName
</summary> </summary>
</member> </member>
<member name="F:DeskMetrics.OperatingSystem.WindowsOperatingSystem._servicePack">
<summary>
Field OS Service Pack
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetFrameworkVersion">
<summary>
GetProcessorFrequency Framework ApplicationVersion GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetArchicteture">
<summary>
GetProcessorFrequency OS Archicteture GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetVersion">
<summary>
GetProcessorFrequency OS ApplicationVersion GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetJavaVersion">
<summary>
GetProcessorFrequency Java version GetComponentName
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.FrameworkVersion">
<summary>
GetProcessorFrequency and Set Framework ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.Architecture">
<summary>
GetProcessorFrequency and Set OS Archicteture
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.Version">
<summary>
GetProcessorFrequency and Set OS ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.FrameworkServicePack">
<summary>
GetProcessorFrequency and Set Frameworl Service Pack
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.JavaVersion">
<summary>
GetProcessorFrequency and Set Java ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.ServicePack">
<summary>
GetProcessorFrequency and Set OS Service Pack
</summary>
</member>
<member name="M:DeskMetrics.IDeskMetricsClient.Start"> <member name="M:DeskMetrics.IDeskMetricsClient.Start">
<summary> <summary>
Starts the application tracking. Starts the application tracking.
@ -159,6 +104,61 @@
The log message The log message
</param> </param>
</member> </member>
<member name="F:DeskMetrics.OperatingSystem.WindowsOperatingSystem._servicePack">
<summary>
Field OS Service Pack
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetFrameworkVersion">
<summary>
GetProcessorFrequency Framework ApplicationVersion GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetArchicteture">
<summary>
GetProcessorFrequency OS Archicteture GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetVersion">
<summary>
GetProcessorFrequency OS ApplicationVersion GetComponentName
</summary>
</member>
<member name="M:DeskMetrics.OperatingSystem.WindowsOperatingSystem.GetJavaVersion">
<summary>
GetProcessorFrequency Java version GetComponentName
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.FrameworkVersion">
<summary>
GetProcessorFrequency and Set Framework ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.Architecture">
<summary>
GetProcessorFrequency and Set OS Archicteture
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.Version">
<summary>
GetProcessorFrequency and Set OS ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.FrameworkServicePack">
<summary>
GetProcessorFrequency and Set Frameworl Service Pack
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.JavaVersion">
<summary>
GetProcessorFrequency and Set Java ApplicationVersion
</summary>
</member>
<member name="P:DeskMetrics.OperatingSystem.WindowsOperatingSystem.ServicePack">
<summary>
GetProcessorFrequency and Set OS Service Pack
</summary>
</member>
<member name="M:DeskMetrics.DeskMetricsClient.Start"> <member name="M:DeskMetrics.DeskMetricsClient.Start">
<summary> <summary>
Starts the application tracking. Starts the application tracking.
@ -244,5 +244,35 @@
The log message The log message
</param> </param>
</member> </member>
<member name="P:DeskMetrics.DeskMetricsClient.Started">
<summary>
Indicates if the Start() has been called and a session is active.
</summary>
</member>
<member name="P:DeskMetrics.DeskMetricsClient.SessionId">
<summary>
Currently active session. will be null if no sessions are active.
</summary>
</member>
<member name="P:DeskMetrics.DeskMetricsClient.ApplicationId">
<summary>
DeskmMtrics Application ID
</summary>
</member>
<member name="P:DeskMetrics.DeskMetricsClient.ApplicationVersion">
<summary>
Version of application being tracked.
</summary>
</member>
<member name="P:DeskMetrics.DeskMetricsClient.Enabled">
<summary>
Checks if application events are tracked.
</summary>
</member>
<member name="P:DeskMetrics.DeskMetricsClient.UserId">
<summary>
Anonymous identifier of the user being tracked.
</summary>
</member>
</members> </members>
</doc> </doc>

View File

@ -20,11 +20,14 @@ namespace NzbDrone.Core
public class CentralDispatch public class CentralDispatch
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly EnviromentProvider _enviromentProvider;
public StandardKernel Kernel { get; private set; } public StandardKernel Kernel { get; private set; }
public CentralDispatch() public CentralDispatch()
{ {
_enviromentProvider = new EnviromentProvider();
Logger.Debug("Initializing Kernel:"); Logger.Debug("Initializing Kernel:");
Kernel = new StandardKernel(); Kernel = new StandardKernel();
@ -42,7 +45,7 @@ namespace NzbDrone.Core
{ {
Logger.Info("Initializing Database..."); Logger.Info("Initializing Database...");
var appDataPath = new EnviromentProvider().GetAppDataPath(); var appDataPath = _enviromentProvider.GetAppDataPath();
if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath); if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath);
var connection = Kernel.Get<Connection>(); var connection = Kernel.Get<Connection>();
@ -57,7 +60,7 @@ namespace NzbDrone.Core
private void InitAnalytics() private void InitAnalytics()
{ {
var deskMetricsClient = new DeskMetricsClient(Kernel.Get<ConfigProvider>().UGuid, AnalyticsProvider.DESKMETRICS_ID, new EnviromentProvider().Version); var deskMetricsClient = new DeskMetricsClient(Kernel.Get<ConfigProvider>().UGuid, AnalyticsProvider.DESKMETRICS_ID, _enviromentProvider.Version);
Kernel.Bind<IDeskMetricsClient>().ToConstant(deskMetricsClient); Kernel.Bind<IDeskMetricsClient>().ToConstant(deskMetricsClient);
Kernel.Get<AnalyticsProvider>().Checkpoint(); Kernel.Get<AnalyticsProvider>().Checkpoint();
} }
@ -107,6 +110,7 @@ namespace NzbDrone.Core
Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope(); Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope();
Kernel.Bind<IJob>().To<TrimLogsJob>().InSingletonScope(); Kernel.Bind<IJob>().To<TrimLogsJob>().InSingletonScope();
Kernel.Bind<IJob>().To<RecentBacklogSearchJob>().InSingletonScope(); Kernel.Bind<IJob>().To<RecentBacklogSearchJob>().InSingletonScope();
Kernel.Bind<IJob>().To<CheckpointJob>().InSingletonScope();
Kernel.Get<JobProvider>().Initialize(); Kernel.Get<JobProvider>().Initialize();
Kernel.Get<WebTimer>().StartTimer(30); Kernel.Get<WebTimer>().StartTimer(30);
@ -129,7 +133,7 @@ namespace NzbDrone.Core
{ {
try try
{ {
var pid = new EnviromentProvider().NzbDroneProcessIdFromEnviroment; var pid = _enviromentProvider.NzbDroneProcessIdFromEnviroment;
Logger.Debug("Attaching to parent process ({0}) for automatic termination.", pid); Logger.Debug("Attaching to parent process ({0}) for automatic termination.", pid);

View File

@ -0,0 +1,39 @@
using System;
using System.Linq;
using Ninject;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
namespace NzbDrone.Core.Jobs
{
public class CheckpointJob : IJob
{
private readonly AnalyticsProvider _analyticsProvider;
[Inject]
public CheckpointJob(AnalyticsProvider analyticsProvider)
{
_analyticsProvider = analyticsProvider;
}
public CheckpointJob()
{
}
public string Name
{
get { return "Checkpoint Job"; }
}
public TimeSpan DefaultInterval
{
get { return TimeSpan.FromDays(1); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
{
_analyticsProvider.Checkpoint();
}
}
}

View File

@ -226,6 +226,7 @@
<Compile Include="Helpers\EpisodeSortingHelper.cs" /> <Compile Include="Helpers\EpisodeSortingHelper.cs" />
<Compile Include="Helpers\FileSizeFormatHelpercs.cs" /> <Compile Include="Helpers\FileSizeFormatHelpercs.cs" />
<Compile Include="Helpers\SortHelper.cs" /> <Compile Include="Helpers\SortHelper.cs" />
<Compile Include="Jobs\CheckpointJob.cs" />
<Compile Include="Providers\AnalyticsProvider.cs" /> <Compile Include="Providers\AnalyticsProvider.cs" />
<Compile Include="Instrumentation\LogDbContext.cs" /> <Compile Include="Instrumentation\LogDbContext.cs" />
<Compile Include="Instrumentation\LogProvider.cs" /> <Compile Include="Instrumentation\LogProvider.cs" />

View File

@ -23,16 +23,16 @@ namespace NzbDrone.Core.Providers
public virtual void Checkpoint() public virtual void Checkpoint()
{ {
if (_deskMetricsClient.Started)
{
_deskMetricsClient.Stop();
}
if (EnviromentProvider.IsNewInstall) if (EnviromentProvider.IsNewInstall)
{ {
_deskMetricsClient.RegisterInstall(); _deskMetricsClient.RegisterInstall();
} }
if (_deskMetricsClient.Started)
{
_deskMetricsClient.Stop();
}
_deskMetricsClient.Start(); _deskMetricsClient.Start();
} }
} }

View File

@ -92,4 +92,4 @@
.t-window-actions .t-state-hover,.t-editor-button .t-state-hover{border-color:#fff;background-color:transparent} .t-window-actions .t-state-hover,.t-editor-button .t-state-hover{border-color:#fff;background-color:transparent}
.t-editor-button .t-state-active{border-color:#fff;background-color:#57b5df} .t-editor-button .t-state-active{border-color:#fff;background-color:#57b5df}
/*rounded corners and shadows*/.t-button,div.t-window,.t-window-titlebar,div.t-window-content,.t-window-titlebar .t-state-hover,.t-tabstrip-items .t-item,.t-panelbar .t-tabstrip-items .t-item,.t-pager .t-state-active,.t-pager .t-state-hover,.t-grid .t-filter-options,.t-grouping-header .t-group-indicator,.t-treeview .t-state-hover,.t-treeview .t-state-selected,.t-colorpicker .t-selected-color,.t-editor-button .t-state-hover,.t-editor-button .t-state-active,.t-drag-clue,.t-tooltip,.t-dropzone,.t-upload-files,.t-progress,.t-progress-status,.t-tile{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0} /*rounded corners and shadows*/.t-button,div.t-window,.t-window-titlebar,div.t-window-content,.t-window-titlebar .t-state-hover,.t-tabstrip-items .t-item,.t-panelbar .t-tabstrip-items .t-item,.t-pager .t-state-active,.t-pager .t-state-hover,.t-grid .t-filter-options,.t-grouping-header .t-group-indicator,.t-treeview .t-state-hover,.t-treeview .t-state-selected,.t-colorpicker .t-selected-color,.t-editor-button .t-state-hover,.t-editor-button .t-state-active,.t-drag-clue,.t-tooltip,.t-dropzone,.t-upload-files,.t-progress,.t-progress-status,.t-tile{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}
.t-popup,.t-menu .t-group,div.t-window,.t-imagebrowser .t-image{-moz-box-shadow:0;-webkit-box-shadow:0;box-shadow:0} .t-popup,.t-menu .t-group,div.t-window,.t-imagebrowser .t-image{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}