ApplicationInsightDataClient GetCustomEventWithHttpMessageAsync not loading custom dimension RRS feed

  • Question

  • am using Microsoft.Azure.ApplicationInsights 0.9.0 -preview version to get custom events from application insight

        public async Task<ApplicationInsightsFooDto[]> Foo(TimeSpan timeSpan)
            var activeDirectoryServiceSettings = new ActiveDirectoryServiceSettings
                AuthenticationEndpoint = new Uri("https://login.microsoftonline.com"),
                TokenAudience = new Uri("https://api.applicationinsights.io/"),
                ValidateAuthority = true
            ServiceClientCredentials serviceCredentials = ApplicationTokenProvider.LoginSilentAsync(
                domain: ApplicationInsightConstants.DirectoryId,
                clientId: ApplicationInsightConstants.ClientId,
                secret: ApplicationInsightConstants.ClientSecret,
                settings: activeDirectoryServiceSettings
            var applicationInsightsDataClient = new ApplicationInsightsDataClient(serviceCredentials)
                AppId = ApplicationInsightConstants.AppId,
            applicationInsightsDataClient.HttpClient.DefaultRequestHeaders.Add("X-Api-Key", "<myApiKey>");
            var myEvents = await applicationInsightsDataClient.GetCustomEventsWithHttpMessagesAsync(search: "LoginEvent", timespan: timeSpan);
            return new ApplicationInsightsFooDto[] { };

    The response current does not include CustomDimension as shown in image below:

    However if I directly make an api call I get customDimensions

    Example request:

    GET https://api.applicationinsights.io/v1/apps/<myAppId>/events/customEvents?$search=LoginEvent&timespan=PT1H HTTP/1.1
    User-Agent: Fiddler
    X-Api-Key: <myApiKey>

    Example response:

    "@ai.messages":[{"code":"AddedLimitToQuery","message":"The query was limited to 500 rows"}],"value": 
    "customDimensions":{"AspNetCoreEnvironment":"Development","DeveloperMode":"true","UserId":"...","...":"...","UserName":"Xyz","...":"...","Company":"N/A"},"customMeasurements":null,"operation":{"name":"POST Account/Login","id":"someData","p","syntheticSource":""},...}}]}

    Any idea how I can fetch customDimension using C# sdk rather than building custom url and then making a request?

    Monday, November 18, 2019 4:57 PM

All replies

  • Hi Biplov,

    I was able to reproduce your issue and it looks like the custom dimensions are being returned from the API but aren't loading into the EventResult object. I've reached out to the product team as a possible bug. I will keep updated once I hear back.

    Friday, November 22, 2019 5:38 PM
  • Biplov,

    I wanted to update you on the status. I've discussed the bug with the product team but I do not yet have any ETA for a fix. If you need a quick resolution I would recommend calling the API directly.

    Tuesday, November 26, 2019 8:49 PM