Too many failures when attempting to write to udp://localhost:8094, circuit is open

Too many failures when attempting to write to udp://localhost:8094, circuit is open
[{ SourceContext: “App.Metrics.Extensions.Hosting.MetricsReporterBackgroundService”,
Reporter App.Metrics.Reporting.Socket.SocketMetricsReporter FlushAsync failed

Hello @kishorekittu76,
Welcome.
Can you please provide more context?
When is this happening? What are you trying to do?

Below is the Context im using to push metrcis from client app
public class MetrcisRegistry
{
private readonly IMetricsRoot _metrcisRoot;
private readonly CounterOptions _CounterRootOptions = new CounterOptions { Name = “TotalRequests” };
public static string ContextName = “dotcore_ms_requests”;

    public static class Counters
    {
        public static readonly CounterOptions ActiveRequestCount = new CounterOptions
        {
            Context = ContextName,
            Name = "Active",
            MeasurementUnit = Unit.Custom("ActiveRequests"),
            ResetOnReporting = true
        };

        public static readonly CounterOptions TotalErrorRequestCount = new CounterOptions
        {
            Context = ContextName,
            Name = "Errors",
            ResetOnReporting = true,
            MeasurementUnit = Unit.Errors
        };

        public static readonly CounterOptions UnhandledExceptionCount = new CounterOptions
        {
            Context = ContextName,
            Name = "Exceptions",
            MeasurementUnit = Unit.Errors,
            ReportItemPercentages = false,
            ReportSetItems = false,
            ResetOnReporting = true
        };

    }
    public static class Gauges
    {
        public static readonly GaugeOptions EndpointOneMinuteErrorPercentageRate = new GaugeOptions
        {
            Context = ContextName,
            Name = "One Minute Error Percentage Rate Per Endpoint",
            MeasurementUnit = Unit.Requests
        };

        public static readonly GaugeOptions OneMinErrorPercentageRate = new GaugeOptions
        {
            Context = ContextName,
            Name = "One Minute Error Percentage Rate",
            MeasurementUnit = Unit.Requests
        };
    }

    public static class Histograms
    {
        public static readonly HistogramOptions PostRequestSizeHistogram = new HistogramOptions
        {
            Context = ContextName,
            Name = "POST Size",
            MeasurementUnit = Unit.Bytes
        };

        public static readonly HistogramOptions PutRequestSizeHistogram = new HistogramOptions
        {
            Context = ContextName,
            Name = "PUT Size",
            MeasurementUnit = Unit.Bytes
        };
        public static readonly HistogramOptions PatchRequestSizeHistogram = new HistogramOptions
        {
            Context = ContextName,
            Name = "PATCH Size",
            MeasurementUnit = Unit.Bytes
        };
    }

    public static class Meters
    {
        public static readonly MeterOptions EndpointErrorRequestPerStatusCodeRate = new MeterOptions
        {
            Context = ContextName,
            Name = "Error Rate Per Endpoint And Status Code",
            MeasurementUnit = Unit.Requests
        };

        public static readonly MeterOptions EndpointErrorRequestRate = new MeterOptions
        {
            Context = ContextName,
            Name = "Error Rate Per Endpoint",
            MeasurementUnit = Unit.Requests
        };

        public static readonly MeterOptions ErrorRequestRate = new MeterOptions
        {
            Context = ContextName,
            Name = "Error Rate",
            MeasurementUnit = Unit.Errors
        };
        public static readonly MeterOptions httpStatusMeter = new MeterOptions
        {
            Context = ContextName,
            Name = "Http Status",
            MeasurementUnit = Unit.Results
        };
        public static readonly MeterOptions userrequest = new MeterOptions
        {
            Context = ContextName,
            Name = "userrequest",
            MeasurementUnit = Unit.Requests,
            ReportSetItems=true
        };
    }

    public static class Timers
    {
        public static readonly TimerOptions EndpointRequestTransactionDuration = new TimerOptions
        {
            Context = ContextName,
            Name = "RequestEndPointTimer",
            MeasurementUnit = Unit.Calls,
            DurationUnit = TimeUnit.Milliseconds,
            RateUnit = TimeUnit.Milliseconds
        };

        public static readonly TimerOptions RequestTransactionDuration = new TimerOptions
        {
            Context = ContextName,
            Name = "RequestStartTimer",
            MeasurementUnit = Unit.Items,
            DurationUnit = TimeUnit.Milliseconds,
            RateUnit = TimeUnit.Minutes
        };
        public static readonly TimerOptions RequestTransaction = new TimerOptions
        {
            Context = ContextName,
            Name = "RequestTimer",
            MeasurementUnit = Unit.Requests,
            DurationUnit = TimeUnit.Milliseconds,
            RateUnit = TimeUnit.Minutes
        };
    }
    public static ApdexOptions SampleApdex => new ApdexOptions
    {
        Name = "dotnetcoreApdex"
    };
}

Too many failures when attempting to write to udp://localhost:8094, circuit is open
[{ SourceContext: “App.Metrics.Extensions.Hosting.MetricsReporterBackgroundService”,
Reporter App.Metrics.Reporting.Socket.SocketMetricsReporter FlushAsync failed

Hello Anaisdg thanks for your replay ,
Im are using Appmertcis library to capture and send metrics from dotnet core microservices over UDP,we are getting this exception frequently.Too many failures when attempting to write to udp://localhost:8094, circuit is open.

Could you please provide me the solution bcz im getting this exception from last 20 days.If you any information other then i have attached will provide you soon i got reply form you
Flow Description:Steps im doing
MicroService -->Adopted Appmetrcis library to capture Metrics data -->Creating Socket client connection over UDP -->Pushing data to telegraf (using karka credentials)–>From their to Influxdb

When we are working with AppMetrcis in our dotnet core micro services getting Too many failures when attempting to write to udp://localhost:8094, circuit is open: issue
Could you please help me to get rid of this exception
var metrics = new MetricsBuilder()
.Configuration.Configure(
options =>
{
options.WithGlobalTags((globalTags, info) =>
{
globalTags.Add(“app”, “RepairApp”);
globalTags.Add(“env”, “stage”);
globalTags.Add(“server”, Environment.MachineName);
});
})
.Report.ToInfluxDb(
options =>
{
options.InfluxDb.BaseUri = new Uri(“http://127.0.0.1:9087”);
options.InfluxDb.Database = “RepairAppInfluxData”;
options.InfluxDb.UserName = “System”;
options.InfluxDb.Password = “123456”;
options.SocketPolicy.BackoffPeriod = TimeSpan.FromSeconds(30);
options.SocketPolicy.FailuresBeforeBackoff = 5;
options.SocketPolicy.Timeout = TimeSpan.FromSeconds(10);
options.FlushInterval = TimeSpan.FromSeconds(5);
})
.Build();
services.AddMetrics(metrics);
services.AddMetricsReportScheduler();

Hi @kishorekittu76 , I have the same problem, any solution? Tks!!