@@ -107,28 +107,21 @@ void nr_lib_aws_sdk_php_sqs_handle(nr_segment_t* segment,
107
107
}
108
108
109
109
/* Determine if we instrument this command. */
110
- if ( command_name_len == AWS_SQS_SEND_MESSAGE_BATCH_COMMAND_LEN
111
- && 0
112
- == nr_strncmp ( AWS_SQS_SEND_MESSAGE_BATCH_COMMAND ,
113
- command_name_string ,
114
- AWS_SQS_SEND_MESSAGE_BATCH_COMMAND_LEN )) {
110
+ #define COMMAND_IS ( CMD ) \
111
+ (command_name_len == (sizeof(CMD) - 1) && nr_streq(CMD, command_name_string))
112
+
113
+ /* Determine if we instrument this command. */
114
+ if ( COMMAND_IS ( "sendMessageBatch" )) {
115
115
message_params .message_action = NR_SPANKIND_PRODUCER ;
116
- } else if (command_name_len == AWS_SQS_SEND_MESSAGE_COMMAND_LEN
117
- && 0
118
- == nr_strncmp (AWS_SQS_SEND_MESSAGE_COMMAND ,
119
- command_name_string ,
120
- AWS_SQS_SEND_MESSAGE_COMMAND_LEN )) {
116
+ } else if (COMMAND_IS ("sendMessage" )) {
121
117
message_params .message_action = NR_SPANKIND_PRODUCER ;
122
- } else if (command_name_len == AWS_SQS_RECEIVE_MESSAGE_COMMAND_LEN
123
- && 0
124
- == nr_strncmp (AWS_SQS_RECEIVE_MESSAGE_COMMAND ,
125
- command_name_string ,
126
- AWS_SQS_RECEIVE_MESSAGE_COMMAND_LEN )) {
118
+ } else if (COMMAND_IS ("receiveMessage" )) {
127
119
message_params .message_action = NR_SPANKIND_CONSUMER ;
128
120
} else {
129
121
/* Nothing to do here so exit. */
130
122
return ;
131
123
}
124
+ #undef IS_COMMAND
132
125
133
126
cloud_attrs .aws_operation = command_name_string ;
134
127
0 commit comments