public DatadogTcpClient(DatadogConfiguration config, LogFormatter formatter, string apiKey) { _config = config; _formatter = formatter; _apiKey = apiKey; SelfLog.WriteLine("Creating TCP client with config: {0}", config); }
public DatadogSink(string apiKey, string source, string service, string host, string[] tags, DatadogConfiguration config, int queueLimit, int?batchSizeLimit = null, TimeSpan?batchPeriod = null, Action <Exception> exceptionHandler = null) : base(batchSizeLimit ?? DefaultBatchSizeLimit, batchPeriod ?? DefaultBatchPeriod, queueLimit) { _client = CreateDatadogClient(apiKey, source, service, host, tags, config); _exceptionHandler = exceptionHandler; }
public DatadogHttpClient(DatadogConfiguration config, LogFormatter formatter, string apiKey) { _config = config; _client = new HttpClient(); _client.DefaultRequestHeaders.Add("DD-API-KEY", apiKey); _client.DefaultRequestHeaders.Add("DD-EVP-ORIGIN", "Serilog.Sinks.Datadog.Logs"); _client.DefaultRequestHeaders.Add("DD-EVP-ORIGIN-VERSION", _version); _url = $"{config.Url}/api/v2/logs"; _formatter = formatter; }
private static IDatadogClient CreateDatadogClient(string apiKey, string source, string service, string host, string[] tags, DatadogConfiguration configuration) { var logFormatter = new LogFormatter(source, service, host, tags); if (configuration.UseTCP) { return(new DatadogTcpClient(configuration, logFormatter, apiKey)); } return(new DatadogHttpClient(configuration, logFormatter, apiKey)); }
public static DatadogSink Create(string apiKey, string source, string service, string host, string[] tags, DatadogConfiguration config, int?batchSizeLimit = null, TimeSpan?batchPeriod = null, int?queueLimit = null, Action <Exception> exceptionHandler = null) { if (queueLimit.HasValue) { return(new DatadogSink(apiKey, source, service, host, tags, config, queueLimit.Value, batchSizeLimit, batchPeriod, exceptionHandler)); } return(new DatadogSink(apiKey, source, service, host, tags, config, batchSizeLimit, batchPeriod, exceptionHandler)); }
public DatadogSink(string apiKey, string source, string service, string host, string[] tags, DatadogConfiguration config) : base(BatchSizeLimit, Period) { _apiKey = apiKey; _source = source; _service = service; _host = host; _tags = tags != null?string.Join(",", tags) : null; _client = new DatadogClient(config); }
public DatadogSink(string apiKey, DatadogConfiguration config) : base(BatchSizeLimit, Period) { _apiKey = apiKey; _client = new DatadogClient(config); }