Fold telemetry listener creation to non-platform specific code

Now the telemetry daemon listener is not platform specific, and there is
only one listener for telemetry, we can remove the API from
`GVFSPlatform` and just construct the `TelemetryDaemonEL` in the
`JsonTracer`.
This commit is contained in:
Matthew John Cheetham 2019-02-22 10:09:42 +00:00
Родитель cbe5787db2
Коммит 235cf14a49
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C64BA810D2B517ED
5 изменённых файлов: 16 добавлений и 40 удалений

Просмотреть файл

@ -51,8 +51,6 @@ namespace GVFS.Common
public abstract bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error);
public abstract bool TryInstallGitCommandHooks(GVFSContext context, string executingDirectory, string hookName, string commandHookPath, out string errorMessage);
public abstract IEnumerable<EventListener> CreateTelemetryListeners(string providerName, string enlistmentId, string mountId);
public abstract bool TryVerifyAuthenticodeSignature(string path, out string subject, out string issuer, out string error);
public abstract Dictionary<string, string> GetPhysicalDiskInfo(string path, bool sizeStatsOnly);

Просмотреть файл

@ -44,8 +44,20 @@ namespace GVFS.Common.Tracing
{
if (!disableTelemetry)
{
IEnumerable<EventListener> telemetryListeners = GVFSPlatform.Instance.CreateTelemetryListeners(providerName, enlistmentId, mountId);
this.listeners.AddRange(telemetryListeners);
string gitBinRoot = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath();
// If we do not have a git binary, then we cannot check if we should set up telemetry
// We also cannot log this, as we are setting up tracer.
if (string.IsNullOrEmpty(gitBinRoot))
{
return;
}
TelemetryDaemonEventListener daemonListener = TelemetryDaemonEventListener.CreateIfEnabled(gitBinRoot, providerName, enlistmentId, mountId);
if (daemonListener != null)
{
this.listeners.Add(daemonListener);
}
}
}

Просмотреть файл

@ -89,17 +89,6 @@ namespace GVFS.Platform.Mac
return pipe;
}
public override IEnumerable<EventListener> CreateTelemetryListeners(string providerName, string enlistmentId, string mountId)
{
string gitBinRoot = this.GitInstallation.GetInstalledGitBinPath();
TelemetryDaemonEventListener daemonListener = TelemetryDaemonEventListener.CreateIfEnabled(gitBinRoot, providerName, enlistmentId, mountId);
if (daemonListener != null)
{
yield return daemonListener;
}
}
public override string GetCurrentUser()
{
throw new NotImplementedException();

Просмотреть файл

@ -75,24 +75,6 @@ namespace GVFS.Platform.Windows
return true;
}
public override IEnumerable<EventListener> CreateTelemetryListeners(string providerName, string enlistmentId, string mountId)
{
string gitBinRoot = this.GitInstallation.GetInstalledGitBinPath();
// If we do not have a git binary, then we cannot check if we should set up telemetry
// We also cannot log this, as we are setting up tracer.
if (string.IsNullOrEmpty(gitBinRoot))
{
yield break;
}
TelemetryDaemonEventListener daemonListener = TelemetryDaemonEventListener.CreateIfEnabled(gitBinRoot, providerName, enlistmentId, mountId);
if (daemonListener != null)
{
yield return daemonListener;
}
}
public override void InitializeEnlistmentACLs(string enlistmentPath)
{
// The following permissions are typically present on deskop and missing on Server

Просмотреть файл

@ -58,11 +58,6 @@ namespace GVFS.UnitTests.Mock.Common
throw new NotSupportedException();
}
public override IEnumerable<EventListener> CreateTelemetryListeners(string providerName, string enlistmentId, string mountId)
{
yield return new MockListener(EventLevel.Verbose, Keywords.Telemetry);
}
public override string GetCurrentUser()
{
throw new NotSupportedException();