Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZNeumann committed Feb 26, 2025
1 parent 87448b0 commit 1f15abf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion agent/lib_aws_sdk_php.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,

/* reconstruct the ARN */
nr_aws_lambda_invoke(NR_EXECUTE_ORIG_ARGS, &cloud_attrs);
if (!cloud_attrs.cloud_resource_id) {
if (NULL == cloud_attrs.cloud_resource_id) {
/* we do not want to instrument if we cannot reconstruct the ARN */
return;
}
Expand All @@ -352,6 +352,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,
*/
external_segment = nr_segment_start(NRPRG(txn), NULL, NULL);
if (NULL == external_segment) {
nr_free(cloud_attrs.cloud_resource_id);
return;
}
/* re-use start time from auto_segment started in func_begin */
Expand Down Expand Up @@ -379,6 +380,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,
}
}
nr_segment_external_end(&auto_segment, &external_params);
nr_free(cloud_attrs.cloud_resource_id);
}

/* This stores the compiled regex to parse AWS ARNs. The compilation happens when
Expand Down
1 change: 1 addition & 0 deletions agent/tests/test_lib_aws_sdk_php.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ NR_PHP_WRAPPER(aws_lambda_invoke_wrapper) {
cloud_attrs.cloud_resource_id);
}
NR_PHP_WRAPPER_CALL;
nr_free(cloud_attrs.cloud_resource_id);
}
NR_PHP_WRAPPER_END

Expand Down

0 comments on commit 1f15abf

Please sign in to comment.