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); }
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); }
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); }
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)); }
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); }
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)); }