Skip to content

Commit

Permalink
fix(axiom): externalCallCount should be added to the txn not just the…
Browse files Browse the repository at this point in the history
… error (#1006)
  • Loading branch information
zsistla authored Jan 9, 2025
1 parent 34d720e commit 8a73dde
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 0 deletions.
2 changes: 2 additions & 0 deletions axiom/nr_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,8 @@ nrobj_t* nr_txn_event_intrinsics(const nrtxn_t* txn) {
params, txn->unscoped_metrics, "WebFrontend/QueueTime", "queueDuration");
nr_txn_add_metric_total_as_attribute(params, txn->unscoped_metrics,
"External/all", "externalDuration");
nr_txn_add_metric_count_as_attribute(params, txn->unscoped_metrics,
"External/all", "externalCallCount");
nr_txn_add_metric_total_as_attribute(params, txn->unscoped_metrics,
"Datastore/all", "databaseDuration");
nr_txn_add_metric_count_as_attribute(params, txn->unscoped_metrics,
Expand Down
1 change: 1 addition & 0 deletions axiom/tests/test_cmd_txndata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ static void test_encode_txn_event(void) {
"\"duration\":0.98700,\"totalTime\":0.98700,\"nr.apdexPerfZone\":"
"\"F\","
"\"queueDuration\":3.00000,\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":2.00000,"
"\"databaseCallCount\":2,"
"\"error\":false},"
Expand Down
5 changes: 5 additions & 0 deletions axiom/tests/test_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -4056,6 +4056,7 @@ static void test_create_event(void) {
"\"nr.apdexPerfZone\":\"F\","
"\"queueDuration\":3.00000,"
"\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":1.00000,"
"\"databaseCallCount\":1,"
"\"error\":false"
Expand All @@ -4078,6 +4079,7 @@ static void test_create_event(void) {
"\"totalTime\":0.98700,"
"\"queueDuration\":3.00000,"
"\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":1.00000,"
"\"databaseCallCount\":1,"
"\"error\":false"
Expand All @@ -4103,6 +4105,7 @@ static void test_create_event(void) {
"\"nr.apdexPerfZone\":\"F\","
"\"queueDuration\":3.00000,"
"\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":1.00000,"
"\"databaseCallCount\":1,"
"\"error\":false"
Expand All @@ -4126,6 +4129,7 @@ static void test_create_event(void) {
"\"nr.apdexPerfZone\":\"F\","
"\"queueDuration\":3.00000,"
"\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":1.00000,"
"\"databaseCallCount\":1,"
"\"error\":false"
Expand All @@ -4148,6 +4152,7 @@ static void test_create_event(void) {
"\"nr.apdexPerfZone\":\"F\","
"\"queueDuration\":3.00000,"
"\"externalDuration\":2.00000,"
"\"externalCallCount\":1,"
"\"databaseDuration\":1.00000,"
"\"databaseCallCount\":1,"
"\"error\":false"
Expand Down
30 changes: 30 additions & 0 deletions tests/integration/external/curl_exec/test_dt_simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,36 @@
/*EXPECT_RESPONSE_HEADERS
*/

/*EXPECT_ANALYTICS_EVENTS
[
"?? agent run id",
{
"reservoir_size": 50,
"events_seen": 1
},
[
[
{
"type": "Transaction",
"name": "OtherTransaction\/php__FILE__",
"timestamp": "??",
"duration": "??",
"totalTime": "??",
"externalDuration": "??",
"externalCallCount": 1,
"guid": "??",
"sampled": true,
"priority": "??",
"traceId": "??",
"error": false
},
{},
{}
]
]
]
*/

/*EXPECT_TRACED_ERRORS
null
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@
newrelic.transaction_tracer.detail = 0
*/

/*EXPECT_ANALYTICS_EVENTS
[
"?? agent run id",
{
"reservoir_size": 50,
"events_seen": 1
},
[
[
{
"type": "Transaction",
"name": "OtherTransaction\/php__FILE__",
"timestamp": "??",
"duration": "??",
"totalTime": "??",
"externalDuration": "??",
"externalCallCount": 1,
"guid": "??",
"sampled": true,
"priority": "??",
"traceId": "??",
"error": false
},
{},
{}
]
]
]
*/

/*EXPECT_SPAN_EVENTS_LIKE
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,39 @@
]
*/

/*EXPECT_ANALYTICS_EVENTS
[
"?? agent run id",
{
"reservoir_size": 50,
"events_seen": 1
},
[
[
{
"type": "Transaction",
"name": "OtherTransaction\/php__FILE__",
"timestamp": "??",
"duration": "??",
"totalTime": "??",
"externalDuration": "??",
"externalCallCount": 1,
"guid": "??",
"sampled": true,
"priority": "??",
"traceId": "??",
"error": true
},
{},
{
"errorType": "GuzzleHttp\\Exception\\BadResponseException",
"errorMessage": "Uncaught exception 'GuzzleHttp\\Exception\\BadResponseException' with message 'ClientException' in __FILE__:??"
}
]
]
]
*/

/*EXPECT_TRACED_ERRORS
[
"?? agent run id",
Expand Down
1 change: 1 addition & 0 deletions tests/integration/synthetics/test_happy_path_with_dt.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"nr.syntheticsJobId": "jjjjjjj-jjjj-1234-jjjj-jjjjjjjjjjjj",
"nr.syntheticsMonitorId": "mmmmmmm-mmmm-1234-mmmm-mmmmmmmmmmmm",
"externalDuration": "??",
"externalCallCount": 1,
"guid": "??",
"sampled": true,
"priority": "??",
Expand Down

0 comments on commit 8a73dde

Please sign in to comment.