public void Invoke(IHttpClientEvent @event) { AddTag(@event, "outboundRequestId", () => _outboundRequestIdAccessor.OutboundRequestId); AddTag(@event, "inboundRequestId", () => _inboundRequestIdAccessor.InboundRequestId); AddTag(@event, "correlationId", () => _correlationIdAccessor.CorrelationId); AddTag(@event, "sessionId", () => _sessionIdAccessor.SessionId); AddTag(@event, "service", () => _applicationInfo.Name); AddTag(@event, "version", () => _applicationInfo.Version); }
private static void AddTag(IHttpClientEvent @event, string key, Func <string> valueGetter) { try { var value = valueGetter(); if (value != null) { @event.Tags.Add(key, value); } } catch { // Ignore any exceptions thrown by the getters } }
public void Invoke(IHttpClientEvent @event) { }
public static void Invoke(this IEnumerable <IHttpClientEventCallback> callbacks, IHttpClientEvent @event) { foreach (var callback in callbacks) { try { callback.Invoke(@event); } catch (Exception) { // Just in case callback handler doesn't catch exceptions } } }
public override void Invoke(IHttpClientEvent @event) { base.Invoke(@event); @event.Tags.Add("Key", @event.EventType); }
public virtual void Invoke(IHttpClientEvent @event) { Events.Add(@event); }
// TODO: Disconnect this from the request thread by using BlockingCollection public void Invoke(IHttpClientEvent @event) { Handle((dynamic)@event); }
public void Invoke(IHttpClientEvent @event) { _logger.LogInformation(JsonConvert.SerializeObject(@event, _jsonSettings)); }