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 new health check for improper behavior #3818

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

LTA-Thinking
Copy link
Collaborator

Description

Add new health check for improper behavior.

Related issues

Addresses Bug 119273: Sort tests failing in Cosmos DB

Testing

Describe how this change was tested.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch

@LTA-Thinking LTA-Thinking requested a review from a team as a code owner April 18, 2024 18:25
@LTA-Thinking LTA-Thinking added Bug Bug bug bug. Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR labels Apr 18, 2024
@LTA-Thinking LTA-Thinking modified the milestones: S138, S139 Apr 18, 2024
}

public async Task Handle(StorageInitializedNotification notification, CancellationToken cancellationToken)
{
_logger.LogInformation("SearchParameterDefinitionManager: Storage initialized");
await EnsureInitializedAsync(cancellationToken);
try
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we try adding a retry logic?
Maybe a 3 times retry, otherwise set it as unhealthy?

fhibf
fhibf previously approved these changes Apr 19, 2024
Comment on lines +96 to +99
catch
{
_initialized = false;
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
Comment on lines +254 to +258
catch (Exception ex)
{
_logger.LogError(ex, $"Error calculating search parameter hash. Retry {retry}");
retry++;
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
Comment on lines +275 to +279
catch (Exception ex)
{
_logger.LogError(ex, $"Error initializing search parameters. Retry {retry}");
retry++;
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
private readonly IMediator _mediator = Substitute.For<IMediator>();
private readonly RequestContextAccessor<IFhirRequestContext> _fhirRequestContextAccessor = Substitute.For<RequestContextAccessor<IFhirRequestContext>>();
private readonly SqlQueueClient _sqlQueueClient;
private int _maximumSupportedSchemaVersion;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_maximumSupportedSchemaVersion' can be 'readonly'.
private readonly RequestContextAccessor<IFhirRequestContext> _fhirRequestContextAccessor = Substitute.For<RequestContextAccessor<IFhirRequestContext>>();
private readonly SqlQueueClient _sqlQueueClient;
private int _maximumSupportedSchemaVersion;
private string _databaseName;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_databaseName' can be 'readonly'.
private SearchParameterDefinitionManager _searchParameterDefinitionManager;
private SupportedSearchParameterDefinitionManager _supportedSearchParameterDefinitionManager;
private SearchParameterStatusManager _searchParameterStatusManager;
private IMediator _mediator = Substitute.For<IMediator>();

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_mediator' can be 'readonly'.
private SupportedSearchParameterDefinitionManager _supportedSearchParameterDefinitionManager;
private SearchParameterStatusManager _searchParameterStatusManager;
private IMediator _mediator = Substitute.For<IMediator>();
private RequestContextAccessor<IFhirRequestContext> _fhirRequestContextAccessor = Substitute.For<RequestContextAccessor<IFhirRequestContext>>();

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_fhirRequestContextAccessor' can be 'readonly'.
private IMediator _mediator = Substitute.For<IMediator>();
private RequestContextAccessor<IFhirRequestContext> _fhirRequestContextAccessor = Substitute.For<RequestContextAccessor<IFhirRequestContext>>();
private SqlQueueClient _sqlQueueClient;
private string _initialConnectionString;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_initialConnectionString' can be 'readonly'.
private RequestContextAccessor<IFhirRequestContext> _fhirRequestContextAccessor = Substitute.For<RequestContextAccessor<IFhirRequestContext>>();
private SqlQueueClient _sqlQueueClient;
private string _initialConnectionString;
private IOptions<CoreFeatureConfiguration> _options;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note test

Field '_options' can be 'readonly'.

namespace Microsoft.Health.Fhir.Core.Exceptions
{
public class InitializationException : Exception
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this inherit from FhirException?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so because it isn't related to FHIR, it is related to the server startup.

@LTA-Thinking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@LTA-Thinking LTA-Thinking merged commit 6e4612e into main Apr 25, 2024
43 checks passed
@LTA-Thinking LTA-Thinking deleted the personal/rojo/fix-search-parameter-initialization branch April 25, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Bug Bug bug bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants