Skip to content

Conversation

zsistla
Copy link
Contributor

@zsistla zsistla commented Mar 14, 2025

Added functionality to instrument

Call	                 collection(tablename)	operation	product

Create Table	TableName parameter	create_table	DynamoDB
Delete Item	TableName parameter	delete_item	DynamoDB
Delete Table	TableName parameter	delete_table	DynamoDB
Get Item	TableName parameter	get_item	DynamoDB
Put Item	TableName parameter	put_item	DynamoDB
Query	        TableName parameter	query	        DynamoDB
Scan	        TableName parameter	scan	        DynamoDB
Update Item	TableName parameter	update_item	DynamoDB

Unit tests added.
See also relevant multiverse PR.
See also relevant soak test PR.

Needed a modification to axiom to:

  • add db.system
  • modify datastore to allow for datastore that don't have concept of database name

zsistla added 2 commits March 14, 2025 09:33
* add db.system
* modify datastore to allow for datastore that don't have concept of database name
* Added instrumentation to handle the calls specified in the agent spec
* Added unit tests
@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented Mar 14, 2025

Test Suite Status Result
Multiverse 6/8 passing
SOAK 78/79 passing

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 54.54545% with 50 lines in your changes missing coverage. Please review.

Project coverage is 77.14%. Comparing base (b00dcc3) to head (80a4b2d).

Files with missing lines Patch % Lines
agent/lib_aws_sdk_php.c 47.91% 50 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1037      +/-   ##
==========================================
- Coverage   77.22%   77.14%   -0.08%     
==========================================
  Files         198      198              
  Lines       27899    27990      +91     
==========================================
+ Hits        21544    21592      +48     
- Misses       6355     6398      +43     
Flag Coverage Δ
agent-for-php-7.2 77.45% <100.00%> (+<0.01%) ⬆️
agent-for-php-7.3 77.47% <100.00%> (+<0.01%) ⬆️
agent-for-php-7.4 77.19% <100.00%> (+<0.01%) ⬆️
agent-for-php-8.0 76.58% <100.00%> (+<0.01%) ⬆️
agent-for-php-8.1 76.90% <54.54%> (-0.08%) ⬇️
agent-for-php-8.2 76.51% <54.54%> (-0.08%) ⬇️
agent-for-php-8.3 76.51% <54.54%> (-0.08%) ⬇️
agent-for-php-8.4 76.53% <54.54%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mfulb mfulb self-requested a review March 28, 2025 16:51
Comment on lines +20 to +26
#define AWS_LAMBDA_ARN_REGEX \
"(arn:(aws[a-zA-Z-]*)?:lambda:)?" \
"((?<region>[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}):)?" \
"((?<accountId>\\d{12}):)?" \
"(function:)?" \
"(?<functionName>[a-zA-Z0-9-\\.]+)" \
"(:(?<qualifier>\\$LATEST|[a-zA-Z0-9-]+))?"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format only.

nr_segment_cloud_attrs_t cloud_attrs = {
.cloud_platform = "aws_lambda"
};
nr_segment_cloud_attrs_t cloud_attrs = {.cloud_platform = "aws_lambda"};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format only


/* This stores the compiled regex to parse AWS ARNs. The compilation happens when
* it is first needed and is destroyed in mshutdown
/* This stores the compiled regex to parse AWS ARNs. The compilation happens
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Comment on lines +390 to +392
void nr_aws_sdk_lambda_client_invoke_parse_args(
NR_EXECUTE_PROTO,
nr_segment_cloud_attrs_t* cloud_attrs) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Comment on lines +411 to +412
zval* lambda_name
= nr_php_zend_hash_find(Z_ARRVAL_P(lambda_args), "FunctionName");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Comment on lines +423 to +424
nr_regex_substrings_t* matches = nr_regex_match_capture(
aws_arn_regex, Z_STRVAL_P(lambda_name), Z_STRLEN_P(lambda_name));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Comment on lines +450 to +452
if (NULL != execute_data->func
&& NULL != execute_data->func->common.scope) {
base_class = execute_data->func->common.scope;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Comment on lines +469 to +473
arn = nr_formatf("arn:aws:lambda:%s:%s:function:%s:%s", region, accountID,
function_name, qualifier);
} else {
arn = nr_formatf("arn:aws:lambda:%s:%s:function:%s",
region, accountID, function_name);
arn = nr_formatf("arn:aws:lambda:%s:%s:function:%s", region, accountID,
function_name);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

bduranleau-nr
bduranleau-nr previously approved these changes Mar 28, 2025
void nr_aws_sdk_lambda_client_invoke_parse_args(NR_EXECUTE_PROTO, nr_segment_cloud_attrs_t* cloud_attrs);
void nr_aws_sdk_lambda_client_invoke_parse_args(
NR_EXECUTE_PROTO,
nr_segment_cloud_attrs_t* cloud_attrs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a formatting only change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

operation, &datastore, params->instance);
scoped_metric = create_metrics(segment, duration, datastore_string,
params->datastore.type, collection, operation,
&datastore, params->instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting change only possibly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@zsistla zsistla merged commit 5550f62 into dev Apr 9, 2025
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants