use of com.newrelic.api.agent.DatastoreParameters in project newrelic-java-agent by newrelic.
the class SpanEventFactory method setExternalParameterAttributes.
public SpanEventFactory setExternalParameterAttributes(ExternalParameters parameters) {
if (parameters instanceof HttpParameters) {
HttpParameters httpParameters = (HttpParameters) parameters;
setCategory(SpanCategory.http);
setUri(httpParameters.getUri());
setHttpMethod(httpParameters.getProcedure());
setHttpStatusCode(httpParameters.getStatusCode());
setHttpStatusText(httpParameters.getStatusText());
setHttpComponent((httpParameters).getLibrary());
setKindFromUserAttributes();
} else if (parameters instanceof DatastoreParameters) {
DatastoreParameters datastoreParameters = (DatastoreParameters) parameters;
setCategory(SpanCategory.datastore);
setDatastoreComponent(datastoreParameters.getProduct());
setDatabaseName(datastoreParameters.getDatabaseName());
setDatabaseCollection(datastoreParameters.getCollection());
setHostName(datastoreParameters.getHost());
setKindFromUserAttributes();
if (datastoreParameters instanceof SlowQueryDatastoreParameters) {
SlowQueryDatastoreParameters<?> queryDatastoreParameters = (SlowQueryDatastoreParameters<?>) datastoreParameters;
setDatabaseStatement(determineObfuscationLevel(queryDatastoreParameters));
}
if (datastoreParameters.getPort() != null) {
setAddress(datastoreParameters.getHost(), String.valueOf(datastoreParameters.getPort()));
} else {
setAddress(datastoreParameters.getHost(), datastoreParameters.getPathOrId());
}
} else {
setCategory(SpanCategory.generic);
}
return this;
}
Aggregations