Bumps [net.bytebuddy:byte-buddy-agent](https://github.com/raphw/byte-buddy) from 1.13.0 to 1.14.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/raphw/byte-buddy/releases">net.bytebuddy:byte-buddy-agent's releases</a>.</em></p> <blockquote> <h2>Byte Buddy 1.14.0</h2> <ul> <li>Add <code>Step.Factory.ForDelegation</code> in <code>MemberSubstitution</code> that allows for delegation similar to <code>MethodDelegation</code> but in-code.</li> <li>Add handlers for <code>MethodDelegation</code> and <code>Advice</code> that leverage method handles for field access and self-invocation.</li> <li>Add <code>Step.Factory</code> for type assignment that allows casting the return value from a previous step to another type.</li> <li>Avoid usage of <code>URL</code> class loader as it is deprecated, and use newer method if available.</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/raphw/byte-buddy/blob/master/release-notes.md">net.bytebuddy:byte-buddy-agent's changelog</a>.</em></p> <blockquote> <h3>18. February 2023: version 1.14.0</h3> <ul> <li>Add <code>Step.Factory.ForDelegation</code> in <code>MemberSubstitution</code> that allows for delegation similar to <code>MethodDelegation</code> but in-code.</li> <li>Add handlers for <code>MethodDelegation</code> and <code>Advice</code> that leverage method handles for field access and self-invocation.</li> <li>Add <code>Step.Factory</code> for type assignment that allows casting the return value from a previous step to another type.</li> <li>Avoid usage of <code>URL</code> class loader as it is deprecated, and use newer method if available.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|---|---|---|
| .. | ||
| runtime-attach | ||
| runtime-attach-core | ||
| README.md | ||
README.md
Runtime attachment
If you can't update the JVM arguments to attach the OpenTelemetry Java agent (-javaagent:path/to/opentelemetry-javaagent.jar), this project allows you to do attachment programmatically.
Quick start
Add a dependency
Replace OPENTELEMETRY_CONTRIB_VERSION with the latest release version.
For Maven, add to your pom.xml the following dependency:
<dependency>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-runtime-attach</artifactId>
<version>OPENTELEMETRY_CONTRIB_VERSION</version>
</dependency>
For Gradle, add to your dependencies:
implementation("io.opentelemetry.contrib:opentelemetry-runtime-attach:OPENTELEMETRY_CONTRIB_VERSION")
This dependency embeds the OpenTelemetry agent JAR.
Call runtime attach method
The io.opentelemetry.contrib.attach.RuntimeAttach class has an attachJavaagentToCurrentJVM method allowing to trigger the attachment of the OTel agent for Java.
You have to call this method at the beginning of your application's main method.
We give below an example for Spring Boot applications:
@SpringBootApplication
public class SpringBootApp {
public static void main(String[] args) {
RuntimeAttach.attachJavaagentToCurrentJVM();
SpringApplication.run(SpringBootApp.class, args);
}
}
Limitations
The attachment will not be initiated in the following cases:
- The
otel.javaagent.enabledproperty is set tofalse - The
OTEL_JAVAAGENT_ENABLEDenvironment variable is set tofalse - The attachment is not requested from the main thread
- The attachment is not requested from the
public static void main(String[] args)method - The agent is already attached
- The application is running on a JRE (a JDK is necessary, see this issue)
- The temporary directory should be writable
Component owners
- Jean Bisutti, Microsoft
- Nikita Salnikov-Tarnovski, Splunk
Learn more about component owners in component_owners.yml.