ApplicationInsights-Java icon indicating copy to clipboard operation
ApplicationInsights-Java copied to clipboard

Custom Instrumentation Hook: Capture Method Input Param as Span Attributes

Open zoomingrocket opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. Describe what the problem you have encountered; e.g I'm always frustrated when [...] We are using Custom Instrumentation Hook feature to create spans around methods from COTS system for which no traditional instrumentation is available. Everything works out really well except all the spans are named with Package.Method by default which does not help in meaningful analysis or debug for problem areas.

Describe the solution you would like Request to enhance the custom instrumentation hook to capture all method input parameters as attributes. This will help us use span processors to rename spans appropriately as desired use case by use case

E.g. If custom instrumentation hook is enabled for Package.Method and Method takes 5 input params, make all 5 input params available as span attributes inp1=value1;inp2=value2;inp3=value3;inp4=value4;inp5=value5 and so on

Describe alternatives you have considered We have captured the verbose log for Custom Instrumentation spans and noticed that we do not have any attributes captured today, so no meaningful data available to rename spans

Additional context #2380 https://github.com/microsoft/ApplicationInsights-Java/issues/2048

zoomingrocket avatar Aug 19 '22 15:08 zoomingrocket

@trask - Thanks for the custom instrumentation hook enhancement with 3.1.1! It's a huge life saver to nail down issues quickly in distributed COTs ecosystem 👍 Now extending the idea to close one final gap, i.e. naming the spans appropriately. I have proposed a solution here to capture method input parameters as attributes which will help us rename the spans in any way we want leveraging span processors. Let me know if it makes sense but happy to try out any alpha release to help along.

Thanks again

zoomingrocket avatar Aug 19 '22 15:08 zoomingrocket

hi @zoomingrocket! there's no equivalent of this option yet in the upstream OpenTelemetry Javaagent, so may not be able to get to this for a while

trask avatar Aug 25 '22 02:08 trask

@trask - Should i be logging a OTEP request or upstream enhancement is tracked differently?

zoomingrocket avatar Aug 25 '22 18:08 zoomingrocket

you can log a feature request in https://github.com/open-telemetry/opentelemetry-java-instrumentation

trask avatar Aug 25 '22 19:08 trask

@trask - Thanks, logged similar request in upstream Otel Project - Otel - 6517

zoomingrocket avatar Aug 27 '22 04:08 zoomingrocket