Skip to content

Treat all advice as inline when indy is disabled#17442

Merged
laurit merged 1 commit intoopen-telemetry:mainfrom
laurit:advice-inline
Apr 7, 2026
Merged

Treat all advice as inline when indy is disabled#17442
laurit merged 1 commit intoopen-telemetry:mainfrom
laurit:advice-inline

Conversation

@laurit
Copy link
Copy Markdown
Contributor

@laurit laurit commented Apr 2, 2026

Currently all our advice is declared as inline. For indy advice we fake the inline attribute value to false. This PR make us fake the inline attribute value to true when not using indy. This will let us transition the indy ready modules to use inline=false. Eventually we could detect whether to use inline or non-inline style advice by inspecting the advice classes. For our built in instrumentations we may need to use some other means to communicate that they are indy ready as inspecting all advice classes can be a bit costly.

@laurit laurit requested a review from a team as a code owner April 2, 2026 15:45
Copy link
Copy Markdown
Contributor

@SylvainJuge SylvainJuge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly, this makes both the indy and inline instrumentation closer by making them both use AdviceInliningPoolStrategy, in one case it will add inline = true and another inline = false on the advice at runtime.

Doing the same directly in advice code would produce a slightly different result as the default value inline = true is omitted from the bytecode created by javac.

For now, the lack of inline attribute in advice method annotation can mean "you can use either indy or inline", do we plan in the future to also remove this and then have: inline = false for indy advice and otherwise consider it to be an inline advice ?

@laurit
Copy link
Copy Markdown
Contributor Author

laurit commented Apr 7, 2026

Doing the same directly in advice code would produce a slightly different result as the default value inline = true is omitted from the bytecode created by javac.

Yes, but imo not really relevant for us. We just need to convince byte-buddy to treat the advice as inline or not depending on how we wish to run the instrumentation.

For now, the lack of inline attribute in advice method annotation can mean "you can use either indy or inline"

actually we don't care whether there is a value for that attribute or not we can make it return what we want either way

do we plan in the future to also remove this and then have: inline = false for indy advice and otherwise consider it to be an inline advice ?

Eventually we can remove it. Initially we'll always use inline advice regardless of the attribute value. Next we'll stop overriding the value and instead use it to decide how the advice should be applied. For instrumentations that use inline we'll use the inline advice mode and for others we'll use the non-inline indy mode. This hopefully will let us transition towards using indy advice without immediately breaking existing extensions. Inside the agent we'll probably skip introspecting the advice and instead rely on something like the existing indyRead to decide whether the given instrumentation will run as indy. We'll reject instrumentation modules that mix inline and non-inline adive.

@laurit laurit merged commit 26bc117 into open-telemetry:main Apr 7, 2026
93 checks passed
@laurit laurit deleted the advice-inline branch April 7, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants