in agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/exporter/Exporter.java [199:229]
private void internalExport(SpanData span) {
SpanKind kind = span.getKind();
String instrumentationName = span.getInstrumentationLibraryInfo().getName();
telemetryClient
.getStatsbeatModule()
.getInstrumentationStatsbeat()
.addInstrumentation(instrumentationName);
if (kind == SpanKind.INTERNAL) {
Boolean isLog = span.getAttributes().get(AI_LOG_KEY);
if (isLog != null && isLog) {
exportLogSpan(span);
} else if (instrumentationName.startsWith("io.opentelemetry.spring-scheduling-")
&& !span.getParentSpanContext().isValid()) {
// TODO (trask) AI mapping: need semantic convention for determining whether to map INTERNAL
// to request or
// dependency (or need clarification to use SERVER for this)
exportRequest(span);
} else {
exportRemoteDependency(span, true);
}
} else if (kind == SpanKind.CLIENT || kind == SpanKind.PRODUCER) {
exportRemoteDependency(span, false);
} else if (kind == SpanKind.CONSUMER
&& "receive".equals(span.getAttributes().get(SemanticAttributes.MESSAGING_OPERATION))) {
exportRemoteDependency(span, false);
} else if (kind == SpanKind.SERVER || kind == SpanKind.CONSUMER) {
exportRequest(span);
} else {
throw new UnsupportedOperationException(kind.name());
}
}