[
https://issues.apache.org/jira/browse/FELIX-6292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17150880#comment-17150880
]
Amit Mondal commented on FELIX-6292:
------------------------------------
[~henzlerg] I just had a look into the _*HealthCheckMinitor*_ and it looks
promising. I think it would surely work in my scenario but with a slight
modification.
The use case is as follows:
# Consumer needs to report errors/warnings to the monitoring system
# Consumer introduces several custom health checks having different tags
# Every health check has been configured to be executed in different intervals
(every 6 hours, every day, every hour etc.) or using crons
# After any health check gets executed, a dedicated component reports the
health check results to the monitoring system if the health check result
comprises any warning or error message.
Earlier I thought of an interface similar to the following (I also used it
temporarily in my local codebase to test)
{code:java}
/**
* The {@link HealthCheckPostExecutionListener} interface allows consumers to
provide
* custom functionality to process health check execution result.
*
* <p>
* Any bundle wishing to provide custom post processing functionality needs to
create
* a service object that implements this interface and then register it with
the OSGi
* framework.
* </p>
*
* @since 1.0
*/
@ConsumerType
@FunctionalInterface
public interface HealthCheckPostExecutionListener {
/**
* This method is called when after health check execution result is
prepared.
*
* @param executionResult the execution result of the health check.
*/
void onProcessed(HealthCheckExecutionResult executionResult);
}
{code}
Since it is an SPI interface, a consumer can provide the custom implementation
which gets hooked into the _*HealthCheckFuture*_ and executed as soon as any
health check is processed.
This is just a temporary solution I worked on for the time being. I really
liked your solution since consumers can definitely perform more stuffs with the
newly introduced _*Healthy*_ and _*Unhealthy*_ service instances.
To realize my use case, I do require to track all _*Unhealthy*_ service
instances dynamically and report the status to the configured monitoring
system. But according to the current solution, _*Healthy*_ and _*Unhealthy*_
interfaces are just marker interfaces and hence they don't comprise any
abstract method. I believe, it would be more beneficial to introduce such a
method in these consumer interfaces.
{code:java}
HealthCheckExecutionResult getHealthCheckExecutionResult(){code}
This would enable me to retrieve the results of the _*Healthy*_ or
_*Unhealthy*_ health checks and perform custom operations.
Please let me know what you think about it.
> Introduce functionality to perform custom operation after a heath check is
> executed
> -----------------------------------------------------------------------------------
>
> Key: FELIX-6292
> URL: https://issues.apache.org/jira/browse/FELIX-6292
> Project: Felix
> Issue Type: New Feature
> Components: Health Checks
> Reporter: Amit Mondal
> Priority: Minor
> Labels: ready-to-commit
>
> Sometimes consumers need to perform custom operations after a health check
> gets executed. For example, one might need to send the health check result to
> online monitoring system such as Kibana, Grafana etc. That's why we need to
> introduce an extension point for consumers to extend the current
> functionality.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)