Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/add raven db health check #77

Merged
merged 12 commits into from
Feb 4, 2019

Conversation

Burgyn
Copy link
Contributor

@Burgyn Burgyn commented Jan 31, 2019

This PR adds HealthCheck for RavenDB.

I have created a new HealthChecks.RavenDB project with unit and functional tests.

Close #76

@unaizorrilla
Copy link
Collaborator

Hi @Burgyn

Can you check why build is not passed?

@Burgyn
Copy link
Contributor Author

Burgyn commented Jan 31, 2019

Hi. Of course. Actually, I fixed it. I will push new change tomorrow. I apologize.

@unaizorrilla
Copy link
Collaborator

Is ok, no worries!!

README.md Outdated
@@ -35,6 +35,7 @@ HealthChecks packages include health checks for:
- Uri: single uri and uri groups
- Consul
- Hangfire
- RavenDB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better adding RavenBD close to the other database healthchecks (mysql, oracle, sqlite, postgres)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do, Thanks.

}

[Fact]
public async Task be_healthy_if_ravendb_isnot_available()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_is_not

private readonly string _connectionString;
private readonly string _specifiedDatabase;

/// <summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have comments on HealthChecks because probably is not used directly never.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

})
{
store.Initialize();
var databases = await store.Maintenance.Server.SendAsync(new GetDatabaseNamesOperation(0, 100));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the meaning of 0, 100 parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that the server sends the first 100 existing database names. I know that if it checks the database name and has more than 100 databases it can fail. But, according to my experience, it is unlikely that it has more than 100 databases under one server.

if (!string.IsNullOrWhiteSpace(_specifiedDatabase)
&& !databases.Contains(_specifiedDatabase, StringComparer.OrdinalIgnoreCase))
{
return HealthCheckResult.Unhealthy($"RavenDB doesn't contains '{_specifiedDatabase}' database.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use Unhealthy, use HealthCheckResult(context.Registration.FailureStatus, exception: ex) to enable de developer to set the invalid state for this health check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have exception. So I return: return new HealthCheckResult( context.Registration.FailureStatus, $"RavenDB doesn't contains '{_specifiedDatabase}' database.");
I'm not sure. It's ok?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap, the idea is honored FailureStatus configuration.

@unaizorrilla unaizorrilla merged commit 814e629 into Xabaril:master Feb 4, 2019
@unaizorrilla
Copy link
Collaborator

Merged with some minor changes.

Thanks for contribute @Burgyn

@Burgyn
Copy link
Contributor Author

Burgyn commented Feb 4, 2019

You are welcome.

@Burgyn Burgyn deleted the features/addRavenDBHealthCheck branch February 4, 2019 17:43
@sungam3r sungam3r mentioned this pull request Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants