Automatic instrumentation vs manual - when and how? #3068
-
Open telemetry is changing rapidly, and I'm confused about how to configure instrumentation of my apps. For a while we have option of Automatic instrumentation but I can't find anywhere when this scenario is better then manual. For example how it affects performance? Another question is how exactly is this mechanism working? I see docs about configuration but I can't find any on how automatic instrumentation actually works. How it magically reads metrics from process, what techniques it uses, is it working out of process etc. Is it applicable to all scenarios? For example documentations about IIS https://opentelemetry.io/docs/instrumentation/net/automatic/ says about .NET Framework but nothing about .NET Core? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
When you do not want to change the code, update the code when API changes or when you want to instrument another library. TL;DR; when you prefer magic instead of maintaining the instrumentation manually. I do not say that it is better. It is a different approach.
That is a though question. In short: it affects performance as any kind of instrumentation. The manual instrumentation should be a little faster, but everything depends on the environment. In usual business applications the performance overhead should be tolerable.
See https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/design.md
It says about .NET (.NET Core was renamed to .NET). None .NET Core version is currently supported by Microsoft. |
Beta Was this translation helpful? Give feedback.
-
Hi Robert,
Played with both extensively, and yes, it's in flux. The auto-instrumentation relies (mostly) on env variables and a script to inject the libraries. It gets messy quickly if you are in moderately complex ci/cd context (kubernetes or compose) and that's where we got off the path.
The manual instrumentation and extensions (EF, Asp.net core, grpc, etc.) are working well, but there's some artistry to getting the config/service injection right. If you're rolling multiple projects into one container, you'll likely fight dup. Instrumentation.
Another downside here is that if you get really granular with Activities/Spans, you get some crowded/not-so-pretty code to trap the traces. Likely an attribute-based solution in the future.
Let me know if I can provide more info/examples.
Make no mistake though, in complex systems, the span contexts alone make the effort worthwhile.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Robert Pająk ***@***.***>
Sent: Saturday, November 4, 2023 12:41:46 AM
To: open-telemetry/opentelemetry-dotnet-instrumentation ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [open-telemetry/opentelemetry-dotnet-instrumentation] Automatic instrumentation vs manual - when and how? (Discussion #3068)
For a while we have option of Automatic instrumentation but I can't find anywhere when this scenario is better then manual.
When you do not want to change the code, update the code when API changes or when you want to instrument another library. TL;DR; when you prefer magic instead of maintaining the instrumentation manually.
Another question is how exactly is this mechanism working?
See https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/design.md
says about .NET Framework but nothing about .NET Core?
It says about .NET (.NET Core was renamed to .NET). None .NET Core version is currently supported by Microsoft.
—
Reply to this email directly, view it on GitHub<#3068 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEYBK7TM7FLDUDY64XMDQDYCUUFVAVCNFSM6AAAAAA64YXWJSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TINRZGY2TE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@pellared thanks for your answer. I had to be blind not seeing docs about design. Now after reading I have more questions - I will be graitfoul for some answers ;) I'm Aware that manual and automatic are different approach to sam think but the question is - apart of different configuration injection do we have other differences
|
Beta Was this translation helpful? Give feedback.
No, there isn't.
No, only a single CLR Profiler can be used for .NET/.NET Framework application. There are some projects that allow multiplexing CLR profilers into a single project but it is hard to guarantee that they won't interfere with each other. If you Dynatrace agent deploys a CLR Profiler (and I think it does) you can't have the bytecode instrumentation from this project. However, you can still use the StartupHook to automatically add OTel instrumentations to your application. Once more: in t…