Commit 4fb9405
feat: add array support for custom attributes in .NET Agent API (#3456)
* feat: add array support to JsonSerializerHelpers with null filtering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add integration tests for array custom attributes
- Add comprehensive integration test classes for both .NET Framework and .NET Core
- Extend test applications with new array attribute endpoints
- Add RemoteServiceFixture helper methods for array testing
- Update Assertions.cs to support array validation in tests
- Verify arrays work in transaction traces, transaction events, and error telemetry
- Test empty array filtering and null element removal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: Minor refactoring and cleanup
* fix: improve array validation in integration test assertions
- Add support for string[], int[], bool[] typed arrays in test assertions
- Extract array validation logic into ValidateArrayAttribute helper method
- Handle JArray deserialization from JSON properly
- Improve error messages with type information
- Add regular attributes to empty array test endpoints to ensure transaction capture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add comprehensive integration tests for custom attributes array support
- Add array attribute endpoints to both .NET Framework and .NET Core test applications
- Create integration test classes for testing array serialization end-to-end
- Test string, int, and bool arrays in transaction traces and events
- Verify empty arrays and null-only arrays are properly skipped
- Test null filtering within arrays (nulls are excluded from serialized arrays)
- Support both ASP.NET Framework (WebAPI) and ASP.NET Core applications
- Add remote service fixture methods for exercising array endpoints
- Fix test reliability by using transaction events for multi-endpoint scenarios
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add array support to JsonSerializerHelpers with null filtering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add integration tests for array custom attributes
- Add comprehensive integration test classes for both .NET Framework and .NET Core
- Extend test applications with new array attribute endpoints
- Add RemoteServiceFixture helper methods for array testing
- Update Assertions.cs to support array validation in tests
- Verify arrays work in transaction traces, transaction events, and error telemetry
- Test empty array filtering and null element removal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: Minor refactoring and cleanup
* fix: improve array validation in integration test assertions
- Add support for string[], int[], bool[] typed arrays in test assertions
- Extract array validation logic into ValidateArrayAttribute helper method
- Handle JArray deserialization from JSON properly
- Improve error messages with type information
- Add regular attributes to empty array test endpoints to ensure transaction capture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add comprehensive integration tests for custom attributes array support
- Add array attribute endpoints to both .NET Framework and .NET Core test applications
- Create integration test classes for testing array serialization end-to-end
- Test string, int, and bool arrays in transaction traces and events
- Verify empty arrays and null-only arrays are properly skipped
- Test null filtering within arrays (nulls are excluded from serialized arrays)
- Support both ASP.NET Framework (WebAPI) and ASP.NET Core applications
- Add remote service fixture methods for exercising array endpoints
- Fix test reliability by using transaction events for multi-endpoint scenarios
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: enhance JsonSerializerHelpers test coverage for complete code path coverage
- Add tests for all numeric types: double, float, decimal, long, char
- Add tests for unsigned types: ushort, uint, ulong
- Add tests for signed types: short, sbyte, byte
- Add tests for character and boolean arrays
- Add tests for non-serializable objects to cover exception handling path
- Add tests for mixed numeric types in arrays
- Achieve 100% branch coverage for JsonSerializerHelpers.WriteValue() method
- All 27 unit tests passing with comprehensive validation of all execution paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* cleanup: remove CustomArrayErrorAttributes method from ASP.NET Core test controller
- Remove leftover CustomArrayErrorAttributes method that attempted to pass arrays to NoticeError()
- Error attributes do not support arrays and this functionality will not be implemented
- Ensures test applications only contain valid array attribute endpoints
- Maintains clean separation between AddCustomAttribute (supports arrays) and NoticeError (does not)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: revert to discard pattern for switch case variables in JsonSerializerHelpers
- Revert unnecessary ReSharper refactor that introduced inconsistent variable naming
- Use discard pattern (_) consistently across all switch cases
- Maintain original value parameter usage for cleaner, more consistent code
- Addresses review feedback about variable naming inconsistencies
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1ccc871 commit 4fb9405
9 files changed
Lines changed: 1036 additions & 19 deletions
File tree
- src/Agent/NewRelic/Agent/Core/JsonConverters
- tests/Agent
- IntegrationTests
- Applications
- AspNetCoreWebApiCustomAttributesApplication/Controllers
- CustomAttributesWebApi
- IntegrationTestHelpers
- IntegrationTests
- CustomAttributes
- RemoteServiceFixtures
- UnitTests/Core.UnitTest/JsonConverters
Lines changed: 44 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
55 | 67 | | |
| 68 | + | |
| 69 | + | |
56 | 70 | | |
57 | 71 | | |
58 | 72 | | |
59 | | - | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | | - | |
| 76 | + | |
63 | 77 | | |
64 | 78 | | |
65 | | - | |
| 79 | + | |
66 | 80 | | |
67 | 81 | | |
68 | | - | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | | - | |
| 85 | + | |
72 | 86 | | |
73 | 87 | | |
74 | | - | |
| 88 | + | |
75 | 89 | | |
76 | 90 | | |
77 | | - | |
| 91 | + | |
78 | 92 | | |
79 | 93 | | |
80 | | - | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | | - | |
| 97 | + | |
84 | 98 | | |
85 | 99 | | |
86 | | - | |
| 100 | + | |
87 | 101 | | |
88 | 102 | | |
89 | | - | |
| 103 | + | |
90 | 104 | | |
91 | 105 | | |
92 | | - | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | | - | |
| 109 | + | |
96 | 110 | | |
97 | 111 | | |
98 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
99 | 124 | | |
100 | 125 | | |
101 | 126 | | |
| |||
107 | 132 | | |
108 | 133 | | |
109 | 134 | | |
| 135 | + | |
110 | 136 | | |
111 | | - | |
| 137 | + | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
| |||
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
64 | 105 | | |
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1083 | 1083 | | |
1084 | 1084 | | |
1085 | 1085 | | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1086 | 1106 | | |
1087 | 1107 | | |
1088 | 1108 | | |
1089 | 1109 | | |
1090 | 1110 | | |
1091 | 1111 | | |
1092 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1093 | 1180 | | |
1094 | 1181 | | |
1095 | 1182 | | |
| |||
0 commit comments