Skip to content

Trace methods of all classes under a package by otel.instrumentation.methods.include=my.package.** #2574

Open
@Johnny850807

Description

@Johnny850807

Is your feature request related to a problem? Please describe.
I'd like to trace all the classes/methods under a package recursively using the otel.instrumentation.methods.include system property, without naming every class.

I think this is a really powerful feature if we can achieve such transparency for in-process tracing like this, as in many situations, we hope that our core domain's module is agnostic of how they are traced.

So we can no longer depend on the open-telemetry instrumentation API's @WithSpan.

Describe the solution you'd like

Given I have a Spring-Boot project as below

src
│   └── main
│       ├── java
│       │   └── com
│       │       └── example
│       │           └── demo
│       │               ├── DemoApplication.java
│       │               ├── SignIn.java
│       │               ├── SignInRequest.java
│       │               ├── SignUp.java
│       │               ├── User.java
│       │               ├── UserController.java
│       │               ├── UserPresenter.java
│       │               └── UserRepository.java

I want to set -Dotel.instrumentation.methods.include=com.example.demo or -Dotel.instrumentation.methods.include=com.example.demo.** to include all my application classes for tracing.

Could we achieve this?


This feature may produce many spans and is considered dangerous.
However, I think we can emphasize its consequences to the users,
but be able to support the full transparency if the user asks to.

If it's properly used then we can see a trace like:
(In a Clean Architecture style)

[POST] /api/chessGames/13/chess
  └──PlayChessController.putChess
      ├── PutChessUseCase.putChess (Domain)
      | └── SpringBootChessGameRepository 
      |      ├── CrudRepository.findById 
      |      └── DataMapper.toEntity
      ├──  ChessGame.putChess (Domain)
      |      └── Board.setChess
      ├── SpringBootChessGameRepository 
      |      ├── DataMapper.toData
      |.     └── CrudRepository.save  
      │          └── INSERT INTO ...
      └── ChessGamePresenter.present

Alternatives

Consider that there may be so many spans produced,
the alternative is that Include only the Spring bean's methods under a package*

Thanks for your time on my post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcomeenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions