public static LoggingContext getLoggingContext(String systemId, String componentId, String serviceId) { return new ServiceLoggingContext(systemId, componentId, serviceId); }
@Override public String getLogPartition() { return String.format("%s:%s", super.getLogPartition(), getSystemTag(TAG_SERVICE_ID)); } }
private static Map<String, String> getMetricsTagsFromSystemContext(ServiceLoggingContext context) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put(Constants.Metrics.Tag.NAMESPACE, Id.Namespace.SYSTEM.getId()); builder.put(Constants.Metrics.Tag.COMPONENT, context.getSystemTagsMap().get(ServiceLoggingContext.TAG_SERVICE_ID).getValue()); return builder.build(); }
/** * Construct ServiceLoggingContext. * * @param systemId system id * @param componentId component id * @param serviceId service id */ public ServiceLoggingContext(final String systemId, final String componentId, final String serviceId) { super(systemId, componentId); setSystemTag(TAG_SERVICE_ID, serviceId); }
/** * Construct ServiceLoggingContext. * * @param systemId system id * @param componentId component id * @param serviceId service id */ public ServiceLoggingContext(final String systemId, final String componentId, final String serviceId) { super(systemId, componentId); setSystemTag(TAG_SERVICE_ID, serviceId); }
public static LoggingContext getLoggingContext(String systemId, String componentId, String serviceId) { return new ServiceLoggingContext(systemId, componentId, serviceId); }
@Override public String getLogPartition() { return String.format("%s:%s", super.getLogPartition(), getSystemTag(TAG_SERVICE_ID)); } }
private static Map<String, String> getMetricsTagsFromSystemContext(ServiceLoggingContext context) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put(Constants.Metrics.Tag.NAMESPACE, Id.Namespace.SYSTEM.getId()); builder.put(Constants.Metrics.Tag.COMPONENT, context.getSystemTagsMap().get(ServiceLoggingContext.TAG_SERVICE_ID).getValue()); return builder.build(); }
tags.get(ApplicationLoggingContext.TAG_INSTANCE_ID)); } else if (tags.containsKey(ServiceLoggingContext.TAG_SERVICE_ID)) { return new ServiceLoggingContext(namespaceId, componentId, tags.get(ServiceLoggingContext.TAG_SERVICE_ID)); } else if (tags.containsKey(WorkerLoggingContext.TAG_WORKER_ID)) {
tags.get(ApplicationLoggingContext.TAG_INSTANCE_ID)); } else if (tags.containsKey(ServiceLoggingContext.TAG_SERVICE_ID)) { return new ServiceLoggingContext(namespaceId, componentId, tags.get(ServiceLoggingContext.TAG_SERVICE_ID)); } else if (tags.containsKey(WorkerLoggingContext.TAG_WORKER_ID)) {
@Override protected Injector doInit(TwillContext context) { // Set the hostname of the machine so that cConf can be used to start internal services getCConfiguration().set(Constants.Metrics.ADDRESS, context.getHost().getCanonicalHostName()); LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.METRICS, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); return injector; }
@Override protected Injector doInit(TwillContext context) { getCConfiguration().set(Constants.Transaction.Container.ADDRESS, context.getHost().getCanonicalHostName()); // Set the hostname of the machine so that cConf can be used to start internal services LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.TRANSACTION, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.TRANSACTION)); return injector; }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); LOG.info("Starting Metrics Service..."); httpService.start(); LOG.info("Started Metrics HTTP Service..."); // Register the service cancelDiscovery = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress()))); LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.EXPLORE_HTTP_USER_SERVICE)); LOG.info("Starting {}...", ExploreExecutorService.class.getSimpleName()); if (!startOnDemand) { exploreService.startAndWait(); } httpService.start(); cancellable = discoveryService.register(ResolvingDiscoverable.of( new Discoverable(Constants.Service.EXPLORE_HTTP_USER_SERVICE, httpService.getBindAddress()))); LOG.info("{} started successfully on {}", ExploreExecutorService.class.getSimpleName(), httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); LOG.info("Starting Metrics Service..."); httpService.start(); LOG.info("Started Metrics HTTP Service..."); // Register the service cancelDiscovery = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress()))); LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress()); }
@Override protected Injector doInit(TwillContext context) { getCConfiguration().set(Constants.MetricsProcessor.ADDRESS, context.getHost().getCanonicalHostName()); // Set the hostname of the machine so that cConf can be used to start internal services LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.METRICS_PROCESSOR, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId, context); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); return injector; }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.EXPLORE_HTTP_USER_SERVICE)); LOG.info("Starting {}...", ExploreExecutorService.class.getSimpleName()); if (!startOnDemand) { exploreService.startAndWait(); } httpService.start(); cancellable = discoveryService.register(ResolvingDiscoverable.of( new Discoverable(Constants.Service.EXPLORE_HTTP_USER_SERVICE, httpService.getBindAddress()))); LOG.info("{} started successfully on {}", ExploreExecutorService.class.getSimpleName(), httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); LOG.info("Starting DatasetOpExecutorService..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress()))); LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress()); }