Search in sources :

Example 16 with GlobalRegistry

use of org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry in project incubator-servicecomb-java-chassis by apache.

the class InvocationMetersInitializer method init.

@Override
public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) {
    Registry registry = globalRegistry.getDefaultRegistry();
    consumerMeters = new ConsumerMeters(registry);
    producerMeters = new ProducerMeters(registry);
    edgeMeters = new EdgeMeters(registry);
    eventBus.register(this);
}
Also used : ConsumerMeters(org.apache.servicecomb.metrics.core.meter.ConsumerMeters) EdgeMeters(org.apache.servicecomb.metrics.core.meter.EdgeMeters) GlobalRegistry(org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry) Registry(com.netflix.spectator.api.Registry) ProducerMeters(org.apache.servicecomb.metrics.core.meter.ProducerMeters)

Example 17 with GlobalRegistry

use of org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry in project incubator-servicecomb-java-chassis by apache.

the class OsMetersInitializer method init.

@Override
public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) {
    if (!isOsLinux) {
        LOGGER.info("only support linux os to collect cpu and net info");
        return;
    }
    Registry registry = globalRegistry.getDefaultRegistry();
    osMeter = new OsMeter(registry);
    SpectatorUtils.registerMeter(registry, osMeter);
}
Also used : OsMeter(org.apache.servicecomb.metrics.core.meter.os.OsMeter) GlobalRegistry(org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry) Registry(com.netflix.spectator.api.Registry)

Example 18 with GlobalRegistry

use of org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry in project incubator-servicecomb-java-chassis by apache.

the class MetricsBootListener method onAfterRegistry.

@Override
public void onAfterRegistry(BootEvent event) {
    slowInvocationLogger = new SlowInvocationLogger(event.getScbEngine());
    metricsBootstrap.start(new GlobalRegistry(), EventManager.getEventBus());
}
Also used : GlobalRegistry(org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry) SlowInvocationLogger(org.apache.servicecomb.metrics.core.publish.SlowInvocationLogger)

Aggregations

GlobalRegistry (org.apache.servicecomb.foundation.metrics.registry.GlobalRegistry)18 Registry (com.netflix.spectator.api.Registry)14 Test (org.junit.Test)6 EventBus (com.google.common.eventbus.EventBus)4 Meter (com.netflix.spectator.api.Meter)4 Expectations (mockit.Expectations)4 MetricsBootstrapConfig (org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig)4 OsMeter (org.apache.servicecomb.metrics.core.meter.os.OsMeter)4 DefaultRegistry (com.netflix.spectator.api.DefaultRegistry)3 ManualClock (com.netflix.spectator.api.ManualClock)3 Clock (com.netflix.spectator.api.Clock)2 Measurement (com.netflix.spectator.api.Measurement)2 Sample (io.prometheus.client.Collector.MetricFamilySamples.Sample)2 CollectorRegistry (io.prometheus.client.CollectorRegistry)2 VertxImpl (io.vertx.core.impl.VertxImpl)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2