in apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanInstrumentation.java [188:229]
private static boolean handleSpecialTransactionTag(TransactionImpl transaction, String key, Object value) {
if ("type".equals(key)) {
transaction.withType(value.toString());
return true;
} else if ("result".equals(key)) {
transaction.withResult(value.toString());
return true;
} else if ("error".equals(key)) {
if (Boolean.TRUE.equals(value)) {
transaction.withResultIfUnset("error");
}
return true;
} else if ("http.status_code".equals(key) && value instanceof Number) {
int status = ((Number) value).intValue();
transaction.getContext().getResponse().withStatusCode(status);
transaction.withResultIfUnset(ResultUtil.getResultByHttpStatus(status));
transaction.withOutcome(ResultUtil.getOutcomeByHttpServerStatus(status));
transaction.withType(co.elastic.apm.agent.tracer.Transaction.TYPE_REQUEST);
return true;
} else if ("http.method".equals(key)) {
transaction.getContext().getRequest().withMethod(value.toString());
transaction.withType(co.elastic.apm.agent.tracer.Transaction.TYPE_REQUEST);
return true;
} else if ("http.url".equals(key)) {
transaction.getContext().getRequest().getUrl().withFull(value.toString());
transaction.withType(co.elastic.apm.agent.tracer.Transaction.TYPE_REQUEST);
return true;
} else if ("sampling.priority".equals(key)) {
// mid-trace sampling is not allowed
return true;
} else if ("user.id".equals(key)) {
transaction.getContext().getUser().withId(value.toString());
return true;
} else if ("user.email".equals(key)) {
transaction.getContext().getUser().withEmail(value.toString());
return true;
} else if ("user.username".equals(key)) {
transaction.getContext().getUser().withUsername(value.toString());
return true;
}
return false;
}