-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraalVM native support for the OpenTelemetry annotations
- Loading branch information
1 parent
4439dec
commit 9ca9b7e
Showing
6 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...pring/autoconfigure/instrumentation/annotations/OpenTelemetryAnnotationsRuntimeHints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations; | ||
|
||
import org.springframework.aot.hint.MemberCategory; | ||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.RuntimeHintsRegistrar; | ||
import org.springframework.aot.hint.TypeReference; | ||
|
||
class OpenTelemetryAnnotationsRuntimeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
hints | ||
.reflection() | ||
.registerType( | ||
TypeReference.of( | ||
"io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations.InstrumentationWithSpanAspect"), | ||
hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS)); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ation/spring/spring-boot-autoconfigure-3/src/main/resources/META-INF/spring/aot.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.springframework.aot.hint.RuntimeHintsRegistrar=\ | ||
opentelemetry.instrumentation.spring.autoconfigure.instrumentation.annotations.OpenTelemetryRuntimeHints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...r/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/SpringComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.spring.smoketest; | ||
|
||
import io.opentelemetry.instrumentation.annotations.SpanAttribute; | ||
import io.opentelemetry.instrumentation.annotations.WithSpan; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class SpringComponent { | ||
|
||
@SuppressWarnings("MethodCanBeStatic") | ||
@WithSpan() | ||
public void withSpanMethod(@SpanAttribute String paramName) {} | ||
} |