Share via

Application Insights SDK Retrieve Custom Events Data

HUGO AGUIRRE MARQUEZ 21 Reputation points
2021-09-14T21:35:26.007+00:00

Hello,
I have an event called "Search Term" and one of his properties is "search" which contains the phrase that the user typed.
I want to analyze the data in the backend and create a list of the most popular searches in the site, but I didn't find a way to retrieve the custom event data through the SDK (the only method that I saw to consume data is GetMetric).
Is there a way to do it?

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Hugo Aguirre 76 Reputation points
2021-09-28T14:07:01.323+00:00

I didn't find a way to accomplish it through SDK but I found an API where you can send queries and retrieve data.
https://dev.applicationinsights.io/reference/get-query

With the API explorer, you can build your query, is so useful
https://dev.applicationinsights.io/apiexplorer/metrics

Regards

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Monalla-MSFT 13,166 Reputation points Moderator
    2021-09-28T19:29:52.697+00:00

    @Hugo Aguirre - Thanks for reaching out and for providing the solution that worked for you.

    Here is another SDK that you can take a look at.

    A C# SDK is made available for querying an Application Insights app. It supports the full query language.

    The SDK is available via NuGet here: https://www.nuget.org/packages/Microsoft.Azure.ApplicationInsights.Query

    Additionally, you can leverage the Microsoft.Rest.ClientRuntime.Azure.Authentication package for easier authentication with AAD in lieu of providing your own implementation of ServiceClientCredentials.

    Here is the doc for your reference : CSharp-Sdk

    Hope this helps.

    If the above response helped, please feel free to "Accept as Answer" so it can be beneficial to the community.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.