public EvictionQueueMetrics() { super("evictionQueue"); evictionQueueAddCounter = newCounter("addedEvictions"); evictionQueueRemoveCounter = newCounter("removedEvictions"); }
public InterestChannelMetrics() { super("server", STATES.class); this.interestAllCounter = newLongGauge("interestAll"); this.totalInstanceInterests = newLongGauge("totalInstanceInterests"); }
public EurekaServerRegistryMetrics() { super("eurekaServerRegistry"); registrationsLocal = newCounter("registrationsLocal"); registrationsReplicated = newCounter("registrationsReplicated"); registrationsTotal = newCounter("registrationsTotal"); updatesLocal = newCounter("updatesLocal"); updatesReplicated = newCounter("updatesLocal"); updatesTotal = newCounter("updatesTotal"); unregistrationsLocal = newCounter("unregistrationsLocal"); unregistrationsReplicated = newCounter("unregistrationsReplicated"); unregistrationsTotal = newCounter("unregistrationsTotal"); }
public static EurekaServerMetricFactory serverMetrics() { if (INSTANCE == null) { synchronized (EurekaServerMetricFactory.class) { MessageConnectionMetrics registrationConnectionMetrics = new MessageConnectionMetrics("registration"); registrationConnectionMetrics.bindMetrics(); MessageConnectionMetrics replicationConnectionMetrics = new MessageConnectionMetrics("replication"); replicationConnectionMetrics.bindMetrics(); MessageConnectionMetrics discoveryConnectionMetrics = new MessageConnectionMetrics("discovery"); discoveryConnectionMetrics.bindMetrics(); InterestChannelMetrics interestChannelMetrics = new InterestChannelMetrics(); interestChannelMetrics.bindMetrics(); INSTANCE = new EurekaServerMetricFactory( registrationConnectionMetrics, replicationConnectionMetrics, discoveryConnectionMetrics, interestChannelMetrics ); } } return INSTANCE; } }
private LongGauge getSubscriptionCounter(InterestKey interestKey) { LongGauge counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { synchronized (subscribedClientsByInterest) { counter = subscribedClientsByInterest.get(interestKey); if (counter == null) { counter = new LongGauge(monitorConfig("subscriptions." + interestKey.getCounterName())); subscribedClientsByInterest.put(interestKey, counter); register(counter); } } } return counter; }
public void incrementSubscriptionCounter(AtomicInterest interestType, String id) { if (interestType == AtomicInterest.Instance) { ServoUtils.incrementLongGauge(totalInstanceInterests); } if (interestType == AtomicInterest.InterestAll) { ServoUtils.incrementLongGauge(interestAllCounter); } else { ServoUtils.incrementLongGauge(getSubscriptionCounter(new InterestKey(interestType, id))); } }
public void setSelfPreservationMonitor(final PreservableEurekaRegistry registry) { Callable<Integer> selfPreservationCallable = new Callable<Integer>() { @Override public Integer call() throws Exception { return registry.isInSelfPreservation() ? 1 : 0; } }; BasicGauge<Integer> gauge = new BasicGauge<>(monitorConfig("selfPreservation"), selfPreservationCallable); register(gauge); } }
public BridgeChannelMetrics() { super("bridgeChannel", STATES.class); totalCount = newLongGauge("totalCount"); registerCount = newLongGauge("registerCount"); updateCount = newLongGauge("updateCount"); unregisterCount = newLongGauge("unregisterCount"); register(totalCount, updateCount, registerCount, unregisterCount); }
protected boolean moveToState(STATES from, STATES to) { if (state.compareAndSet(from, to)) { metrics.decrementStateCounter(from); metrics.incrementStateCounter(to); return true; } return false; } }
public void setEvictionQueueSizeMonitor(final EvictionQueue evictionQueue) { Callable<Integer> registrySizeCallable = new Callable<Integer>() { @Override public Integer call() throws Exception { return evictionQueue.size(); } }; BasicGauge<Integer> gauge = new BasicGauge<>(monitorConfig("evictionQueueSize"), registrySizeCallable); register(gauge); } }
public EvictionQueueImpl(WriteServerConfig config, WriteServerMetricFactory metricFactory, Scheduler scheduler) { this.evictionTimeoutMs = config.getEvictionTimeoutMs(); this.evictionQueueMetrics = metricFactory.getEvictionQueueMetrics(); this.worker = scheduler.createWorker(); evictionQueueMetrics.setEvictionQueueSizeMonitor(this); }
@Override public InterestChannel newInterestChannel() { return new InterestChannelImpl(registry, connection, metricFactory.getInterestChannelMetrics()); } }
@Inject public PreservableEurekaRegistry(@Named("delegate") EurekaServerRegistry eurekaRegistry, EvictionQueue evictionQueue, EvictionStrategy evictionStrategy, WriteServerMetricFactory metricFactory) { this.eurekaRegistry = eurekaRegistry; this.evictionStrategy = evictionStrategy; this.evictionSubscriber = new EvictionSubscriber(); this.evictionSubscription = evictionQueue.pendingEvictions().subscribe(evictionSubscriber); metricFactory.getEurekaServerRegistryMetrics().setSelfPreservationMonitor(this); }
@Override public void _close() { if (state.compareAndSet(STATES.Open, STATES.Closed)) { state.set(STATES.Closed); channelSubscriptionMonitor.update(Interests.forNone()); metrics.stateTransition(STATES.Open, STATES.Closed); notificationMultiplexer.unregister(); super._close(); // Shutdown the transport } } }
@Override public int hashCode() { int result = type != null ? type.hashCode() : 0; result = 31 * result + (id != null ? id.hashCode() : 0); return result; }
@Override public RegistrationChannel newRegistrationChannel() { return new RegistrationChannelImpl(registry, evictionQueue, connection, metricFactory.getRegistrationChannelMetrics()); }
public void incrementApplicationNotificationCounter(String applicationName) { getApplicationNotificationCounter(applicationName).increment(); }
@Override public ReplicationChannel newReplicationChannel() { return new ReceiverReplicationChannel(connection, selfRegistrationService, registry, evictionQueue, metricFactory.getReplicationChannelMetrics()); }
public void decrementSubscriptionCounter(AtomicInterest interestType, String id) { if (interestType == AtomicInterest.Instance) { ServoUtils.decrementLongGauge(totalInstanceInterests); } if (interestType == AtomicInterest.InterestAll) { ServoUtils.decrementLongGauge(interestAllCounter); } else { ServoUtils.decrementLongGauge(getSubscriptionCounter(new InterestKey(interestType, id))); } }
public void setRegistrySizeMonitor(final EurekaServerRegistry<InstanceInfo> registry) { Callable<Integer> registrySizeCallable = new Callable<Integer>() { @Override public Integer call() throws Exception { return registry.size(); } }; BasicGauge<Integer> gauge = new BasicGauge<>(monitorConfig("registrySize"), registrySizeCallable); register(gauge); }