Open mortenbock opened 1 week ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas @rajkumar-rangaraj @reyang @TimothyMothra @vishweshbankwar.
Mapping of Span kind, etc. is undocumented :( Fix should be in the docs page and would apply to all languages.
Hi @mortenbock, I'm not completely following what you're trying to accomplish
Are you trying to emit custom Dependency Telemetry from your app? Or is this a library that's emitting Activities and your hosting application is using OTel?
If you please could share a minimal example app of your approach that would help me understand.
@TimothyMothra I have a couple of scenarios I want to achieve.
The first is an application that has some background tasks running for some integration jobs on a schedule. I want to create a root activity when these tasks are started. Using the classic Insights SDK, I did this by making a DependencyTelemetry
operation, and setting the Type
property on that.
What I've got now in the Otel version is this:
using (var jobActivity = OtelConfiguration.ActivitySource.StartActivity(
name: "ProductImport",
kind: ActivityKind.Internal,
parentId: null))
{
// Run some integration work
await DoSomeWork();
}
This shows up in Application Insights as a "InProc" type, but I would like to control that type, so I can differentiate between different types of dependencies.
The second scenario is a more typical wrapper library for an API, where the standard http dependency telemetry doesn't quite make sense when analyzing it, so I want to wrap the operations in a custom activity that makes the trace more readable/useful.
In that case the it might make sense to set the "Type" to "HTTP", or it might be even better to set it to identify the external api like "AchmeApi".
I hope this clarifies the usecases I'm looking at?
Library name and version
Azure.Monitor.OpenTelemetry.AspNetCore 1.2.0
Query/Question
I am trying to instrument a library so it adds dependency tracking when used in the application.
Looking at how the HttpClient is instrumented, I can see that it shows up in App Insights like this:
HTTP: GET httpstat.us/200
Looking at the underlying item in the log, it has properties like this:
How can I control these properties when using the
.StartActivity()
method?By default, I get something that looks like this:
InProc
type to something else?name
andtarget
?data
field?Environment
.NET SDK: Version: 8.0.300 Commit: 326f6e68b2 Workload version: 8.0.300-manifests.9e3391ed MSBuild version: 17.10.4+10fbfbf2e
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.300\
.NET workloads installed: [aspire] Installation Source: VS 17.10.34916.146 Manifest Version: 8.0.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json Install Type: Msi
Host: Version: 8.0.6 Architecture: x64 Commit: 3b8b000a0e
.NET SDKs installed: 6.0.423 [C:\Program Files\dotnet\sdk] 7.0.410 [C:\Program Files\dotnet\sdk] 8.0.106 [C:\Program Files\dotnet\sdk] 8.0.300 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download