/** * @deprecated since 0.9.0; see {@link BasicEnricherSupport#addEnricher(Enricher)}; e.g. {@code enrichers().addEnricher(enricher)} */ @Override @Deprecated public void addEnricher(Enricher enricher) { enrichers().add(enricher); }
/** * @deprecated since 0.9.0; see {@link BasicEnricherSupport#; e.g. {@code enrichers().addEnricher(spec)} */ @Override @Deprecated public <T extends Enricher> T addEnricher(EnricherSpec<T> spec) { return enrichers().add(spec); }
@Override public void init() { Entity delegate = getConfig(DELEGATE_ENTITY); Preconditions.checkNotNull(delegate, "delegate"); // Propagate all sensors from the delegate entity enrichers().add(Enrichers.builder() .propagatingAll() .from(delegate) .build()); // Publish the entity as an attribute for linking sensors().set(DELEGATE_ENTITY, delegate); sensors().set(DELEGATE_ENTITY_LINK, EntityUrl.entityUrl().apply(delegate)); } }
@Override public void init() { super.init(); ConfigToAttributes.apply(this, MESOS_SLAVE_ID); EnricherSpec<?> serviceUp = Enrichers.builder() .propagating(ImmutableMap.of(SLAVE_ACTIVE, SERVICE_UP)) .suppressDuplicates(true) .from(this) .build(); enrichers().add(serviceUp); }
@Override protected void initEnrichers() { super.initEnrichers(); // all children must be up, for ourselves to be up enrichers().add(ServiceStateLogic.newEnricherFromChildrenUp() .checkChildrenOnly() .requireUpChildren(QuorumCheck.QuorumChecks.all())); }
@Override public <T extends Enricher> T add(EnricherSpec<T> spec) { T enricher = getManagementContext().getEntityManager().createEnricher(spec); add(enricher); return enricher; }
@Override protected void initEnrichers() { super.initEnrichers(); // Because can have multiple children (similar to groups/clusters/apps), need to // monitor their health and indicate this has failed if any of them have failed. enrichers().add(ServiceStateLogic.newEnricherFromChildren() .suppressDuplicates(true) .configure(ComputeServiceIndicatorsFromChildrenAndMembers.UP_QUORUM_CHECK, QuorumCheck.QuorumChecks.all())); }
@Override public void init() { super.init(); enrichers().add(Enrichers.builder() .aggregating(Changeable.GROUP_SIZE) .publishing(FABRIC_SIZE) .fromMembers() .computingSum() .valueToReportIfNoSensors(0) .build()); sensors().set(SERVICE_UP, false); }
void connectSensors() { // FIXME no longer needed enrichers().add(Enrichers.builder() .propagatingAllButUsualAnd(Attributes.MAIN_URI, ROOT_URL, GROUP_MEMBERS, GROUP_SIZE) .from(getCluster()) .build()); enrichers().add(Enrichers.builder() // include hostname and address of controller (need both in case hostname only resolves to internal/private ip) .propagating(LoadBalancer.HOSTNAME, Attributes.ADDRESS, Attributes.MAIN_URI, ROOT_URL) .from(getController()) .build()); }
@Override protected void connectSensors() { super.connectSensors(); LOG.info("connecting sensors for "+this); enrichers().add(EnricherSpec.create(RollingTimeWindowMeanEnricher.class) .configure("producer", this) .configure("source", PROCESS_CPU_TIME) .configure("target", AVG2) .configure("timePeriod", Duration.TEN_SECONDS)); } }
@Override protected void initEnrichers() { super.initEnrichers(); ServiceNotUpLogic.updateNotUpIndicator(this, SERVICE_PROCESS_IS_RUNNING, "No information yet on whether this service is running"); // add an indicator above so that if is_running comes through, the map is cleared and an update is guaranteed enrichers().add(EnricherSpec.create(UpdatingNotUpFromServiceProcessIsRunning.class).uniqueTag("service-process-is-running-updating-not-up")); enrichers().add(EnricherSpec.create(ServiceNotUpDiagnosticsCollector.class).uniqueTag("service-not-up-diagnostics-collector")); }
@Override public void initEnrichers() { super.initEnrichers(); // Include STARTING members in UP_QUORUM_CHECK as we want all members running and up for quorum enrichers().add(ServiceStateLogic.newEnricherFromChildrenUp() .checkMembersOnly() .requireUpChildren(getConfig(UP_QUORUM_CHECK)) .configure(ServiceStateLogic.ComputeServiceIndicatorsFromChildrenAndMembers.IGNORE_ENTITIES_WITH_SERVICE_UP_NULL, false) .configure(ServiceStateLogic.ComputeServiceIndicatorsFromChildrenAndMembers.IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES, ImmutableSet.<Lifecycle>of(Lifecycle.STOPPING, Lifecycle.STOPPED, Lifecycle.DESTROYED)) .suppressDuplicates(true)); }
private <T> void propagateMasterAttribute(AttributeSensor<T> att) { enrichers().add(Enrichers.builder() .aggregating(att) .publishing(att) .computing(IfFunctions.<Collection<T>>ifPredicate(CollectionFunctionals.notEmpty()) .apply(CollectionFunctionals.firstElement()) .defaultValue(null)) .entityFilter(MySqlClusterUtils.IS_MASTER) .build()); }
@Override public void onManagementStarted() { super.onManagementStarted(); LOG.info("mgmt started for "+this); enrichers().add(EnricherSpec.create(RollingTimeWindowMeanEnricher.class) .configure("producer", this) .configure("source", PROCESS_CPU_TIME) .configure("target", AVG1) .configure("timePeriod", Duration.TEN_SECONDS)); }
@Override protected void initEnrichers() { // Deliberately not calling `super.initEnrichers()`. For our state (i.e. "service.state" // and "service.isUp"), we rely on the `serviceStateComputer`. This keeps things a lot // simpler. However, it means that if someone manually sets a "service.notUp.indicators" // or "service.problems" then that won't cause the entity to transition to false or ON_FIRE. enrichers().add(EnricherSpec.create(ServiceStateComputer.class) .configure(ServiceStateComputer.FROM_CHILDREN, true) .configure(ServiceStateComputer.UP_QUORUM_CHECK, config().get(UP_QUORUM_CHECK)) .configure(ServiceStateComputer.RUNNING_QUORUM_CHECK, config().get(RUNNING_QUORUM_CHECK))); }
@Override public void onManagementStarted() { super.onManagementStarted(); enrichers().add(EnricherSpec.create(MyEnricher.class).uniqueTag("z").tag(Identifiers.makeRandomId(8))); // all the enrichers above should not be added on rebind, but this one will be: enrichers().add(EnricherSpec.create(MyEnricher.class).uniqueTag( Identifiers.makeRandomId(8) ).tag(Identifiers.makeRandomId(8))); } }
@Override public void onManagementStarting() { super.onManagementStarted(); enrichers().add(EnricherSpec.create(MyEnricher.class).uniqueTag("y").tag(Identifiers.makeRandomId(8))); } @Override
@Override protected void initEnrichers() { super.initEnrichers(); enrichers().add(ServiceStateLogic.newEnricherFromChildrenUp() .checkChildrenOnly() .requireUpChildren(QuorumCheck.QuorumChecks.all()) .suppressDuplicates(true)); }