Exemple #1
0
        static void Main(string[] args)
        {
            // Configure the tracer
            using (_tracerFactory = TracerFactory.Create(

                       // set up jaeger exporter
                       builder => builder.UseJaeger(o =>
            {
                o.ServiceName = "jaeger-test";
                o.AgentHost = "localhost";
            })))
            {
                // Get the tracer
                var tracer = _tracerFactory.GetTracer("jaeger-test");

                // Start an active span. It will end automatically when using statement ends
                using (tracer.StartActiveSpan("Main", out var span))
                {
                    Console.WriteLine("About to do a busy work");
                    for (int i = 0; i < 10; i++)
                    {
                        DoWork(i);
                    }
                }
            }

            // Gracefully shutdown the exporter so it'll flush queued traces to Jaeger.
            _tracerFactory.Dispose();

            Console.WriteLine("Press any key to exit!");
            Console.ReadKey();
        }
Exemple #2
0
 protected void Application_End()
 {
     tracerFactory?.Dispose();
 }