@Override public void startNestedComponent(ILifecycleComponent component, ILifecycleProgressMonitor monitor, boolean require) throws SiteWhereException { if (component instanceof ITenantEngineLifecycleComponent) { ((ITenantEngineLifecycleComponent) component).setTenantEngine(getTenantEngine()); } super.startNestedComponent(component, monitor, require); }
@Override public void initializeNestedComponent(ILifecycleComponent component, ILifecycleProgressMonitor monitor, boolean require) throws SiteWhereException { if (component instanceof ITenantEngineLifecycleComponent) { ((ITenantEngineLifecycleComponent) component).setTenantEngine(getTenantEngine()); } super.initializeNestedComponent(component, monitor, require); }
@Override public Timer createTimerMetric(String name) { return getTenantEngine().getMicroservice().getMetricRegistry().timer(getTenentMetricPrefix() + name); }
@Override public Meter createMeterMetric(String name) { return getTenantEngine().getMicroservice().getMetricRegistry().meter(getTenentMetricPrefix() + name); }
/** * Get prefix added to metrics so they are unique. * * @return */ protected String getTenentMetricPrefix() { IMicroservice<?> microservice = getTenantEngine().getMicroservice(); ITenant tenant = getTenantEngine().getTenant(); String instanceId = microservice.getInstanceSettings().getInstanceId(); String identifier = microservice.getIdentifier().getPath(); String tenantToken = tenant.getToken(); return instanceId + "." + identifier + "." + tenantToken + "."; }