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 TypeMethodDescriptioncheckRepositoryPerformance
(int secondsToRun) Conducts a rudimentary repository test to gauge I/O and network performance.getFeature
(long featureId) Experimental/internal for Senzing support use.Returns overview information about the repository.void
Permanently deletes all data in the repository, except the configuration.
-
Method Details
-
getRepositoryInfo
Returns overview information about the repository.Usage:
// How to get repository info via SzDiagnostic try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // get the repository info String info = diagnostic.getRepositoryInfo(); // do something with the returned JSON log(info); } catch (SzException e) { // handle or rethrow the exception logError("Failed to get the repository info.", e); }Example Result: (formatted for readability)
{ "dataStores": [ { "id": "CORE", "type": "sqlite3", "location": "/tmp/sz-example-15163685556579634676/G2C.db" } ] }
- Returns:
- A JSON
String
describing the repository. - Throws:
SzException
- If a failure occurs.
-
checkRepositoryPerformance
Conducts a rudimentary repository test to gauge I/O and network performance.Typically, this is only run when troubleshooting performance. This is a non-destructive test.
Usage:
// How to get repository info via SzDiagnostic try { // obtain the SzEnvironment (varies by application)
SzEnvironment
env = getEnvironment(); // get the diagnostic instance SzDiagnostic diagnostic = env.getDiagnostic(); // check the repository performance String result = diagnostic.checkRepositoryPerformance(10); // do something with the returned JSON log(result); } catch (SzException e) { // handle or rethrow the exception logError("Failed to check the repository performance.", e); }Example Result: (formatted for readability)
{ "numRecordsInserted": 377067, "insertTime": 10000 }
- 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
Permanently deletes all data in the repository, except the configuration.WARNING: This method is destructive, it will delete all loaded records and entity resolution decisions. Senzing does not provide a means to the restore the data. The only means of recovery would be restoring from a database backup.
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 for Senzing support use.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 result = diagnostic.getFeature(featureId); // do something with the returned JSON log(result); } catch (SzException e) { // handle or rethrow the exception logError("Failed to purge the repository.", e); }Example Result: (formatted for readability)
{ "LIB_FEAT_ID": 6, "FTYPE_CODE": "PHONE_KEY", "ELEMENTS": [ { "FELEM_CODE": "EXPRESSION", "FELEM_VALUE": "7025551212" } ] }
- 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.
-