public static void AddZipKin(this IApplicationBuilder app, ILoggerFactory loggerFactory, string ServiceName, string ZipKinServer)
        {
            var lifetime = app.ApplicationServices.GetService <IApplicationLifetime>();

            lifetime.ApplicationStarted.Register(() =>
            {
                ZipKinClientHelper.Init(ServiceName, ZipKinServer);
                ZipKinClientHelper.RegisterHandle(loggerFactory);
            });

            lifetime.ApplicationStopped.Register(() => ZipKinClientHelper.UnRegisterHandle());
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticHttpContext();
            app.UseMvc();

            var lifetime = app.ApplicationServices.GetService <IApplicationLifetime>();

            lifetime.ApplicationStarted.Register(() =>
            {
                ZipKinClientHelper.Init("ZZH.ZipKinClient.Service.Test.Three", "http://localhost:9411");
                ZipKinClientHelper.RegisterHandle(loggerFactory);
            });

            lifetime.ApplicationStopped.Register(() => ZipKinClientHelper.UnRegisterHandle());
        }