Skip to content

UseAdaptiveSampling is not working for .net 4.6.2 #2960

Open
@thegodofjason

Description

@thegodofjason

Hi
Following the document
https://learn.microsoft.com/en-us/azure/azure-monitor/app/sampling-classic-api#alternative-configure-adaptive-sampling-in-code

Created a .net 4.6.2 console project
Image

And tested adaptive sampling with config is working fine

Image

Image

But when followed the document to use UseAdaptiveSampling, its not working anymore

Image

Image

Already disabled the config

Image

And all of my code is in the below

using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
namespace AppInsightsTest
{
    class Program
    {
        static void Main(string[] args)
        {
            TelemetryConfiguration config = TelemetryConfiguration.CreateDefault();
            config.ConnectionString = "XXX";
            var telemetryClient = new TelemetryClient(config);

            Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder builder = TelemetryConfiguration.Active.DefaultTelemetrySink.TelemetryProcessorChainBuilder;
            builder.UseAdaptiveSampling(maxTelemetryItemsPerSecond: 1);
            builder.Build();

            while(true)
            {
                telemetryClient.TrackTrace("test2");
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions