Skip to content

Resolve @ObserveGeneration on JDK proxies and surface non-proxyable model methods #7

Description

@ChoMinGi

Problem

When spring.aop.proxy-target-class=false, an implementation method annotated with @ObserveGeneration can execute without producing a span.

The advice is entered through a JDK proxy, but ObserveGenerationAspect reads the annotation from the interface method exposed by the join point. That method has no annotation, descriptor construction fails, and the fail-open path logs only at debug level. Automatic model instrumentation does not recover the trace because the bean post-processor already found the annotation on the implementation and skipped its decorator.

This is narrower than a general “final method” bug:

  • public CGLIB-proxied annotated methods work;
  • JDK proxies with implementation-only annotations silently lose the span;
  • CGLIB final methods are not advised and Spring warns;
  • private methods and self-invocation bypass proxy advice by design.

0.2.1 scope

  • Resolve the most-specific bridged target method before reading @ObserveGeneration.
  • Keep annotation precedence, but perform the model bean proxyability check early enough to emit a clear library warning for non-advisable methods.
  • Document Spring proxy limits and the JDK-proxy option for interface-based models.

Regression coverage

  • JDK proxy plus implementation annotation emits exactly one span with the configured name and model.
  • Final implementation method and final implementation class work through a JDK proxy.
  • CGLIB final methods preserve the original bean behavior and emit an explicit warning.
  • Existing CGLIB behavior and Spring AI/LangChain4j annotation precedence still avoid duplicate spans.

Tracked separately so the exact 0.2.0 release candidate remains limited to the already-reviewed release contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions