Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Adding multiple liveness results in Exception, "More then one sequence found" #110

Open
waqaskhan540 opened this issue Apr 12, 2019 · 1 comment

Comments

@waqaskhan540
Copy link

I have multiple environments and I am trying to place health checks for all of them through single BeatPulse.UI instance, below is my startup configuration.

I have also placed a check that if only the given environment is meant to be checked for liveness then spin only the relevant services, otherwise add all the services for liveness.

I am also using 4 different appsettings.json files , one for each environment.

/health returns the valid result, but /beatpulse-api produces exception.

var showEnvironmentWise = Configuration.GetValue<bool>("showEnvironmentWise");
var environment = HostingEnvironment.EnvironmentName.ToLower();

`

        var connectionString_D = Configuration.GetConnectionString("MySql-D");
        var connectionString_Q = Configuration.GetConnectionString("MySql-Q");
        var connectionString_S = Configuration.GetConnectionString("MySql-S");
        var connectionString_P = Configuration.GetConnectionString("MySql-P");

        var rabbitMq_D = Configuration["RabbitMQ-D"];
        var rabbitMq_Q = Configuration["RabbitMQ-Q"];
        var rabbitMq_S = Configuration["RabbitMQ-S"];
        var rabbitMq_P = Configuration["RabbitMQ-P"];

        var apiHealthUrl_D = Configuration["ApiHealthUrl-D"];
        var apiHealthUrl_Q = Configuration["ApiHealthUrl-Q"];
        var apiHealthUrl_S = Configuration["ApiHealthUrl-S"];
        var apiHealthUrl_P = Configuration["ApiHealthUrl-P"];

        services.AddBeatPulse(setup =>
        {

            if (showEnvironmentWise)
            {
                setup.AddMySql(connectionString_D, name: $"storage-{environment}", defaultPath: $"storage-{environment}");
                setup.AddRabbitMQ(rabbitMq_D, name: $"queue-{environment}", defaultPath: $"queue-{environment}");
                setup.AddUrlGroup(opt =>
                {
                    opt.AddUri(new Uri(apiHealthUrl_D), uri =>
                    {
                        uri.UseGet()
                            .ExpectHttpCode(200);
                    });
                }, $"api-{environment}", $"api-{environment}");
            }
            else
            {
                setup.AddMySql(connectionString_D, name: "storage-development", defaultPath: "storage-development");
                setup.AddMySql(connectionString_Q, name: "storage-quality", defaultPath: "storage-quality");
                setup.AddMySql(connectionString_S, name: "storage-staging", defaultPath: "storage-staging");
                setup.AddMySql(connectionString_P, name: "storage-production", defaultPath: "storage-production");

                setup.AddRabbitMQ(rabbitMq_D, name: "queue-development", defaultPath: "queue-development");
                setup.AddRabbitMQ(rabbitMq_Q, name: "queue-quality", defaultPath: "queue-quality");
                setup.AddRabbitMQ(rabbitMq_S, name: "queue-staging", defaultPath: "queue-staging");
                setup.AddRabbitMQ(rabbitMq_P, name: "queue-production", defaultPath: "queue-production");

                
                setup.AddUrlGroup(opt =>
                {
                    opt.AddUri(new Uri(apiHealthUrl_D), uri =>
                    {
                        uri.UseGet()
                            .ExpectHttpCode(200);
                    });
                }, "api-development", "api-development");

                setup.AddUrlGroup(opt =>
                {
                    opt.AddUri(new Uri(apiHealthUrl_Q), uri =>
                    {
                        uri.UseGet()
                            .ExpectHttpCode(200);
                    });
                }, "api-quality", "api-quality");

                setup.AddUrlGroup(opt =>
                {
                    opt.AddUri(new Uri(apiHealthUrl_S), uri =>
                    {
                        uri.UseGet()
                            .ExpectHttpCode(200);
                    });
                }, "api-staging", "api-staging");

                setup.AddUrlGroup(opt =>
                {
                    opt.AddUri(new Uri(apiHealthUrl_P), uri =>
                    {
                        uri.UseGet()
                            .ExpectHttpCode(200);
                    });
                }, "api-production", "api-production");

            }

        });`
@waqaskhan540
Copy link
Author

turns out I was targeting the wrong appsettings.json file, after targeting the right one, I was able to fix the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant