public static async Task Main(string[] args) { //using (ILoggerFactory loggerFactory = new LoggerFactory().AddConsole()) using (ILoggerFactory loggerFactory = NullLoggerFactory.Instance) using (Tracer tracer = Tracing.Init("Client-app", loggerFactory)) { // You can use the OpenTracing.Mock.MockTracer in the unit test. // Register tracer globally. GlobalTracer.Register(tracer); IServiceCollection services = new ServiceCollection(); services .AddHelloClient() .AddSingleton <ITracer>(tracer); using (ServiceProvider serviceProvider = services.BuildServiceProvider()) { IHelloClient helloClient = serviceProvider.GetRequiredService <IHelloClient>(); using (IScope scope = tracer.BuildActiveSpan("Parallel-tasks")) { IEnumerable <Task> tasks = Enumerable.Range(1, 5).Select(n => helloClient.SayHello($"Balazs #{n}")); await Task.WhenAll(tasks); } } } }
public static void Main(string[] args) { if (args.Length != 1) { args = new string[] { "OpenTrace" } } ; using (var loggerFactory = new LoggerFactory().AddConsole()) { var helloTo = args[0]; using (var tracer = Tracing.Init("hello-world", loggerFactory)) { new Hello(tracer, loggerFactory).SayHello(helloTo); } } //this will keep the window open when running the project inside VS2017 if (System.Diagnostics.Debugger.IsAttached) { Console.WriteLine("\nPress any key to exit"); Console.ReadKey(); } } }
public static void Main(string[] args) { using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); using Tracer tracer = Tracing.Init("client", loggerFactory); // using OpenTracing.Contrib.Grpc.Interceptors; ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor(tracer); Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); // using Grpc.Core.Interceptors; //var client = new Greeter.GreeterClient(channel); var client = new Greeter.GreeterClient(channel.Intercept(tracingInterceptor)); // if we want to use the same traced channel for multiple clients, it's better to just get one instance. //CallInvoker callInvoker = channel.Intercept(tracingInterceptor); //var client = new Greeter.GreeterClient(callInvoker); String user = "******"; var reply = client.SayHello(new HelloRequest { Name = user }); Console.WriteLine("Greeting: " + reply.Message); channel.ShutdownAsync().Wait(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public Startup(IConfiguration configuration) { Configuration = configuration; // 생성 LoggerFactor = LoggerFactory.Create(builder => builder.AddConsole()); Tracer = Tracing.Init("Webservice", LoggerFactor); }
public void DrawPath(List <PointF> _Points, System.Drawing.Brush _Brush, float _Thickness) { Tracing.Init(ref Strip.Tracing, (int)cnvTracing.ActualWidth, (int)cnvTracing.ActualHeight); Tracing.DrawPath(_Points, Strip.Tracing, new System.Drawing.Pen(_Brush, _Thickness), System.Drawing.Color.Black, drawOffset, drawMultiplier); imgTracing.Source = Trace.BitmapToImageSource(Strip.Tracing); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSingleton <ITracer>(serviceProvider => { var tracer = Tracing.Init("Delivery"); GlobalTracer.Register(tracer); return(tracer); }); }
static void Main(string[] args) { if (args.Length != 1) { throw new ArgumentException("Expecting one argument"); } using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); using Tracer tracer = Tracing.Init("hello-world", loggerFactory); new Hello(tracer, loggerFactory).SayHello(args[0]); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSingleton <ITracer>(serviceProvider => { var tracer = Tracing.Init("Shopping"); GlobalTracer.Register(tracer); return(tracer); }); services.AddTransient <SpanContextPropagationHandler>(); services.AddHttpClient(NamedHttpClients.SpanContextPropagationClient) .AddHttpMessageHandler <SpanContextPropagationHandler>(); }
public static void Main(string[] args) { if (args.Length != 2) { throw new ArgumentException("Expecting two arguments, helloTo and greeting"); } var helloTo = args[0]; var greeting = args[1]; using (var tracer = Tracing.Init("hello-world")) { new Hello(tracer).SayHello(helloTo, greeting); } }
// TODO: Rename MainManual to Main to run it. Make sure that HelloActive.cs has MainActive instead of Main, otherwise it will not build! public static void MainManual(string[] args) { if (args.Length != 1) { throw new ArgumentException("Expecting one argument"); } using (var loggerFactory = new LoggerFactory().AddConsole()) { var helloTo = args[0]; using (var tracer = Tracing.Init("hello-world", loggerFactory)) { new HelloManual(tracer, loggerFactory).SayHello(helloTo); } } }
public static void Main(string[] args) { if (args.Length != 2) { throw new ArgumentException("Expecting two arguments, helloTo and greeting"); } using (var loggerFactory = new LoggerFactory().AddConsole()) { var helloTo = args[0]; var greeting = args[1]; using (var tracer = Tracing.Init("hello-world", loggerFactory)) { new Hello(tracer, loggerFactory).SayHello(helloTo, greeting); } } }
public static void Main(string[] args) { if (args.Length != 2) { throw new ArgumentException("Expecting two arguments, helloTo and greeting"); } // // SSL 접속 예외 처리 // The SSL connection could not be established, // see inner exception.The remote certificate is invalid according to the validation procedure C# // ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); using Tracer tracer = Tracing.Init("hello-world", loggerFactory); new Hello(tracer, loggerFactory).SayHello(args[0], args[1]); }
public static void Main(string[] args) { using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); using Tracer tracer = Tracing.Init("server", loggerFactory); // using OpenTracing.Contrib.Grpc.Interceptors; ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor(tracer); Server server = new Server { // using Grpc.Core.Interceptors; //Services = { Greeter.BindService(new GreeterImpl()) }, Services = { Greeter.BindService(new GreeterImpl()).Intercept(tracingInterceptor) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Greeter server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); }