Skip to content

Latest commit

 

History

History
221 lines (153 loc) · 8.93 KB

README.md

File metadata and controls

221 lines (153 loc) · 8.93 KB

New Relic Open Source experimental project banner.

GitHub forks GitHub stars GitHub watchers

GitHub all releases GitHub release (latest by date) GitHub last commit GitHub Release Date

GitHub issues GitHub issues closed GitHub pull requests GitHub pull requests closed

New Relic Java Instrumentation for Resilience4

The following Resilience4j components are instrumented:

  • CircuitBreaker
  • Bulkhead
  • RateLimiter
  • Retry
  • TimeLimiter

Installation

To install:

  1. Download the latest release jar files.
  2. In the New Relic Java directory (the one containing newrelic.jar), create a directory named extensions if it does not already exist.
  3. Copy the downloaded jars into the extensions directory.
  4. Restart the application.

Resilience4j Metrics Collection

This module also collects and reports metrics from Resilience4j components (Circuit Breaker, Bulkhead, ThreadPool Bulkhead, Rate Limiter, and Retry) using New Relic Agent APIs. The metrics are periodically collected and sent to New Relic Insights as custom events.

Configuration

To enable (default: true) /disable specific metrics collection and set the polling interval ( default: 1 minute ) , update the newrelic.yml configuration file with the following parameters:

Resilience4j:
  metrics:
    # Circuit Breaker Metrics
    circuitbreaker:
      enabled: true
      intervalminutes: 5

    # Bulkhead Metrics
    bulkhead:
      enabled: true
      intervalminutes: 5

    # ThreadPool Bulkhead Metrics
    threadpoolbulkhead:
      enabled: true
      intervalminutes: 5

    # Rate Limiter Metrics
    ratelimiter:
      enabled: true
      intervalminutes: 5

    # Retry Metrics
    retry:
      enabled: true
      intervalminutes: 5

These settings should be added to your newrelic.yml configuration file. This configuration enables metrics collection for each Resilience4j component and sets the polling interval to 5 minutes. Adjust the intervalminutes value as needed to set a different polling interval.

Usage

Enable Metrics Collection: Set the appropriate flags in the newrelic.yml file to enable metrics collection for the desired Resilience4j components.

Set Polling Interval: Configure the polling interval (in minutes) for each component's metrics collection.

Run the Application: Start your application. The metrics will be collected at the specified intervals and sent to New Relic Insights as custom events.

Monitor Metrics in New Relic: Log in to your New Relic account and navigate to the Insights section to view the custom events for the metrics collected.

This setup helps you monitor the performance and reliability of your Resilience4j components in real-time using New Relic's powerful monitoring and alerting capabilities.

Custom Event Tables in New Relic Platform

The metrics collected from each Resilience4j pattern are reported as custom events to New Relic Insights. Below are the custom event tables where you can find the reported metrics:

CircuitBreakerMetrics

  • Custom Event Table Name: CircuitBreakerMetrics
  • Metrics:
    • Name
    • FailureRate
    • BufferedCalls
    • Failed
    • NotPermittedCalls
    • SlowCalls
    • SuccessfulCalls
    • SlowCallRate
    • SlowFailedCalls
    • SlowSuccessfulCalls

BulkheadMetrics

  • Custom Event Table Name: BulkheadMetrics
  • Metrics:
    • Name
    • AvailableConcurrentCalls
    • MaxAllowedConcurrentCalls

ThreadPoolBulkheadMetrics

  • Custom Event Table Name: ThreadPoolBulkheadMetrics
  • Metrics:
    • Name
    • CoreThreadPoolSize
    • ThreadPoolSize
    • MaximumThreadPoolSize
    • QueueDepth
    • RemainingQueueCapacity
    • QueueCapacity

RetryMetrics

  • Custom Event Table Name: RetryMetrics
  • Metrics:
    • Name
    • NumberOfSuccessfulCallsWithoutRetryAttempt
    • NumberOfFailedCallsWithoutRetryAttempt
    • NumberOfSuccessfulCallsWithRetryAttempt
    • NumberOfFailedCallsWithRetryAttempt

RateLimiterMetrics

  • Custom Event Table Name: RateLimiterMetrics
  • Metrics:
    • Name
    • AvailablePermissions
    • NumberOfWaitingThreads

Accessing Custom Events in New Relic Insights

  1. Log in to New Relic: Access your New Relic account.

  2. Query Custom Events: Use the following NRQL (New Relic Query Language) queries to access the custom events:

    • ThreadPoolBulkheadMetrics:

      SELECT * FROM ThreadPoolBulkheadMetrics
    • RetryMetrics:

      SELECT * FROM RetryMetrics
    • CircuitBreakerMetrics:

      SELECT * FROM CircuitBreakerMetrics
    • RateLimiterMetrics:

      SELECT * FROM RateLimiterMetrics
    • BulkheadMetrics:

      SELECT * FROM BulkheadMetrics

These queries will display the custom events along with the collected metrics, allowing you to monitor and analyze the performance and reliability of your Resilience4j components in real-time.

Getting Started

Once installed, the instrumentation will track transactions through the Resilience4j components.

Building

Building the extension requires that Gradle is installed. To build the extension jars from source, follow these steps:

Build single extension

To build a single extension with name extension, do the following:

  1. Set an environment variable NEW_RELIC_EXTENSIONS_DIR and set its value to the directory where you want the jar file built.
  2. Run the command: ./gradlew extension:clean extension:install

Build all extensions

To build all extensions, do the following:

  1. Set an environment variable NEW_RELIC_EXTENSIONS_DIR and set its value to the directory where you want the jar file built.
  2. Run the command: ./gradlew clean install

Support

New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub.

We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.

Contributing

We encourage your contributions to improve [Project Name]! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

License

New Relic Java Instrumentation for resilience4 is licensed under the Apache 2.0 License.

[If applicable: [Project Name] also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.]