public void Transform_SendsErrorTraceToAggregator() { float priority = 0.5f; _customErrorDataTransformer.Transform(MakeError(), priority); Mock.Assert(() => _errorTraceAggregator.Collect(Arg.IsAny <ErrorTraceWireModel>())); }
public void Transform(ErrorData errorData, float priority) { if (!_configurationService.Configuration.ErrorCollectorEnabled) { return; } var attribValues = new AttributeValueCollection(AttributeDestinations.ErrorEvent, AttributeDestinations.ErrorTrace); if (errorData.CustomAttributes != null && _configurationService.Configuration.CaptureCustomParameters) { foreach (var customAttrib in errorData.CustomAttributes) { _attribDefs.GetCustomAttributeForError(customAttrib.Key).TrySetValue(attribValues, customAttrib.Value); } } // For Custom Errors (occurring outside a transaction), UI Error Analytics page co-opts the // 'transactionName' attribute to find the corresponding Error Trace (matching it to 'Path') // so it can display the stack trace. _attribDefs.TransactionNameForError.TrySetValue(attribValues, errorData.Path); //We have to do the filtering here b/c these methods further update var errorTrace = _errorTraceMaker.GetErrorTrace(new AttributeValueCollection(attribValues, AttributeDestinations.ErrorTrace), errorData); var errorEvent = _errorEventMaker.GetErrorEvent(errorData, new AttributeValueCollection(attribValues, AttributeDestinations.ErrorEvent), priority); _errorTraceAggregator.Collect(errorTrace); _errorEventAggregator.Collect(errorEvent); }
private void GenerateAndCollectErrorEventTracesAndEvents(ImmutableTransaction immutableTransaction, IAttributeValueCollection attributes, TransactionMetricName transactionMetricName) { var errorTrace = GenerateErrorTrace(immutableTransaction, attributes, transactionMetricName); if (errorTrace == null) { return; } using (_agentTimerService.StartNew("CollectErrorTrace")) { _errorTraceAggregator.Collect(errorTrace); } if (_configurationService.Configuration.ErrorCollectorCaptureEvents) { var errorEvent = _errorEventMaker.GetErrorEvent(immutableTransaction, attributes); using (_agentTimerService.StartNew("CollectErrorEvent")) { _errorEventAggregator.Collect(errorEvent); } } }