/// <summary>
        /// Initializes a new instance of the <see cref="ImmutableTracerSettings"/> class from
        /// a TracerSettings instance.
        /// </summary>
        /// <param name="settings">The tracer settings to use to populate the immutable tracer settings</param>
        public ImmutableTracerSettings(TracerSettings settings)
        {
            Environment      = settings.Environment;
            ServiceName      = settings.ServiceName;
            ServiceVersion   = settings.ServiceVersion;
            TraceEnabled     = settings.TraceEnabled;
            ExporterSettings = new ImmutableExporterSettings(settings.ExporterSettings);
            TracesTransport  = settings.TracesTransport;
#pragma warning disable 618 // App analytics is deprecated, but still used
            AnalyticsEnabled = settings.AnalyticsEnabled;
#pragma warning restore 618
            MaxTracesSubmittedPerSecond = settings.MaxTracesSubmittedPerSecond;
            CustomSamplingRules         = settings.CustomSamplingRules;
            GlobalSamplingRate          = settings.GlobalSamplingRate;
            Integrations                      = new ImmutableIntegrationSettingsCollection(settings.Integrations, settings.DisabledIntegrationNames);
            GlobalTags                        = new ReadOnlyDictionary <string, string>(settings.GlobalTags);
            HeaderTags                        = new ReadOnlyDictionary <string, string>(settings.HeaderTags);
            GrpcTags                          = new ReadOnlyDictionary <string, string>(settings.GrpcTags);
            TracerMetricsEnabled              = settings.TracerMetricsEnabled;
            RuntimeMetricsEnabled             = settings.RuntimeMetricsEnabled;
            KafkaCreateConsumerScopeEnabled   = settings.KafkaCreateConsumerScopeEnabled;
            StartupDiagnosticLogEnabled       = settings.StartupDiagnosticLogEnabled;
            HttpClientExcludedUrlSubstrings   = settings.HttpClientExcludedUrlSubstrings;
            HttpServerErrorStatusCodes        = settings.HttpServerErrorStatusCodes;
            HttpClientErrorStatusCodes        = settings.HttpClientErrorStatusCodes;
            ServiceNameMappings               = settings.ServiceNameMappings;
            TraceBufferSize                   = settings.TraceBufferSize;
            TraceBatchInterval                = settings.TraceBatchInterval;
            RouteTemplateResourceNamesEnabled = settings.RouteTemplateResourceNamesEnabled;
            DelayWcfInstrumentationEnabled    = settings.DelayWcfInstrumentationEnabled;
            TraceMethods                      = settings.TraceMethods;
            IsActivityListenerEnabled         = settings.IsActivityListenerEnabled;

            TagMongoCommands           = settings.TagMongoCommands;
            TagRedisCommands           = settings.TagRedisCommands;
            TagElasticsearchQueries    = settings.TagElasticsearchQueries;
            TraceResponseHeaderEnabled = settings.TraceResponseHeaderEnabled;
            RecordedValueMaxLength     = settings.RecordedValueMaxLength;
            SignalFxAccessToken        = settings.SignalFxAccessToken;
            Convention = settings.Convention;
            Exporter   = settings.Exporter;

            ThreadSamplingEnabled = settings.ThreadSamplingEnabled;
            ThreadSamplingPeriod  = settings.ThreadSamplingPeriod;
            LogSubmissionSettings = ImmutableDirectLogSubmissionSettings.Create(settings.LogSubmissionSettings);
            // Logs injection is enabled by default if direct log submission is enabled, otherwise disabled by default
            LogsInjectionEnabled = settings.LogSubmissionSettings.LogsInjectionEnabled ?? LogSubmissionSettings.IsEnabled;

            PropagationStyleInject  = settings.PropagationStyleInject;
            PropagationStyleExtract = settings.PropagationStyleExtract;

            // we cached the static instance here, because is being used in the hotpath
            // by IsIntegrationEnabled method (called from all integrations)
            _domainMetadata = DomainMetadata.Instance;

            ExpandRouteTemplatesEnabled = settings.ExpandRouteTemplatesEnabled || !RouteTemplateResourceNamesEnabled;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImmutableTracerSettings"/> class from
        /// a TracerSettings instance.
        /// </summary>
        /// <param name="settings">The tracer settings to use to populate the immutable tracer settings</param>
        public ImmutableTracerSettings(TracerSettings settings)
        {
            Environment    = settings.Environment;
            ServiceName    = settings.ServiceName;
            ServiceVersion = settings.ServiceVersion;
            TraceEnabled   = settings.TraceEnabled;
            Exporter       = new ImmutableExporterSettings(settings.Exporter);
#pragma warning disable 618 // App analytics is deprecated, but still used
            AnalyticsEnabled = settings.AnalyticsEnabled;
#pragma warning restore 618
            LogsInjectionEnabled        = settings.LogsInjectionEnabled;
            MaxTracesSubmittedPerSecond = settings.MaxTracesSubmittedPerSecond;
            CustomSamplingRules         = settings.CustomSamplingRules;
            GlobalSamplingRate          = settings.GlobalSamplingRate;
            Integrations                      = new ImmutableIntegrationSettingsCollection(settings.Integrations, settings.DisabledIntegrationNames);
            GlobalTags                        = new ReadOnlyDictionary <string, string>(settings.GlobalTags);
            HeaderTags                        = new ReadOnlyDictionary <string, string>(settings.HeaderTags);
            TracerMetricsEnabled              = settings.TracerMetricsEnabled;
            RuntimeMetricsEnabled             = settings.RuntimeMetricsEnabled;
            KafkaCreateConsumerScopeEnabled   = settings.KafkaCreateConsumerScopeEnabled;
            StartupDiagnosticLogEnabled       = settings.StartupDiagnosticLogEnabled;
            HttpClientExcludedUrlSubstrings   = settings.HttpClientExcludedUrlSubstrings;
            HttpServerErrorStatusCodes        = settings.HttpServerErrorStatusCodes;
            HttpClientErrorStatusCodes        = settings.HttpClientErrorStatusCodes;
            ServiceNameMappings               = settings.ServiceNameMappings;
            TraceBufferSize                   = settings.TraceBufferSize;
            TraceBatchInterval                = settings.TraceBatchInterval;
            RouteTemplateResourceNamesEnabled = settings.RouteTemplateResourceNamesEnabled;
            DelayWcfInstrumentationEnabled    = settings.DelayWcfInstrumentationEnabled;
            PropagationStyleInject            = settings.PropagationStyleInject;
            PropagationStyleExtract           = settings.PropagationStyleExtract;

            LogSubmissionSettings = ImmutableDirectLogSubmissionSettings.Create(settings.LogSubmissionSettings);

            // we cached the static instance here, because is being used in the hotpath
            // by IsIntegrationEnabled method (called from all integrations)
            _domainMetadata = DomainMetadata.Instance;

            ExpandRouteTemplatesEnabled = settings.ExpandRouteTemplatesEnabled || !RouteTemplateResourceNamesEnabled;
        }