Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the IFx session
        /// </summary>
        /// <param name="sessionName">Name of the IFx session</param>
        /// <param name="monitoringAccountName">Name of the IFx monitoring account</param>
        /// <param name="traceDirectory">Directory to store the trace files</param>
        public static void Initialize(string sessionName, string monitoringAccountName, string traceDirectory = null)
        {
            if (sessionName == null)
            {
                throw new ArgumentNullException(nameof(sessionName));
            }

            if (monitoringAccountName == null)
            {
                throw new ArgumentNullException(nameof(monitoringAccountName));
            }

            var instrumentationSpec = new InstrumentationSpecification();
            var auditSpec           = new AuditSpecification();

            instrumentationSpec.EmitIfxMetricsEvents  = true;
            instrumentationSpec.MonitoringAccountName = monitoringAccountName;

            if (traceDirectory != null)
            {
                instrumentationSpec.WriteIfxTracerDiskLogs = true;
                instrumentationSpec.TraceDirectory         = traceDirectory;
            }

            instrumentationSpec.MaxSizeTraceFileInKb           = DefaultMaxTraceFileSizeInKB;
            instrumentationSpec.MaxSizeCompletedTraceFilesInMb = DefaultMaxCompletedTraceFileSizeInMB;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                IfxInitializer.IfxInitialize(
                    sessionName,
                    instrumentationSpec,
                    auditSpec);
            }
        }
Ejemplo n.º 2
0
        private static void InitializeIfx()
        {
            IPAddress[] addresses = Dns.GetHostAddresses(Environment.MachineName);
            string      ipAddress = null;

            foreach (var addr in addresses)
            {
                if (addr.ToString() == "127.0.0.1")
                {
                    continue;
                }
                else if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    ipAddress = addr.ToString();
                    break;
                }
            }
            IfxInitializer.IfxInitialize("gua", "guatest", ipAddress);
        }
Ejemplo n.º 3
0
 private static void InitializeLocalIfx()
 {
     IfxInitializer.IfxInitialize("saianu", "unifiedtestmetrics", "SAI-WORK-PC");
 }