ArieGato / serilog-sinks-rabbitmq

Serilog Sink for RabbitMq
Apache License 2.0
53 stars 51 forks source link

Channel usage growth #103

Closed stephenyeong closed 6 months ago

stephenyeong commented 4 years ago

Describe the bug Compare with 3.0.3, 3.0.6 open too much RabbitMQ channel without close

To Reproduce In my case, When using Serilog.Sinks.RabbitMQ 3.0.3 only 1 channel on service startup. When using Serilog.Sinks.RabbitMQ 3.0.6 with 14 channels on service startup, and channel usage growth when rabbitmq connection not stable. Channel usage from 44 growth to 50 after RabbitMQ node failover.

Screenshot 2020-01-21 at 8 15 57 AM

Operating System and Software (please complete the following information):

madslyng commented 4 years ago

@stephenyeong To debug and possibly reproduce this, I will need some code that shows how you are initializing and using serilog -sinks-rabbitmq

stephenyeong commented 4 years ago

@steffenlyng I store config in application.json and init serilog as below

application.json

  "SerilogSinkRabbitMQ": {
    "Hostnames": [ "192.168.4.129", "192.168.4.130" ],
    "Username": "logger",
    "Password": "**********",
    "VHost": "logging",
    "Exchange": "serilog-sink-exchange",
    "ExchangeType": "topic",
    "DeliveryMode": "Durable",
    "RouteKey": "OAS",
    "Port": 5672
  },

Program.cs

 var cfg = new ConfigurationBuilder()
             .SetBasePath(dllpath)
             .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).Build();

            ApplicationSetting mysetting = cfg.GetSection("Application").Get<ApplicationSetting>();
            RabbitMQClientConfiguration setting = cfg.GetSection("SerilogSinkRabbitMQ").Get<RabbitMQClientConfiguration>();

            Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(cfg)
              .Enrich.WithMachineName()
              .Enrich.FromLogContext()
              .Enrich.WithProperty("Instance", mysetting.Instance)
              .WriteTo.RabbitMQ((clientConfiguration, sinkConfiguration) =>
              {
                  clientConfiguration.From(setting);
                  sinkConfiguration.TextFormatter = new Serilog.Formatting.Compact.CompactJsonFormatter();
                  sinkConfiguration.Period = TimeSpan.FromMilliseconds(500);
              })
              .CreateLogger();
tzographos commented 3 years ago

Hello, is there any update on this?

sungam3r commented 6 months ago

@ArieGato I suggest to close this one as too old and due to lack of feedback.

ArieGato commented 6 months ago

I completly rewrote handling connections. I’m pretty sure this issue is fixed.