Package com.senzing.sdk
Interface SzDiagnostic
public interface SzDiagnostic
Defines the Java interface to the Senzing diagnostic functions. The Senzing diagnostic functions provide diagnostics and statistics pertaining to the host system and the Senzing repository.
An SzDiagnostic
instance is typically obtained from an
SzEnvironment
instance via the SzEnvironment.getDiagnostic()
method as follows:
// How to obtain an SzDiagnostic instance
try {
// obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment();
SzDiagnostic diagnostic = env.getDiagnostic();
...
} catch (SzException e) {
// handle or rethrow the exception
logError("Failed to get SzDiagnostic.", e);
}
-
Method Summary
Modifier and TypeMethodDescriptioncheckDatastorePerformance
(int secondsToRun) Runs non-destruction DB performance tests and returns detail of the result as a JSONString
.Gathers detailed information on the data store and returns it as a JSONString
.getFeature
(long featureId) Experimental/internal method for obtaining diagnostic feature definition for the specified feature identifier.void
Purges all data in the configured repository.
-
Method Details
-
getDatastoreInfo
Gathers detailed information on the data store and returns it as a JSONString
.Usage:
// How to get datastore info via SzDiagnostic try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // get the datastore info String datastoreJson = diagnostic.getDatastoreInfo(); // do something with the returned JSON log(datastoreJson); } catch (SzException e) { // handle or rethrow the exception logError("Failed to get the datastore info.", e); }- Returns:
- A JSON
String
describing the datastore. - Throws:
SzException
- If a failure occurs.
-
checkDatastorePerformance
Runs non-destruction DB performance tests and returns detail of the result as a JSONString
.Usage:
// How to get datastore info via SzDiagnostic try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // check the datastore performance String performanceJson = diagnostic.checkDatastorePerformance(10); // do something with the returned JSON log(performanceJson); } catch (SzException e) { // handle or rethrow the exception logError("Failed to check the datastore performance.", e); }- Parameters:
secondsToRun
- How long to run the database performance test.- Returns:
- The JSON
String
describing the results of the performance test. - Throws:
SzException
- If a failure occurs.
-
purgeRepository
Purges all data in the configured repository.WARNING: There is no undoing from this. Make sure your repository is regularly backed up.
Usage:
// How to purge the Senzing repository try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // purge the repository (MAKE SURE YOU WANT TO DO THIS) if (confirmPurge()) { diagnostic.purgeRepository(); } } catch (SzException e) { // handle or rethrow the exception logError("Failed to purge the repository.", e); }- Throws:
SzException
- If a failure occurs.- See Also:
-
getFeature
Experimental/internal method for obtaining diagnostic feature definition for the specified feature identifier.Usage:
// How to get a feature by its feature ID try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // get a valid feature (varies by application) long featureId = getFeatureId(); // get the feature for the feature ID String featureJson = diagnostic.getFeature(featureId); // do something with the returned JSON log(featureJson); } catch (SzException e) { // handle or rethrow the exception logError("Failed to purge the repository.", e); }- Parameters:
featureId
- The identifier for the feature.- Returns:
- The feature definition describing the feature for the specified feature ID.
- Throws:
SzException
- If a failure occurs.
-