open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.16k stars 748 forks source link

Aspect-oriented programming support #4078

Closed cesarbmx closed 3 weeks ago

cesarbmx commented 1 year ago

I would like to decorate with attributes my methods rather than polluting them with code and usings. I mainly use OpenTelemetry to group spans under the same trace across multiple microservices.

Thanks

reyang commented 1 year ago

@cesarbmx thanks for the idea, do you have some code snippets which would show the expected experience?

cesarbmx commented 1 year ago

If we could just nest an active span by decorating the method, it would be great. The documentation shows how to do it with in-line code.

Creating nested Spans image

pellared commented 1 year ago

If we could just nest an active span by decorating the method, it would be great. The documentation shows how to do it with in-line code.

Creating nested Spans image

How would you specify which methods should be decorated? How would you define the span name? How would you add attributes?

github-actions[bot] commented 3 weeks ago

Closed as inactive. Feel free to reopen if this issue is still a concern.