Пример #1
0
        public static void Main(string[] args)
        {
            var directory = Directory.GetCurrentDirectory();

            var host = new WebHostBuilder()
                       .UseKestrel(serverOptions =>
                                   // Explicitly set AllowSynchronousIO to true since the default changes
                                   // between AspNetCore 2.0 and 3.0
                                   serverOptions.AllowSynchronousIO = true
                                   )
                       .UseContentRoot(directory)
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .Build();

            var logger = host.Services.GetRequiredService <ILogger <Program> >();

            logger.LogInformation($"Instrumentation.ProfilerAttached = {SampleHelpers.IsProfilerAttached()}");

            var envVars = SampleHelpers.GetDatadogEnvironmentVariables();

            foreach (var kvp in envVars)
            {
                logger.LogInformation($"{kvp.Key} = {kvp.Value}");
            }

            host.Run();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine($"Profiler attached: {SampleHelpers.IsProfilerAttached()}");
            Console.WriteLine($"Platform: {(Environment.Is64BitProcess ? "x64" : "x32")}");

            var newDocument = new BsonDocument
            {
                { "name", "MongoDB" },
                { "type", "Database" },
                { "count", 1 },
                {
                    "info", new BsonDocument
                    {
                        { "x", 203 },
                        { "y", 102 }
                    }
                }
            };


            using (var mainScope = SampleHelpers.CreateScope("Main()"))
            {
                var connectionString = $"mongodb://{Host()}:27017";
                var client           = new MongoClient(connectionString);
                var database         = client.GetDatabase("test-db");
                var collection       = database.GetCollection <BsonDocument>("employees");

                Run(collection, newDocument);
                RunAsync(collection, newDocument).Wait();

#if MONGODB_2_2 && !MONGODB_2_15
                WireProtocolExecuteIntegrationTest(client);
#endif
            }
        }
Пример #3
0
        public IActionResult Index()
        {
            ViewBag.ProfilerAttached       = SampleHelpers.IsProfilerAttached();
            ViewBag.TracerAssemblyLocation = SampleHelpers.GetTracerAssemblyLocation();

            var envVars = SampleHelpers.GetDatadogEnvironmentVariables();

            return(View(envVars.ToList()));
        }
Пример #4
0
        public IActionResult Index()
        {
            ViewBag.ProfilerAttached       = SampleHelpers.IsProfilerAttached();
            ViewBag.TracerAssemblyLocation = SampleHelpers.GetTracerAssemblyLocation();
            ViewBag.StackTrace             = StackTraceHelper.GetUsefulStack();

            var envVars = SampleHelpers.GetDatadogEnvironmentVariables();

            AddCorrelationIdentifierToResponse();
            return(View(envVars.ToList()));
        }
Пример #5
0
        public static void Main(string[] args)
        {
            if (Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING") == "1" ||
                Environment.GetEnvironmentVariable("CORECLR_ENABLE_PROFILING") == "1")
            {
                bool isAttached = SampleHelpers.IsProfilerAttached();
                Console.WriteLine(" * Checking if the profiler is attached: {0}", isAttached);
                if (!isAttached)
                {
                    Console.WriteLine("Error: Profiler is required and is not loaded.");
                    Environment.Exit(1);
                    return;
                }
            }
            else
            {
                Console.WriteLine(" * Running without profiler.");
            }

            Console.WriteLine();

            CreateHostBuilder(args).Build().Run();
        }