Search in sources :

Example 6 with MonitoringDataCollector

use of fish.payara.monitoring.collect.MonitoringDataCollector in project Payara by payara.

the class FaultToleranceServiceImpl method collect.

@Override
@MonitoringData(ns = "ft")
public void collect(MonitoringDataCollector collector) {
    for (Entry<MethodKey, FaultToleranceMethodContextImpl> methodEntry : contextByMethod.entrySet()) {
        MonitoringDataCollector methodCollector = collector.group(methodEntry.getKey().getMethodId()).tag("app", methodEntry.getValue().getAppName());
        FaultToleranceMethodContext context = methodEntry.getValue();
        BlockingQueue<Thread> concurrentExecutions = context.getConcurrentExecutions();
        if (concurrentExecutions != null) {
            collectBulkheadSemaphores(methodCollector, concurrentExecutions);
            collectBulkheadSemaphores(methodCollector, concurrentExecutions, context.getQueuingOrRunningPopulation());
        }
        collectCircuitBreakerState(methodCollector, context.getState());
    }
}
Also used : MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) MonitoringData(fish.payara.monitoring.collect.MonitoringData)

Example 7 with MonitoringDataCollector

use of fish.payara.monitoring.collect.MonitoringDataCollector in project Payara by payara.

the class EventBus method collect.

@Override
public void collect(MonitoringDataCollector rootCollector) {
    MonitoringDataCollector eventCollector = rootCollector.in("topic");
    if (hzCore.isEnabled()) {
        HazelcastInstance hz = hzCore.getInstance();
        for (DistributedObject obj : hz.getDistributedObjects()) {
            if (TopicService.SERVICE_NAME.equals(obj.getServiceName())) {
                LocalTopicStats stats = hz.getTopic(obj.getName()).getLocalTopicStats();
                eventCollector.group(obj.getName()).collect("PublishedCount", stats.getPublishOperationCount()).collect("ReceiveedCount", stats.getReceiveOperationCount());
            }
        }
    }
}
Also used : MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) DistributedObject(com.hazelcast.core.DistributedObject) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LocalTopicStats(com.hazelcast.topic.LocalTopicStats)

Example 8 with MonitoringDataCollector

use of fish.payara.monitoring.collect.MonitoringDataCollector in project Payara by payara.

the class JVMStatsProviderBootstrap method collect.

@Override
public void collect(MonitoringDataCollector collector) {
    MonitoringDataCollector jvm = collector.in("jvm");
    jvm.collectObject(sRuntimeStatsProvider, MonitoringDataCollection::collectObject).collectObject(clStatsProvider, MonitoringDataCollection::collectObject).collectObject(compileStatsProvider, MonitoringDataCollection::collectObject).collectObject(memoryStatsProvider, MonitoringDataCollection::collectObject).collectObject(osStatsProvider, MonitoringDataCollection::collectObject).collectObject(runtimeStatsProvider, MonitoringDataCollection::collectObject).collectObject(threadSysStatsProvider, MonitoringDataCollection::collectObject);
    for (JVMGCStatsProvider gc : jvmStatsProviderList) {
        jvm.group(gc.getGcName()).collectObject(gc, MonitoringDataCollection::collectObject);
    }
}
Also used : MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) MonitoringDataCollection(fish.payara.monitoring.collect.MonitoringDataCollection)

Example 9 with MonitoringDataCollector

use of fish.payara.monitoring.collect.MonitoringDataCollector in project Payara by payara.

the class HealthCheckService method collectChecks.

private Map<String, List<HealthCheckResponse>> collectChecks(MonitoringDataCollector collector, Map<String, Set<HealthCheck>> checks, Map<String, Set<String>> collected) {
    Map<String, List<HealthCheckResponse>> statusByApp = new HashMap<>();
    for (Entry<String, Set<HealthCheck>> entry : checks.entrySet()) {
        String appName = entry.getKey();
        MonitoringDataCollector appCollector = collector.group(appName);
        for (HealthCheck check : entry.getValue()) {
            HealthCheckResponse response = performHealthCheckInApplicationContext(appName, check);
            String metric = response.getName();
            Set<String> appCollected = collected.get(appName);
            // prevent adding same check more then once, unfortunately we have to run it to find that out
            if (appCollected == null || !appCollected.contains(metric)) {
                statusByApp.computeIfAbsent(appName, key -> new ArrayList<>()).add(response);
                collectUpDown(appCollector, response);
                if (response.getStatus() == Status.DOWN && response.getData().isPresent()) {
                    appCollector.annotate(metric, 0L, createAnnotation(response.getData().get()));
                }
                collected.computeIfAbsent(appName, key -> new HashSet<>()).add(metric);
            }
        }
    }
    return statusByApp;
}
Also used : MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) JsonWriterFactory(javax.json.JsonWriterFactory) Events(org.glassfish.api.event.Events) MonitoringWatchCollector(fish.payara.monitoring.collect.MonitoringWatchCollector) Map(java.util.Map) WebApplication(com.sun.enterprise.web.WebApplication) LIVENESS(fish.payara.microprofile.healthcheck.HealthCheckType.LIVENESS) HealthCheck(org.eclipse.microprofile.health.HealthCheck) PayaraHealthCheckServiceEvents(fish.payara.nucleus.healthcheck.events.PayaraHealthCheckServiceEvents) MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) Collections.emptyList(java.util.Collections.emptyList) UnprocessedChangeEvents(org.jvnet.hk2.config.UnprocessedChangeEvents) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) WARNING(java.util.logging.Level.WARNING) Set(java.util.Set) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) Collectors.joining(java.util.stream.Collectors.joining) MonitoringDataSource(fish.payara.monitoring.collect.MonitoringDataSource) List(java.util.List) StartupRunLevel(org.glassfish.api.StartupRunLevel) Service(org.jvnet.hk2.annotations.Service) Entry(java.util.Map.Entry) PostConstruct(javax.annotation.PostConstruct) MicroprofileHealthCheckConfiguration(fish.payara.microprofile.healthcheck.config.MicroprofileHealthCheckConfiguration) Optional(java.util.Optional) UnprocessedChangeEvent(org.jvnet.hk2.config.UnprocessedChangeEvent) JsonObjectBuilder(javax.json.JsonObjectBuilder) Deployment(org.glassfish.internal.deployment.Deployment) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) READINESS(fish.payara.microprofile.healthcheck.HealthCheckType.READINESS) JsonGenerator(javax.json.stream.JsonGenerator) InvocationManager(org.glassfish.api.invocation.InvocationManager) JsonArrayBuilder(javax.json.JsonArrayBuilder) Globals(org.glassfish.internal.api.Globals) MonitoringData(fish.payara.monitoring.collect.MonitoringData) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) InvocationException(org.glassfish.api.invocation.InvocationException) HealthCheckResponse(org.eclipse.microprofile.health.HealthCheckResponse) BiConsumer(java.util.function.BiConsumer) Json(javax.json.Json) Collections.singletonMap(java.util.Collections.singletonMap) EventListener(org.glassfish.api.event.EventListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) WebComponentInvocation(com.sun.enterprise.web.WebComponentInvocation) RunLevel(org.glassfish.hk2.runlevel.RunLevel) StringWriter(java.io.StringWriter) HttpServletResponse(javax.servlet.http.HttpServletResponse) WebContainer(com.sun.enterprise.web.WebContainer) IOException(java.io.IOException) Checker(fish.payara.nucleus.healthcheck.configuration.Checker) STARTUP(fish.payara.microprofile.healthcheck.HealthCheckType.STARTUP) Status(org.eclipse.microprofile.health.HealthCheckResponse.Status) MonitoringWatchSource(fish.payara.monitoring.collect.MonitoringWatchSource) JsonWriter(javax.json.JsonWriter) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) ApplicationRegistry(org.glassfish.internal.data.ApplicationRegistry) ConfigListener(org.jvnet.hk2.config.ConfigListener) PayaraHealthCheck(fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck) Set(java.util.Set) HashSet(java.util.HashSet) HealthCheckResponse(org.eclipse.microprofile.health.HealthCheckResponse) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) HealthCheck(org.eclipse.microprofile.health.HealthCheck) PayaraHealthCheck(fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Aggregations

MonitoringDataCollector (fish.payara.monitoring.collect.MonitoringDataCollector)9 MonitoringData (fish.payara.monitoring.collect.MonitoringData)3 MonitoringDataCollection (fish.payara.monitoring.collect.MonitoringDataCollection)2 DistributedObject (com.hazelcast.core.DistributedObject)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 LocalTopicStats (com.hazelcast.topic.LocalTopicStats)1 WebApplication (com.sun.enterprise.web.WebApplication)1 WebComponentInvocation (com.sun.enterprise.web.WebComponentInvocation)1 WebContainer (com.sun.enterprise.web.WebContainer)1 LIVENESS (fish.payara.microprofile.healthcheck.HealthCheckType.LIVENESS)1 READINESS (fish.payara.microprofile.healthcheck.HealthCheckType.READINESS)1 STARTUP (fish.payara.microprofile.healthcheck.HealthCheckType.STARTUP)1 PayaraHealthCheck (fish.payara.microprofile.healthcheck.checks.PayaraHealthCheck)1 MicroprofileHealthCheckConfiguration (fish.payara.microprofile.healthcheck.config.MicroprofileHealthCheckConfiguration)1 NoSuchRegistryException (fish.payara.microprofile.metrics.exception.NoSuchRegistryException)1 MBeanMetadata (fish.payara.microprofile.metrics.jmx.MBeanMetadata)1 MonitoringDataSource (fish.payara.monitoring.collect.MonitoringDataSource)1 MonitoringWatchCollector (fish.payara.monitoring.collect.MonitoringWatchCollector)1 MonitoringWatchSource (fish.payara.monitoring.collect.MonitoringWatchSource)1 Checker (fish.payara.nucleus.healthcheck.configuration.Checker)1