@@ -52,13 +52,13 @@ public void Test()
52
52
{
53
53
var expectedMetrics = new List < Assertions . ExpectedMetric >
54
54
{
55
- // error metrics
56
- new Assertions . ExpectedMetric { metricName = @"Errors/all" , callCount = 2 } ,
55
+ // error metrics
56
+ new Assertions . ExpectedMetric { metricName = @"Errors/all" , callCount = 2 } ,
57
57
new Assertions . ExpectedMetric { metricName = @"Errors/allWeb" , callCount = 2 } ,
58
58
new Assertions . ExpectedMetric { metricName = @"Errors/WebTransaction/WebService/BasicWebService.TestWebService.ThrowException" , callCount = 2 } ,
59
59
60
- // other
61
- new Assertions . ExpectedMetric { metricName = @"WebTransaction/WebService/BasicWebService.TestWebService.ThrowException" , callCount = 2 } ,
60
+ // other
61
+ new Assertions . ExpectedMetric { metricName = @"WebTransaction/WebService/BasicWebService.TestWebService.ThrowException" , callCount = 2 } ,
62
62
new Assertions . ExpectedMetric { metricName = @"DotNet/BasicWebService.TestWebService.ThrowException" , callCount = 2 } ,
63
63
new Assertions . ExpectedMetric { metricName = @"DotNet/BasicWebService.TestWebService.ThrowException" , metricScope = "WebTransaction/WebService/BasicWebService.TestWebService.ThrowException" , callCount = 2 }
64
64
} ;
@@ -70,10 +70,16 @@ public void Test()
70
70
new Assertions . ExpectedMetric { metricName = @"OtherTransaction/all" } ,
71
71
} ;
72
72
73
- var expectedAttributes = new Dictionary < string , string >
73
+ var metrics = _fixture . AgentLog . GetMetrics ( ) . ToList ( ) ;
74
+ var errorTraces = _fixture . AgentLog . GetErrorTraces ( ) . ToList ( ) ;
75
+ var transactionEvents = _fixture . AgentLog . GetTransactionEvents ( ) . ToList ( ) ;
76
+ var errorEvents = _fixture . AgentLog . GetErrorEvents ( ) ;
77
+
78
+ var expectedTransactonEventAttributes = new Dictionary < string , string >
74
79
{
75
80
{ "errorType" , ExpectedExceptionType } ,
76
81
{ "errorMessage" , "Oh no!" } ,
82
+ { "error" , "true" } ,
77
83
} ;
78
84
79
85
var expectedErrorEventAttributes = new Dictionary < string , string >
@@ -82,11 +88,6 @@ public void Test()
82
88
{ "error.message" , "Oh no!" } ,
83
89
} ;
84
90
85
- var metrics = _fixture . AgentLog . GetMetrics ( ) . ToList ( ) ;
86
- var errorTraces = _fixture . AgentLog . GetErrorTraces ( ) . ToList ( ) ;
87
- var transactionEvents = _fixture . AgentLog . GetTransactionEvents ( ) . ToList ( ) ;
88
- var errorEvents = _fixture . AgentLog . GetErrorEvents ( ) ;
89
-
90
91
NrAssert . Multiple (
91
92
( ) => Assertions . MetricsExist ( expectedMetrics , metrics ) ,
92
93
( ) => Assertions . MetricsDoNotExist ( unexpectedMetrics , metrics ) ,
@@ -96,16 +97,19 @@ public void Test()
96
97
( ) => Assert . Equal ( ExpectedExceptionType , errorTraces [ 0 ] . ExceptionClassName ) ,
97
98
( ) => Assert . Equal ( "Oh no!" , errorTraces [ 0 ] . Message ) ,
98
99
( ) => Assert . NotEmpty ( errorTraces [ 0 ] . Attributes . StackTrace ) ,
100
+ ( ) => Assert . NotNull ( errorTraces [ 0 ] . Attributes . IntrinsicAttributes [ "guid" ] ) ,
99
101
( ) => Assert . Equal ( "WebTransaction/WebService/BasicWebService.TestWebService.ThrowException" , errorTraces [ 1 ] . Path ) ,
100
102
( ) => Assert . Equal ( ExpectedExceptionType , errorTraces [ 1 ] . ExceptionClassName ) ,
101
103
( ) => Assert . Equal ( "Oh no!" , errorTraces [ 1 ] . Message ) ,
102
104
( ) => Assert . NotEmpty ( errorTraces [ 1 ] . Attributes . StackTrace ) ,
105
+ ( ) => Assert . NotNull ( errorTraces [ 1 ] . Attributes . IntrinsicAttributes [ "guid" ] ) ,
103
106
( ) => Assert . True ( transactionEvents . Any ( ) , "No transaction events found." ) ,
104
107
( ) => Assert . True ( transactionEvents . Count == 2 , $ "Expected 2 transaction event but found { transactionEvents . Count } ") ,
105
- ( ) => Assertions . TransactionEventHasAttributes ( expectedAttributes , TransactionEventAttributeType . Intrinsic , transactionEvents [ 0 ] ) ,
106
- ( ) => Assertions . TransactionEventHasAttributes ( expectedAttributes , TransactionEventAttributeType . Intrinsic , transactionEvents [ 1 ] ) ,
108
+ ( ) => Assertions . TransactionEventHasAttributes ( expectedTransactonEventAttributes , TransactionEventAttributeType . Intrinsic , transactionEvents [ 0 ] ) ,
109
+ ( ) => Assertions . TransactionEventHasAttributes ( expectedTransactonEventAttributes , TransactionEventAttributeType . Intrinsic , transactionEvents [ 1 ] ) ,
107
110
( ) => Assert . Equal ( 2 , errorEvents . Count ( ) ) ,
108
- ( ) => Assertions . ErrorEventHasAttributes ( expectedErrorEventAttributes , EventAttributeType . Intrinsic , errorEvents . FirstOrDefault ( ) )
111
+ ( ) => Assertions . ErrorEventHasAttributes ( expectedErrorEventAttributes , EventAttributeType . Intrinsic , errorEvents . FirstOrDefault ( ) ) ,
112
+ ( ) => Assert . NotNull ( errorEvents . FirstOrDefault ( ) . IntrinsicAttributes [ "guid" ] )
109
113
) ;
110
114
}
111
115
}
0 commit comments