Comments (8)
Hi @DaveLHX ,
I believe this is what you want:
using (var activity = activitySource.StartActivity("DependencyName", ActivityKind.Client))
{
activity?.SetTag("http.request.method", "GET"); // The presence of this attribute will set the dependency Type to HTTP
activity?.SetTag("url.full", "Data");
activity?.SetTag("server.address", "TargetName");
}
compared to ApplicationInsights's Dependency Telemetry:
public DependencyTelemetry(string dependencyTypeName, string target, string dependencyName, string data)
from azure-sdk-for-net.
Our migration guide was just published. We have examples of the Application Insights api and how to use the new OpenTelemetry api.
https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-dotnet-migrate?tabs=aspnetcore#dependencytelemetry
Please take a look and let us know if this helps
from azure-sdk-for-net.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas @rajkumar-rangaraj @reyang @TimothyMothra @vishweshbankwar.
from azure-sdk-for-net.
Hi @DaveLHX, can you please share a minimal reproducible example using the Application Insights SDK showing what you're trying to accomplish?
We're in the process of writing a migration guide and we would like to fully understand your scenario.
from azure-sdk-for-net.
Hi @DaveLHX, can you please share a minimal reproducible example using the Application Insights SDK showing what you're trying to accomplish?
We're in the process of writing a migration guide and we would like to fully understand your scenario.
This is how it would look. When creating a new DependencyTelemetry the second parameter (target) is what allows me to do what I need. In the open telemetry version I have no control over the target it always ends up the the same as the DependencyName, We need to create multiple dependencies like, MSGraphAPI, ActiveDirectoryOnPrem, ExchangeOnline, App1Api, etc... and have all their calls under them.
edit: also if we create of type "InProc" the dependency works well for internal operations we want to monitor but not as external depencency.
public IList<string> GetGroupNames(string userPrincipalName)
{
var queryParam = new GraphGroupRequestBuilder.GraphGroupRequestBuilderGetQueryParameters();
queryParam.Select = new[] { "DisplayName" };
queryParam.Top = 200;
DependencyTelemetry dependencyTelemetry =
new DependencyTelemetry("HTTP", "MSGraphAPI", "GetAllGroupsForUser",
"UserPrincipalName: {userPrincipalName}");
TelemetryClient telemetryClient = new TelemetryClient();
using (telemetryClient.StartOperation(dependencyTelemetry))
{
List<Group> groups = Task.Run(async () => await m_GraphServiceClient
.Users[userPrincipalName].TransitiveMemberOf.GraphGroup.GetAsync(o =>
{
o.QueryParameters = queryParam;
o.Options.WithAppOnly();
})).Result.Value;
IList<string> groupList = groups.Select(o => o.DisplayName).ToList();
return groupList;
}
}
From the SDK: public DependencyTelemetry(string dependencyTypeName, string target, string dependencyName, string data)
Working with multipleCustomDepenencies
new DependencyTelemetry("HTTP", "MSGraphAPI", "GetUser", "UserPrincipalName: {userPrincipalName}");
new DependencyTelemetry("HTTP", "MSGraphAPI", "GetAllGroupsForUser", "UserPrincipalName: {userPrincipalName}");
and so on...
new DependencyTelemetry("HTTP", "EXO", "GetMail", "UserPrincipalName: {userPrincipalName}");
new DependencyTelemetry("HTTP", "EXO", "SearchSharedMailbox", "SearchString: {searchString}");
new DependencyTelemetry("ActiveDirectory", "AD", "GetUser", "UserPrincipalName: {userPrincipalName}");
from azure-sdk-for-net.
Hi @DaveLHX ,
I believe this is what you want:
using (var activity = activitySource.StartActivity("DependencyName", ActivityKind.Client)) { activity?.SetTag("http.request.method", "GET"); // The presence of this attribute will set the dependency Type to HTTP activity?.SetTag("url.full", "Data"); activity?.SetTag("server.address", "TargetName"); }compared to ApplicationInsights's Dependency Telemetry:
public DependencyTelemetry(string dependencyTypeName, string target, string dependencyName, string data)
Sorry for the late response, Yes this seems to do the trick thank you.
I do have to set both of the following for it to work. If I dont put the http.request.method it ignores the TargetName
activity?.SetTag("http.request.method", "GET");
activity?.SetTag("server.address", "TargetName");
Is there a list of the possible tags somewhere ? Did you get that from looking in the insights repo/code?
from azure-sdk-for-net.
Our migration guide was just published. We have examples of the Application Insights api and how to use the new OpenTelemetry api. https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-dotnet-migrate?tabs=aspnetcore#dependencytelemetry
Please take a look and let us know if this helps
Yes this seems like it would have helped quite a bit thanks.
from azure-sdk-for-net.
Is there a list of the possible tags somewhere? Did you get that from looking in the insights repo/code?
Right now I'm pulling the info from the code. We're currently exploring how to communicate the full list of available tags. Until then, please feel free to ask about specific fields here. We use the feedback here to prioritize our backlog.
from azure-sdk-for-net.
Related Issues (20)
- SCM: Add APIs to ClientPipelineOptions to make it easier to use with freezing pattern
- Protection for dependency "VersionOverride" use in project files
- [Functions] Logging sanitization for common configuration mistake
- [Event Hubs] Explore loosening consumer contract for events
- Facebook HOT 1
- [FEATURE REQ] Support for extending app insights Dependency.Type values HOT 3
- [BUG] BlobContainerClient.ExistsAsync throws exception after upgrading 12.20.0 => 12.21.0 HOT 3
- SCM: .NET API Review Board feedback on paging APIs
- Re-enable KubectlExecuteIdentityAKSTests once we have az CLI federated login working in the pipeline HOT 1
- .Net Runtime crashes with Azure.Messaging.ServiceBus 7.17.5 HOT 5
- [QUERY] Document Permanent Delete Blob behavior using SDK HOT 3
- Support PoP token binding via Signed HTTP Request (SHR) for public client apps
- [BUG] StreamingChatCompletionUpdate.FinishReason is always null. HOT 2
- [FEATURE REQ] SignalR Scaleout with Azure Service Bus HOT 4
- System.ObjectDisposedException at Azure.Messaging.ServiceBus.ServiceBusReceiver HOT 4
- [QUERY][OpenTelemetry & Azure Monitor] Filtering Http requests HOT 1
- Azure.Search.Documents.IndexesRestClient.CreateOrUpdateAsync throws error Content: {"error":{"code":"","message":"The request is invalid. Details: definition : Error in Vectorizer 'myOpenAIVectorizer' : 'modelName' parameter is required in API version '2024-07-01'."}} HOT 1
- Is it possible to limit or control the exception message logs when service bus queue is disabled? HOT 5
- [QUERY] Logic App Standard - List Workflow Run Actions HOT 1
- [BUG] CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-net.