Giter Club home page Giter Club logo

Comments (8)

TimothyMothra avatar TimothyMothra commented on August 16, 2024 1

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.

TimothyMothra avatar TimothyMothra commented on August 16, 2024 1

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.

github-actions avatar github-actions commented on August 16, 2024

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.

TimothyMothra avatar TimothyMothra commented on August 16, 2024

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.

DaveLHX avatar DaveLHX commented on August 16, 2024

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}");
image
new DependencyTelemetry("HTTP", "MSGraphAPI", "GetAllGroupsForUser", "UserPrincipalName: {userPrincipalName}");
image

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.

DaveLHX avatar DaveLHX commented on August 16, 2024

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.

DaveLHX avatar DaveLHX commented on August 16, 2024

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.

TimothyMothra avatar TimothyMothra commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.