public async Task <HoundResult> Publish(HoundException exception, IEnumerable <string> tags = null) { HoundEvent houndEvent = new HoundEvent { AggregationKey = exception.GetType().FullName, AlertType = exception.Severity, Host = exception.HostName, Text = exception.ToString(), Title = exception.Message, Tags = tags ?? new List <string>() }; return(await _eventDestination.Publish(houndEvent)); }
public async Task <HoundResult> Publish(HoundEvent houndEvent) { using (var client = _datadogApi.GetClient()) { try { HttpContent content = HoundEventMapper.GetHttpContent(houndEvent); HttpResponseMessage response = await client.PostAsync(_datadogApi.PostEventUrl, content); response.EnsureSuccessStatusCode(); return(HoundResultMapper.GetHoundResult(await response.Content.ReadAsStringAsync(), _datadogApi)); } catch (HttpRequestException httpRequestException) { Trace.WriteLine(httpRequestException.Message); return(HoundResultMapper.GetFailureResponse(httpRequestException)); } } }