public void Test() { var unexpectedTransactionTraceAttributes = new List <string> { "key", "foo", }; var transactionSample = _fixture.AgentLog.GetTransactionSamples().FirstOrDefault(); Assert.NotNull(transactionSample); Assertions.TransactionTraceDoesNotHaveAttributes(unexpectedTransactionTraceAttributes, TransactionTraceAttributeType.User, transactionSample); var errorTrace = _fixture.AgentLog.GetErrorTraces().FirstOrDefault(); var errorEventPayload = _fixture.AgentLog.GetErrorEvents().FirstOrDefault(); var unexpectedErrorCustomAttributes = new List <string> { "hey", "faz" }; NrAssert.Multiple( () => Assertions.ErrorTraceDoesNotHaveAttributes(unexpectedErrorCustomAttributes, ErrorTraceAttributeType.Intrinsic, errorTrace), () => Assertions.ErrorEventDoesNotHaveAttributes(unexpectedErrorCustomAttributes, EventAttributeType.User, errorEventPayload.Events[0]) ); }
public void Test() { var expectedMetrics = new[] { new Assertions.ExpectedMetric { metricName = "Custom/MyMetric", callCount = 1 } }; var expectedErrorEventIntrinsicAttributes = new Dictionary <string, string> { { "error.class", "System.Exception" }, { "type", "TransactionError" }, { "error.message", StripExeptionMessagesMessage } }; var unexpectedErrorEventCustomAttributes = new List <string> { "hey", "faz" }; var actualMetrics = _fixture.AgentLog.GetMetrics(); var errorTrace = _fixture.AgentLog.GetErrorTraces().FirstOrDefault(); var errorEventPayload = _fixture.AgentLog.GetErrorEvents().FirstOrDefault(); NrAssert.Multiple ( () => Assertions.MetricsExist(expectedMetrics, actualMetrics), () => Assert.NotNull(errorTrace), () => Assert.Equal("2", errorEventPayload.Additions.EventsSeen.ToString()), () => Assertions.ErrorEventHasAttributes(expectedErrorEventIntrinsicAttributes, EventAttributeType.Intrinsic, errorEventPayload.Events[0]), () => Assertions.ErrorEventHasAttributes(expectedErrorEventIntrinsicAttributes, EventAttributeType.Intrinsic, errorEventPayload.Events[1]), () => Assertions.ErrorEventDoesNotHaveAttributes(unexpectedErrorEventCustomAttributes, EventAttributeType.User, errorEventPayload.Events[1]) ); }
public void Test() { var expectedTransactionName = @"WebTransaction/WebAPI/My/CustomAttributes"; var expectedTracedErrorPathAsync = @"WebTransaction/WebAPI/My/CustomErrorAttributes"; var expectedTransactionTraceAttributes = new Dictionary <string, string> { { "foo", "bar" }, }; var unexpectedTransactionTraceAttributes = new List <string> { "key", "hey", "faz", }; var expectedErrorTraceAttributes = new Dictionary <string, string> { { "hey", "dude" }, }; var unexpectedErrorTraceAttributes = new List <string> { "faz", "foo", "key", }; var expectedErrorEventAttributes = new Dictionary <string, string> { { "hey", "dude" }, }; var unexpectedErrorEventAttributes = new List <string> { "faz", "foo", "key", }; var expectedTransactionEventAttributes = new Dictionary <string, string> { { "foo", "bar" } }; var unexpectedTranscationEventAttributes = new List <string> { "key", "faz", "hey" }; var transactionSample = _fixture.AgentLog.GetTransactionSamples() .Where(sample => sample.Path == expectedTransactionName) .FirstOrDefault(); var errorTrace = _fixture.AgentLog.GetErrorTraces() .Where(trace => trace.Path == expectedTracedErrorPathAsync) .FirstOrDefault(); var errorEvents = _fixture.AgentLog.GetErrorEvents().ToList(); var transactionEvent = _fixture.AgentLog.TryGetTransactionEvent(expectedTransactionName); NrAssert.Multiple ( () => Assertions.TransactionTraceHasAttributes(expectedTransactionTraceAttributes, TransactionTraceAttributeType.User, transactionSample), () => Assertions.ErrorTraceHasAttributes(expectedErrorTraceAttributes, ErrorTraceAttributeType.User, errorTrace), () => Assertions.TransactionEventHasAttributes(expectedTransactionEventAttributes, TransactionEventAttributeType.User, transactionEvent), () => Assertions.TransactionTraceDoesNotHaveAttributes(unexpectedTransactionTraceAttributes, TransactionTraceAttributeType.User, transactionSample), () => Assertions.ErrorTraceDoesNotHaveAttributes(unexpectedErrorTraceAttributes, ErrorTraceAttributeType.User, errorTrace), () => Assertions.TransactionEventDoesNotHaveAttributes(unexpectedTranscationEventAttributes, TransactionEventAttributeType.User, transactionEvent), () => Assertions.ErrorEventHasAttributes(expectedErrorEventAttributes, EventAttributeType.User, errorEvents[0].Events[0]), () => Assertions.ErrorEventDoesNotHaveAttributes(unexpectedErrorEventAttributes, EventAttributeType.User, errorEvents[0].Events[0]) ); }