Utils project consists frequently used utilities for ECSP project and provides the below functionalities to a service.
- Centralized logging.
- Health checks.
- Diagnostic data reporting.
- Application Metrics - counters, gauges and histograms.
- Getting Started
- Usage
- How to contribute
- Built with Dependencies
- Code of Conduct
- Authors
- Security Contact Information
- Support
- Troubleshooting
- License
- Announcements
To build the project in the local working directory after the project has been cloned/forked, run:
mvn clean install
from the command line interface.
- Maven
- Java 17
mvn test
utils project serves as a library for the services. It is not meant to be deployed as a service in any cloud environment.
Add the following dependency in the target project
<dependency>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>utils</artifactId>
<version>1.X.X</version>
</dependency>
To implement logging in the services, the services need to get an instance of IgniteLogger class using the IgniteLoggerFactory factory class.
Example:
private static IgniteLogger logger = IgniteLoggerFactory.getLogger(ProtocolTranslatorPreProcessor.class);The IgniteLogger is an extension of slf4j logger. All the concepts related to logging an error message, exception, stack traces, etc. alongwith the different log levels remain the same.
utils provides the services with Health Check capabilities by implementing a number of different HealthMonitor instances.
HealthService listens to the health state changes in all the HealthMonitor instances implemented by the service and maintains Gauge data for the healthy and unhealthy health monitors along with the overall health of the service for service health monitoring.
utils provides the service with Diagnostic reporting capabilities by implementing a number of DiagnosticReporter instances which in turn maintain DiagnosticData for the metrics and the corresponding DiagnosticResult.
DiagnosticService listens to all the enabled diagnostic reporters and do the reporting in Graylog besides publishing the metrics in prometheus about diagnostic data of a service.
utils provides the service with metrics - Counters, Gauge and Histogram.
Any service can extend the above metrics for reporting and monitoring purpose.
Examples:
Implementing a Counter
Custom Counter classes need to extend the abstract class AbstractIgniteCounter
public class GenericIgniteCounter extends AbstractIgniteCounter {
public GenericIgniteCounter(String name, String help, String... labels) {
createCounter(name, help, labels);
}
}Implementing a Gauge
Custom Gauge classes need to extend the abstract class AbstractIgniteGauge
public class IgniteDiagnosticGuage extends IgniteGuage {
public IgniteDiagnosticGuage() {
createGuage("diagnostic_metric", "node", "diagnostic_reporter_name", "diagnostic_reporter_sublabel");
}
}Implementing a Histogram
Custom Histogram classes need to extend the abstract class AbstractIgniteHistogram
public class GenericIgniteHistogram extends AbstractIgniteHistogram {
public GenericIgniteHistogram(String name, String help, double[] buckets, String... labelNames) {
createHistogram(name, help, buckets, labelNames);
}
}| Dependency | Purpose |
|---|---|
| Entities | The library to implement database entities |
| Spring Framework | The core spring support |
| Spring Boot | The web framework used |
| Maven | Dependency Management |
| Junit | Testing framework |
| Mockito | Test Mocking framework |
Please read CONTRIBUTING.md for details on our contribution guidelines, and the process for submitting pull requests to us.
Please read CODE_OF_CONDUCT.md for details on our code of conduct.
![]() Kaushal Arora ๐ ๐ |
See also the list of contributors who participated in this project.
Please read SECURITY.md to raise any security related issues.
Please write to us at csp@harman.com
Please read CONTRIBUTING.md for details on how to raise an issue and submit a pull request to us.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
All updates to this library are documented in our Release Notes and releases. For the versions available, see the tags on this repository.

