public void ConnectionFailed(ConnectionId connectionId, Exception exception) { if (_failedEvent == null) { return; } var requestIds = _state.Keys; foreach (var requestId in requestIds) { CommandState state; if (_state.TryRemove(requestId, out state)) { state.Stopwatch.Stop(); var @event = new CommandFailedEvent( state.CommandName, exception, state.OperationId, requestId, connectionId, state.Stopwatch.Elapsed); _failedEvent(@event); } } }
public void Handle(CommandFailedEvent @event) { if (MongoLogger.IsEnabled(Constants.Events.CommandFail)) { MongoLogger.Write(Constants.Events.CommandFail, new EventPayload <CommandFailedEvent>(@event)); } }
public void Handle(CommandFailedEvent @event) { var exception = @event.Failure; var mongoCommandException = exception as MongoCommandException; if (mongoCommandException != null) { exception = new MongoCommandException( mongoCommandException.ConnectionId, mongoCommandException.Message, RecursivelyMaterialize(mongoCommandException.Command), RecursivelyMaterialize(mongoCommandException.Result)); } @event = new CommandFailedEvent( @event.CommandName, exception, @event.OperationId, @event.RequestId, @event.ConnectionId, @event.ServiceId, @event.Duration); _parent.Capture(@event); }
private Dictionary <string, object> ExtractExceptionInfo(CommandFailedEvent @event) { return(new Dictionary <string, object> { { "event", "error" }, { "type", @event.Failure.GetType() }, { "message", @event.Failure.Message }, { "stack-trace", @event.Failure.StackTrace } }); }
private void Handle(CommandFailedEvent @event) { if (_activityMap.TryRemove(@event.RequestId, out var activity)) { WithReplacedActivityCurrent(activity, () => { diagnosticSource.Write("MongoActivity.Failed", @event); }); } }
private static Dictionary <string, object> ExtractExceptionInfo(CommandFailedEvent @event) { return(new Dictionary <string, object> { { "Event", "ERROR" }, { "Type", @event.Failure.GetType() }, { "Message", @event.Failure.Message }, { "Stack-Trace", @event.Failure.StackTrace } }); }
private void Handle(CommandFailedEvent @event) { if (_activityMap.TryRemove(@event.RequestId, out var activity)) { if (_diagnosticListener.IsEnabled(ActivityExceptionEventName, @event)) { _diagnosticListener.Write(ActivityExceptionEventName, @event); } activity.Stop(); } }
public void FailedExecuteCommand([Object] CommandFailedEvent @event) { var context = _contextAccessor.Context; context?.Span.AddTag("status_description", @event.Failure.Message); context?.Span.AddTag("error.type", @event.Failure.GetType().FullName); context?.Span.AddTag("error.msg", @event.Failure.Message); context?.Span.AddTag("error.stack", @event.Failure.StackTrace); context?.Span.AddTag(Common.Tags.STATUS_CODE, "error"); _tracingContext.Release(context); }
public void FailedExecuteCommand([Object] CommandFailedEvent @event) { if (_contextMap.TryRemove(@event.RequestId, out var context)) { context?.Span.AddTag("status_description", @event.Failure.Message); context?.Span.AddTag("error.type", @event.Failure.GetType().FullName); context?.Span.AddTag("error.msg", @event.Failure.Message); context?.Span.AddTag("error.stack", @event.Failure.StackTrace); context?.Span.AddTag(Common.Tags.STATUS_CODE, "error"); _tracingContext.Release(context); } }
internal void OnCommandFailed(CommandFailedEvent evt) { if (!_queryCache.TryRemove(evt.RequestId, out CachedQuery query)) { return; } var telemetry = query.Telemetry; telemetry.Success = false; telemetry.Properties["Exception"] = evt.Failure.ToInvariantString(); query.Telemetry.Duration = evt.Duration; _telemetryClient.TrackDependency(query.Telemetry); }
public void ErrorEventHandler(CommandFailedEvent @event) { if (!_eventFilter.IsApproved(@event.CommandName)) { return; } if (_spanCache.TryRemove(@event.RequestId, out var span)) { span.Log(ExtractExceptionInfo(@event)); span.SetTag(Tags.Error, true); span.Finish(); } }
public void ErrorEventHandler(CommandFailedEvent @event) { if (!_eventFilter.IsOnEventList(@event.CommandName, _events)) { return; } if (!_spanCache.TryRemove(@event.RequestId, out ISpan span)) { return; } span.Log(ExtractExceptionInfo(@event)); span.SetTag(Tags.Error, true); span.Finish(); }
public void FailedExecuteCommand([Object] CommandFailedEvent @event) { var context = _contextAccessor.Context; if (context == null) { _segmentContextMap.TryRemove((@event.OperationId ?? 0) + @event.RequestId, out context); } context?.Span.AddTag("status_description", @event.Failure.Message); context?.Span.AddTag("error.type", @event.Failure.GetType().FullName); context?.Span.AddTag("error.msg", @event.Failure.Message); context?.Span.AddTag("error.stack", @event.Failure.StackTrace); context?.Span.AddTag(Common.Tags.STATUS_CODE, "error"); _tracingContext.Release(context); }
public void Handle(CommandFailedEvent failedEvent) { var commandName = failedEvent.CommandName; if (commandName != "insert" || !this.scopes.ContainsKey(failedEvent.RequestId)) { return; } var scope = this.scopes[failedEvent.RequestId]; scope.Span.AddException(failedEvent.Failure); scope.Dispose(); this.scopes.Remove(failedEvent.RequestId); }
private void HandleCommandFailedEvent(CommandFailedEvent @event) { try { if (!_processingQueries.TryRemove(@event.RequestId, out var span)) { return; } span.Duration = @event.Duration.TotalMilliseconds; span.CaptureException(@event.Failure); span.End(); } catch (Exception ex) { // ignore _logger?.Log(LogLevel.Error, "Exception was thrown while handling 'command failed event'", ex, null); } }
public void ErrorSending(IEnumerable <RequestMessage> messages, ConnectionId connectionId, Exception exception) { foreach (var message in messages) { CommandState state; if (_state.TryRemove(message.RequestId, out state)) { state.Stopwatch.Stop(); if (_failedEvent != null) { var @event = new CommandFailedEvent( state.CommandName, exception, state.OperationId, message.RequestId, connectionId, state.Stopwatch.Elapsed); _failedEvent(@event); } } } }
private void HandleCommandFailedEvent(CommandFailedEvent @event) { try { Logger.Trace()?.Log(nameof(HandleCommandFailedEvent)); if (!_processingQueries.TryRemove(@event.RequestId, out var span)) { Logger.Trace()?.Log("Failed removing item from _processingQueries for RequestId: {RequestId}", @event.RequestId); return; } span.Duration = @event.Duration.TotalMilliseconds; span.CaptureException(@event.Failure); span.End(); } catch (Exception ex) { // ignore Logger.Log(LogLevel.Error, "Exception was thrown while handling 'command failed event'", ex, null); } }
public void ConnectionFailed(ConnectionId connectionId, Exception exception) { if (_failedEvent == null) { return; } var pairs = _state.ToList(); _state.Clear(); foreach (var pair in pairs) { pair.Value.Stopwatch.Stop(); var @event = new CommandFailedEvent( pair.Value.CommandName, exception, pair.Value.OperationId, pair.Key, connectionId, pair.Value.Stopwatch.Elapsed); _failedEvent(@event); } }
public void Handle(CommandFailedEvent @event) { _parent.Capture(@event); }
public void Handle(CommandFailedEvent commandFailedEvent) { }
private void Handle(CommandFailedEvent @event) { Error(TraceSourceEventHelper.CommandIdBase + 2, @event.Failure, "{0}-{1}: {2} failed.", TraceSourceEventHelper.Label(@event.ConnectionId), @event.RequestId, @event.CommandName); }
public void Handle(CommandFailedEvent failed) { }
private void VerifyCommandFailedEvent(CommandFailedEvent actual, BsonDocument expected, string databaseName, string collectionName) { actual.CommandName.Should().Be(expected["command_name"].ToString()); }