opentelemetry-java-instrumentation
opentelemetry-java-instrumentation copied to clipboard
Add automatic MongoDB instrumentation to the OTel starter
Based on https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11256
View actual diff: https://github.com/zeitlinger/opentelemetry-java-instrumentation/compare/spring-testing-project...zeitlinger:opentelemetry-java-instrumentation:spring-mongo
Fixes https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/11210
@jeanbisutti this test only fails in spring native mode with the following error:
Caused by: java.lang.ClassNotFoundException: org.springframework.data.mongodb.core.aggregation.AggregationOperation
Can you help?
@jeanbisutti this test only fails in spring native mode with the following error:
Caused by: java.lang.ClassNotFoundException: org.springframework.data.mongodb.core.aggregation.AggregationOperationCan you help?
@zeitlinger It seems related to the Spring code, not the OTel Starter code (to check).
In this case, the following code in the RuntimeHints class solves the issue:
hints
.reflection()
.registerType(
TypeReference.of("org.springframework.data.mongodb.core.aggregation.AggregationOperation"),
hint -> {
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
});
@zeitlinger I confirm that the GraalVM native issue is related to the Spring code, not the OpenTelemetry code. I have pushed a fix on your branch.