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

Add tag for health check #707

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,19 @@ public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context
try
{
HealthCheckResult result = await m_wrappedHealthCheck.CheckHealthAsync(context, cancellationToken);

try
{
activity?.SetTag("HealthCheckResult", result.Status.ToString());
}
catch (Exception ex) {
m_logger.LogError(Tag.Create(), ex, "'{0}' health check tag addition failed", context.Registration.Name);
}

activity?.MarkAsSuccess();

// The health status for the health check result: if the status is healthy, it will be returned as it is,
// if not then then registration failure status will be sent in its place.
// if not then registration failure status will be sent in its place.
HealthStatus healthCheckStatus = result.Status == HealthStatus.Healthy
? result.Status
: context.Registration.FailureStatus;
Expand Down
Loading