Add Custom Tag To SQL Auto-Instrumentation #4769
-
Hello, I want to add custom tags to individual SQL queries that are auto-instrumented by the OpenTelemetry.Instrumentation.SqlClient library. I tried adding this, Activity.Current?.SetTag("sql.tagwith", "CreateCartAsync");, right before the EF Core code executes, but it doesn't show up. How can I add a custom tag to auto-instrumented SQL traces? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Thanks @vishweshbankwar. This appears to be enriching at a global scope, unless I'm missing something? I was looking for something to enrich at an individual SQL call. |
Beta Was this translation helpful? Give feedback.
-
Ok thanks. Does the library support enriching/adding custom tags for individual SQL calls? |
Beta Was this translation helpful? Give feedback.
https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.SqlClient#enrich