public static SkyApmExtensions AddAspNetCoreHosting(this SkyApmExtensions extensions)
 {
     extensions.Services.AddSingleton <ITracingDiagnosticProcessor, HostingTracingDiagnosticProcessor>();
     extensions.Services.AddSingleton <IHostingDiagnosticHandler, DefaultHostingDiagnosticHandler>();
     extensions.Services.AddSingleton <IHostingDiagnosticHandler, GrpcHostingDiagnosticHandler>();
     return(extensions);
 }
 public static SkyApmExtensions AddGrpc(this SkyApmExtensions extensions)
 {
     extensions.Services.AddSingleton <ClientDiagnosticProcessor>();
     extensions.Services.AddSingleton <ClientDiagnosticInterceptor>();
     extensions.Services.AddSingleton <ServerDiagnosticProcessor>();
     extensions.Services.AddSingleton <ServerDiagnosticInterceptor>();
     return(extensions);
 }
Ejemplo n.º 3
0
    public static SkyApmExtensions AddCaching(this SkyApmExtensions extensions)
    {
        if (extensions is not null)
        {
            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, CacheTracingDiagnosticProcessor>();
        }

        return(extensions);
    }
        public static SkyApmExtensions AddMySql(this SkyApmExtensions extensions)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, MySqlTracingDiagnosticProcessor>();

            return(extensions);
        }
Ejemplo n.º 5
0
        public static SkyApmExtensions AddMongo(this SkyApmExtensions extensions)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddMongo();

            return(extensions);
        }
        public static SkyApmExtensions AddMySqlData(this SkyApmExtensions builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.AddSingleton <ITracingDiagnosticProcessor, MySqlDataDiagnosticProcessor>();

            return(builder);
        }
Ejemplo n.º 7
0
        public static SkyApmExtensions UseEventBusTransport(this SkyApmExtensions extensions)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddSingleton <ISegmentReporter, EventBusSegmentReporter>();

            return(extensions);
        }
Ejemplo n.º 8
0
        public static SkyApmExtensions AddHttpClient(this SkyApmExtensions extensions)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, HttpClientTracingDiagnosticProcessor>();
            extensions.Services.AddSingleton <IRequestDiagnosticHandler, DefaultRequestDiagnosticHandler>();
            extensions.Services.AddSingleton <IRequestDiagnosticHandler, GrpcRequestDiagnosticHandler>();
            return(extensions);
        }
Ejemplo n.º 9
0
 public static SkyApmExtensions AddFreeSql(this SkyApmExtensions extensions, IFreeSql fsql)
 {
     if (extensions == null)
     {
         throw new ArgumentNullException(nameof(extensions));
     }
     extensions.Services.AddSingleton <ITracingDiagnosticProcessor, FreeSqlTracingDiagnosticProcessor>();
     if (fsql != null)
     {
         ConfigAop(fsql);
     }
     return(extensions);
 }
        /// <summary>
        /// 注入SQLBuilder的SkyApm追踪
        /// </summary>
        /// <param name="this"></param>
        /// <param name="component">自定义设定SQLBuilder组件,若未设定则默认采用SqlClient组件,
        /// <para>具体设定参照:https://github.com/dotnetcore/FreeSql/issues/222</para>
        /// </param>
        /// <returns></returns>
        public static SkyApmExtensions AddSkyApmSQLBuilder(this SkyApmExtensions @this, StringOrIntValue?component = null)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(SkyApmExtensions));
            }

            @this.Services.AddSingleton <ITracingDiagnosticProcessor>(x =>
                                                                      new SQLBuilderTracingDiagnosticProcessor(
                                                                          x.GetRequiredService <ITracingContext>(),
                                                                          x.GetRequiredService <IExitSegmentContextAccessor>(),
                                                                          component));

            return(@this);
        }
        public static SkyApmExtensions AddHttpClient(this SkyApmExtensions extensions, string section = "SkyApm:Extend:HttpClient")
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            var configService = extensions.Services.First(x => x.ServiceType == typeof(IConfiguration));
            var configuration = (IConfiguration)configService.ImplementationInstance;

            extensions.Services.Configure <SkyApmHttpClientOption>(configuration.GetSection(section));

            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, HttpClientTracingDiagnosticProcessor>();

            return(extensions);
        }
        public static SkyApmExtensions AddEntityFrameworkCore(this SkyApmExtensions extensions, Action <DatabaseProviderBuilder> optionAction)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, EntityFrameworkCoreTracingDiagnosticProcessor>();
            extensions.Services.AddSingleton <IEntityFrameworkCoreSegmentContextFactory, EntityFrameworkCoreSegmentContextFactory>();

            if (optionAction != null)
            {
                var databaseProviderBuilder = new DatabaseProviderBuilder(extensions.Services);
                optionAction(databaseProviderBuilder);
            }

            return(extensions);
        }
Ejemplo n.º 13
0
 public static SkyApmExtensions AddMongoDB(this SkyApmExtensions extensions)
 {
     extensions.Services.AddSingleton <ITracingDiagnosticProcessor, MongoDiagnosticsProcessor>();
     return(extensions);
 }
 public static SkyApmExtensions AddAspNetCorePathIgnore(this SkyApmExtensions extensions)
 {
     extensions.Services.AddSingleton <IHostingDiagnosticHandler, PathIgnoreHostingDiagnosticHandler>();
     return(extensions);
 }
Ejemplo n.º 15
0
 public static SkyApmExtensions AddOxygen(this SkyApmExtensions extensions)
 {
     extensions.Services.AddSingleton <ITracingDiagnosticProcessor, OxygenTracingDiagnosticProcessor>();
     return(extensions);
 }