public Pms5003Worker(ILogger <Pms5003Worker> logger, Telemetry.Telemetry telemetry, ISensor <Pms5003Sensor> sensor, IOptions <Pms5003Config> options) { Logger = logger; MeasurementInterval = options.Value.MeasurementInterval; TelemetryPublisher = telemetry.Publisher; Sensor = sensor.Object; }
public HeartbeatWorker(ILogger <HeartbeatWorker> logger, Telemetry.Telemetry telemetry, ISensor <HeartbeatSensor> sensor, IOptions <HeartbeatConfig> options) { Logger = logger; MeasurementInterval = options.Value.MeasurementInterval; TelemetryPublisher = telemetry.Publisher; Sensor = sensor.Object; }
private string[] GetArgsForMSBuild(Func <bool> sentinelExists, out Telemetry.Telemetry telemetry) { Telemetry.Telemetry.DisableForTests(); // reset static session id modified by telemetry constructor telemetry = new Telemetry.Telemetry(new MockFirstTimeUseNoticeSentinel(sentinelExists)); MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty <string>()); var forwardingAppWithoutLogging = msBuildForwardingApp .GetType() .GetField("_forwardingAppWithoutLogging", BindingFlags.Instance | BindingFlags.NonPublic) ?.GetValue(msBuildForwardingApp) as Cli.Utils.MSBuildForwardingAppWithoutLogging; return(forwardingAppWithoutLogging?.GetAllArguments()); }
Environment.GetEnvironmentVariable("APPVEYOR").HasValue(); // https://www.appveyor.com/docs/environment-variables/ private void InitTelemetry(GeneratorExecutionContext context) { var telemetryOptOut = context.GetMSBuildPropertyValue("UnoPlatformTelemetryOptOut"); bool?isTelemetryOptout() => telemetryOptOut.Equals("true", StringComparison.OrdinalIgnoreCase) || telemetryOptOut.Equals("1", StringComparison.OrdinalIgnoreCase); _telemetry = new Telemetry.Telemetry(isTelemetryOptout); if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information)) { this.Log().InfoFormat($"Telemetry enabled: {_telemetry.Enabled}"); } }
Environment.GetEnvironmentVariable("APPVEYOR").HasValue(); // https://www.appveyor.com/docs/environment-variables/ private void InitTelemetry(ProjectInstance msbProject) { var telemetryOptOut = msbProject.GetProperty("UnoPlatformTelemetryOptOut")?.EvaluatedValue ?? ""; bool?isTelemetryOptout() => telemetryOptOut.Equals("true", StringComparison.OrdinalIgnoreCase) || telemetryOptOut.Equals("1", StringComparison.OrdinalIgnoreCase); _telemetry = new Telemetry.Telemetry(isTelemetryOptout); if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information)) { this.Log().InfoFormat($"Telemetry enabled: {_telemetry.Enabled}"); } }
Environment.GetEnvironmentVariable("APPVEYOR").HasValue(); // https://www.appveyor.com/docs/environment-variables/ private void InitTelemetry(GeneratorExecutionContext context) { var telemetryOptOut = context.GetMSBuildPropertyValue("UnoPlatformTelemetryOptOut"); bool?isTelemetryOptout() => telemetryOptOut.Equals("true", StringComparison.OrdinalIgnoreCase) || telemetryOptOut.Equals("1", StringComparison.OrdinalIgnoreCase) || _isDesignTimeBuild; _telemetry = new Telemetry.Telemetry(isTelemetryOptout); #if DEBUG Console.WriteLine($"Telemetry enabled: {_telemetry.Enabled}"); #endif }
private string[] GetArgsForMSBuild(Func <bool> sentinelExists, out Telemetry.Telemetry telemetry) { Telemetry.Telemetry.CurrentSessionId = null; // reset static session id modified by telemetry constructor telemetry = new Telemetry.Telemetry(new MockNuGetCacheSentinel(sentinelExists)); MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty <string>()); object forwardingAppWithoutLogging = msBuildForwardingApp .GetType() .GetField("_forwardingAppWithoutLogging", BindingFlags.Instance | BindingFlags.NonPublic) ?.GetValue(msBuildForwardingApp); FieldInfo forwardingAppFieldInfo = forwardingAppWithoutLogging .GetType() .GetField("_forwardingApp", BindingFlags.Instance | BindingFlags.NonPublic); object forwardingApp = forwardingAppFieldInfo?.GetValue(forwardingAppWithoutLogging); FieldInfo allArgsFieldinfo = forwardingApp? .GetType() .GetField("_allArgs", BindingFlags.Instance | BindingFlags.NonPublic); return(allArgsFieldinfo?.GetValue(forwardingApp) as string[]); }