locked
Using WindowsAzure.Storage SDK - 404 and 409 are polluting Azure Application Insight RRS feed

  • Question

  • Vi are using methods in the WindowsAzure.Storage SDK and they are working well.

    However, when we look at the Azure Application Insight log, it is filled up with 404 and 409 Http-status-codes.

    The following result in a "409 - Conflict":

    CloudBlobContainer container = client.GetContainerReference("my-container");
    container.CreateIfNotExists(BlobContainerPublicAccessType.Off);
    

    The following will result in a "404 - Not Found":

    CloudBlockBlob blob = container.GetBlockBlobReference("my-key");
    if (!blob.Exists())
    {
       // Do something
    }
    
    

    Note: The code works as expected, but under the hood (internally in the SDK library) there happens some 404 and 409, and they show up (a lot) in Azure Application Insight.

    Are there ways to avoid to get the 404 and 409 errors internally?

    Maybe use some more low level code to check existence some other way.


    Vilhelm Heiberg - ExorLive AS - Norway

    Wednesday, November 29, 2017 9:47 AM

Answers

  • Hello Vilhelm,

    I'm not aware of lower-level API that won't result in 404 or 409 for the aforementioned checks.

    However, from Application Insights perspective you may be able to filter corresponding telemetry items out before they are sent to AI Endpoint. You may leverage so-called Telemetry Processor and drop those items based on the certain fields values, e.g. the example mentioned in the linked doc filters our successful dependencies:

    using Microsoft.ApplicationInsights.Channel;
    using Microsoft.ApplicationInsights.Extensibility;
    
    public class SuccessfulDependencyFilter : ITelemetryProcessor
      {
    
        private ITelemetryProcessor Next { get; set; }
    
        // You can pass values from .config
        public string MyParamFromConfigFile { get; set; }
    
        // Link processors to each other in a chain.
        public SuccessfulDependencyFilter(ITelemetryProcessor next)
        {
            this.Next = next;
        }
        public void Process(ITelemetry item)
        {
            // To filter out an item, just return
            if (!OKtoSend(item)) { return; }
            // Modify the item if required
            ModifyItem(item);
    
            this.Next.Process(item);
        }
    
        // Example: replace with your own criteria.
        private bool OKtoSend (ITelemetry item)
        {
            var dependency = item as DependencyTelemetry;
            if (dependency == null) return true;
    
            return dependency.Success != true;
        }
    
        // Example: replace with your own modifiers.
        private void ModifyItem (ITelemetry item)
        {
            item.Context.Properties.Add("app-version", "1." + MyParamFromConfigFile);
        }
    }

    Then, you'll need to add this Processor into AI.config:

        <TelemetryProcessors>
          <Add Type="ApplicationNamespace.SuccessfulDependencyFilter, ApplicationAssembly">
          </Add>
        </TelemetryProcessors>


    Dmitry Matveev

    • Marked as answer by Vilhelm Hei Monday, January 29, 2018 10:14 AM
    Saturday, January 27, 2018 12:07 AM