示例#1
0
        private static AirlockClient CreateAirlockClient(ILog log, AirlockEnvironmentVariables environmentVariables)
        {
            var airlockConfig    = GetAirlockConfig(log, environmentVariables);
            var airlockClientLog = Logging.Configure("./log/airlock-{Date}.log", writeToConsole: false);

            return(new AirlockClient(airlockConfig, airlockClientLog));
        }
        private static Uri[] GetElasticUris(ILog log, AirlockEnvironmentVariables environmentVariables)
        {
            var elasticEndpoints = environmentVariables.GetValue("ELASTICSEARCH_ENDPOINTS", defaultElasticEndpoints);
            var elasticUris      = elasticEndpoints.Split(";", StringSplitOptions.RemoveEmptyEntries).Select(x => new Uri(x)).ToArray();

            log.Info($"ElasticUris: {elasticUris.ToPrettyJson()}");
            return(elasticUris);
        }
示例#3
0
        private static ContrailsClientSettings GetContrailsClientSettings(ILog log, AirlockEnvironmentVariables environmentVariables)
        {
            var cassandraEndpoints      = environmentVariables.GetValue("CASSANDRA_ENDPOINTS", defaultCassandraEndpoints);
            var contrailsClientSettings = new ContrailsClientSettings
            {
                CassandraNodes = cassandraEndpoints.Split(";", StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToArray(),
                Keyspace       = "airlock",
                CassandraRetryExecutionStrategySettings = new CassandraRetryExecutionStrategySettings(),
            };

            log.Info($"ContrailsClientSettings: {contrailsClientSettings.ToPrettyJson()}");
            return(contrailsClientSettings);
        }
示例#4
0
        private static AirlockConfig GetAirlockConfig(ILog log, AirlockEnvironmentVariables environmentVariables)
        {
            var airlockGateApiKey    = environmentVariables.GetValue("GATE_API_KEY", defaultAirlockGateApiKey);
            var airlockGateEndpoints = environmentVariables.GetValue("GATE_ENDPOINTS", defaultAirlockGateEndpoints);
            var airlockGateUris      = airlockGateEndpoints.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => new Uri(x)).ToArray();
            var airlockConfig        = new AirlockConfig
            {
                ApiKey          = airlockGateApiKey,
                ClusterProvider = new FixedClusterProvider(airlockGateUris),
            };

            log.Info($"AirlockConfig: {airlockConfig.ToPrettyJson()}");
            return(airlockConfig);
        }
示例#5
0
        protected sealed override void DoInitialize(ILog log, IMetricScope rootMetricScope, AirlockEnvironmentVariables environmentVariables, out IRoutingKeyFilter routingKeyFilter, out IAirlockEventProcessorProvider processorProvider)
        {
            routingKeyFilter = new DefaultRoutingKeyFilter(RoutingKey.MetricsSuffix);
            var graphiteUri = GetGraphiteUri(log, environmentVariables);

            processorProvider = new DefaultAirlockEventProcessorProvider <MetricEvent, MetricEventSerializer>(project => new MetricsAirlockEventProcessor(graphiteUri, log));
        }
        protected sealed override void DoInitialize(ILog log, IMetricScope rootMetricScope, AirlockEnvironmentVariables environmentVariables, out IRoutingKeyFilter routingKeyFilter, out IAirlockEventProcessorProvider processorProvider)
        {
            routingKeyFilter = new DefaultRoutingKeyFilter(RoutingKey.LogsSuffix);
            var elasticUris = GetElasticUris(log, environmentVariables);

            processorProvider = new DefaultAirlockEventProcessorProvider <LogEventData, LogEventDataSerializer>(project => new LogAirlockEventProcessor(elasticUris, log));
        }
示例#7
0
        protected sealed override void DoInitialize(ILog log, IMetricScope rootMetricScope, AirlockEnvironmentVariables environmentVariables, out IRoutingKeyFilter routingKeyFilter, out IAirlockEventProcessorProvider processorProvider)
        {
            airlockClient    = CreateAirlockClient(log, environmentVariables);
            routingKeyFilter = new MetricsAggregatorRotingKeyFilter();
            var settings = new MetricsAggregatorSettings();

            processorProvider = new MetricsAggregatorAirlockEventProcessorProvider(rootMetricScope, airlockClient, settings);
        }
示例#8
0
        protected sealed override void DoInitialize(ILog log, IMetricScope rootMetricScope, AirlockEnvironmentVariables environmentVariables, out IRoutingKeyFilter routingKeyFilter, out IAirlockEventProcessorProvider processorProvider)
        {
            routingKeyFilter = new DefaultRoutingKeyFilter(RoutingKey.TracesSuffix);
            var contrailsClientSettings = GetContrailsClientSettings(log, environmentVariables);
            var contrailsClient         = new ContrailsClient(contrailsClientSettings, log);

            processorProvider = new DefaultAirlockEventProcessorProvider <Span, SpanAirlockSerializer>(project => new TracingAirlockEventProcessor(contrailsClient, log, maxCassandraTasks: 1000));
        }