Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add s12y metrics for setUserId API call #1540

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ public class MetricNames {
public static final String SUPPORTABILITY_API_SET_SERVER_INFO = "SetServerInfo";
public static final String SUPPORTABILITY_API_SET_USER_NAME = "SetUserName";
public static final String SUPPORTABILITY_API_SET_ACCOUNT_NAME = "SetAccountName";
public static final String SUPPORTABILITY_API_SET_USER_ID = "SetUserId";

//Transaction supportability metrics
public static final String SUPPORTABILITY_TRANSACTION_STARTED = "Supportability/Transaction/StartedCount";
Expand Down Expand Up @@ -492,6 +493,7 @@ public class MetricNames {
public static final String SUPPORTABILITY_ERROR_GROUPING_CALLBACK_ENABLED = "Supportability/ErrorGrouping/Callback/enabled";
public static final String SUPPORTABILITY_ERROR_GROUPING_CALLBACK_EXECUTION_TIME = "Supportability/ErrorGrouping/Callback/ExecutionTime";


/**
* Utility method for adding supportability metrics to APIs
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public void addCustomParameters(Map<String, Object> params) {
*/
@Override
public void setUserId(String userId) {
MetricNames.recordApiSupportabilityMetric(MetricNames.SUPPORTABILITY_API_SET_USER_ID);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the specifics of the ticket, but do we want to send the metric if the call is ignored due to high security being enabled? Or have another metric for when it is ignored due to high security?

if (ServiceFactory.getConfigService().getDefaultAgentConfig().isHighSecurity()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,17 @@ public void setInstanceName_recordsSupportabilityMetric() {
}
}

@Test
public void setUserId_recordsSupportabilityMetric() {
mockOutServices();
NewRelicApiImplementation target = new NewRelicApiImplementation();

try(MockedStatic<MetricNames> mockMetricNames = Mockito.mockStatic(MetricNames.class)) {
target.setUserId("instance");
mockMetricNames.verify(() -> MetricNames.recordApiSupportabilityMetric(MetricNames.SUPPORTABILITY_API_SET_USER_ID));
}
}

@Test
public void setErrorGroupCallback_setsCallback() {
mockOutServices();
Expand Down
Loading