Example #1
0
 public AzModule(ICommandRuntime runtime, IEventStore store, TelemetryProvider provider)
 {
     _deferredEvents = store;
     _runtime        = runtime;
     _logger         = new AdalLogger(_deferredEvents.GetDebugLogger());;
     _telemetry      = provider;
 }
Example #2
0
 public AzModule(ICommandRuntime runtime, IEventStore eventHandler)
 {
     _runtime        = runtime;
     _deferredEvents = eventHandler;
     _logger         = new AdalLogger(_deferredEvents.GetDebugLogger());
     _telemetry      = TelemetryProvider.Create(
         _deferredEvents.GetWarningLogger(), _deferredEvents.GetDebugLogger());
 }
 public AzModule(ICommandRuntime runtime)
 {
     _runtime         = runtime;
     _telemetryEvents = new Dictionary <string, AzurePSQoSEvent>(StringComparer.OrdinalIgnoreCase);
     _warningMessages = new ConcurrentQueue <string>();
     _debugMessages   = new ConcurrentQueue <string>();
     _logger          = new AdalLogger((message) => _debugMessages.CheckAndEnqueue(message));
     _metricHelper    = TelemetryProvider.Create((message) => _warningMessages.CheckAndEnqueue(message), (message) => _debugMessages.CheckAndEnqueue(message));
 }
Example #4
0
 /// <summary>
 /// Free resources associated with this instance - allows customization in extending types
 /// </summary>
 /// <param name="disposing">True if the data should be disposed - differentiates from IDisposable call</param>
 public virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _telemetry?.Flush();
         _telemetry?.Dispose();
         _telemetry = null;
         _logger?.Dispose();
         _logger = null;
         _deferredEvents?.Dispose();
         _deferredEvents = null;
     }
 }
Example #5
0
        public UserAgent(InvocationInfo invocation)
        {
            List <ProductInfoHeaderValue> list = new List <ProductInfoHeaderValue>();
            string azVersion = (String.IsNullOrWhiteSpace(AzurePSCmdlet.AzVersion)) ? "0.0.0" : AzurePSCmdlet.AzVersion;

            list.Add(new ProductInfoHeaderValue("AzurePowershell", $"v{azVersion}"));
            if (!String.IsNullOrWhiteSpace(AzurePSCmdlet.PowerShellVersion))
            {
                list.Add(new ProductInfoHeaderValue("PSVersion", $"v{AzurePSCmdlet.PowerShellVersion}"));
            }
            string moduleName    = TelemetryProvider.TrimModuleName(invocation?.MyCommand?.ModuleName);
            string moduleVersion = TelemetryProvider.TrimModuleVersion(invocation?.MyCommand?.Module?.Version);

            if (!string.IsNullOrWhiteSpace(moduleName))
            {
                list.Add(new ProductInfoHeaderValue(moduleName, moduleVersion));
            }
            _userAgents = list.ToArray();
        }