コード例 #1
0
 public static IServiceCollection AddElectJaeger(this IServiceCollection services,
                                                 [NotNull] ElectJaegerOptions configure)
 {
     return(services.AddElectJaeger(_ =>
     {
         _.IsEnable = configure.IsEnable;
         _.ServiceName = configure.ServiceName;
         _.SamplerDomain = configure.SamplerDomain;
         _.SamplerPort = configure.SamplerPort;
         _.ReporterDomain = configure.ReporterDomain;
         _.ReporterPort = configure.ReporterPort;
         _.TracesEndpoint = configure.TracesEndpoint;
         _.AuthUsername = configure.AuthUsername;
         _.AuthPassword = configure.AuthPassword;
         _.AuthToken = configure.AuthToken;
         _.AfterSamplerConfig = configure.AfterSamplerConfig;
         _.AfterReporterConfig = configure.AfterReporterConfig;
         _.AfterGlobalConfig = configure.AfterGlobalConfig;
         _.AfterTracer = configure.AfterTracer;
     }));
 }
コード例 #2
0
        public static ElectJaegerOptions GetOptions(IConfiguration configuration,
                                                    string sectionName = "ElectJaeger")
        {
            var electJaegerOptions = new ElectJaegerOptions();

            electJaegerOptions.IsEnable =
                configuration.GetValueByEnv <bool>($"{sectionName}:{nameof(electJaegerOptions.IsEnable)}");

            electJaegerOptions.ServiceName =
                configuration.GetValueByEnv <string>($"{sectionName}:{nameof(electJaegerOptions.ServiceName)}");

            electJaegerOptions.SamplerDomain =
                configuration.GetValueByEnv <string>($"{sectionName}:{nameof(electJaegerOptions.SamplerDomain)}");

            electJaegerOptions.ReporterDomain =
                configuration.GetValueByEnv <string>($"{sectionName}:{nameof(electJaegerOptions.ReporterDomain)}");

            electJaegerOptions.TracesEndpoint =
                configuration.GetValueByEnv <string>($"{sectionName}:{nameof(electJaegerOptions.TracesEndpoint)}");

            return(electJaegerOptions);
        }