Skip to content

eclipse-ecsp/utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

57 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Utils

Utils project consists frequently used utilities for ECSP project and provides the below functionalities to a service. Build And Sonar scan License Compliance Deployment

  1. Centralized logging.
  2. Health checks.
  3. Diagnostic data reporting.
  4. Application Metrics - counters, gauges and histograms.

Table of Contents

Getting Started

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.

Prerequisites

  1. Maven
  2. Java 17

Installation

How to set up maven

Install Java

Running the tests

mvn test

Deployment

utils project serves as a library for the services. It is not meant to be deployed as a service in any cloud environment.

Usage

Add the following dependency in the target project

<dependency>
  <groupId>org.eclipse.ecsp</groupId>
  <artifactId>utils</artifactId>
  <version>1.X.X</version>
</dependency>

Logging

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.

Health Check

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.

Diagnostic Reporting

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.

Implementing metrics

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);
    }
}

Built With Dependencies

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

How to contribute

Please read CONTRIBUTING.md for details on our contribution guidelines, and the process for submitting pull requests to us.

Code of Conduct

Please read CODE_OF_CONDUCT.md for details on our code of conduct.

Authors

Kaushal Arora
Kaushal Arora

๐Ÿ“– ๐Ÿ‘€

See also the list of contributors who participated in this project.

Security Contact Information

Please read SECURITY.md to raise any security related issues.

Support

Please write to us at csp@harman.com

Troubleshooting

Please read CONTRIBUTING.md for details on how to raise an issue and submit a pull request to us.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Announcements

All updates to this library are documented in our Release Notes and releases. For the versions available, see the tags on this repository.

About

ECSP utils

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages