Search in sources :

Example 1 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class RemoteSystemOperationsService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.REMOTE_SYSTEM_OPERATION));
    LOG.info("Starting RemoteSystemOperationService...");
    httpService.startAndWait();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(new Discoverable(Constants.Service.REMOTE_SYSTEM_OPERATION, httpService.getBindAddress())));
    LOG.info("RemoteSystemOperationService started successfully on {}", httpService.getBindAddress());
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 2 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class DatasetOpExecutorService method startUp.

@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.startAndWait();
    cancellable = discoveryService.register(ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress())));
    LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress());
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 3 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class StreamHttpService method startUp.

@Override
protected void startUp() throws Exception {
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.STREAMS));
    httpService.startAndWait();
    discoverable = ResolvingDiscoverable.of(new Discoverable(Constants.Service.STREAMS, httpService.getBindAddress()));
    cancellable = discoveryService.register(discoverable);
}
Also used : Discoverable(org.apache.twill.discovery.Discoverable) ResolvingDiscoverable(co.cask.cdap.common.discovery.ResolvingDiscoverable) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Example 4 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class ExploreServiceTwillRunnable method doInit.

@Override
protected Injector doInit(TwillContext context) {
    setupHive();
    CConfiguration cConf = getCConfiguration();
    Configuration hConf = getConfiguration();
    addResource(hConf, "yarn-site.xml");
    addResource(hConf, "mapred-site.xml");
    addResource(hConf, "hive-site.xml");
    addResource(hConf, "tez-site.xml");
    // Set the host name to the one provided by Twill
    cConf.set(Constants.Explore.SERVER_ADDRESS, context.getHost().getHostName());
    String txClientId = String.format("cdap.service.%s.%d", Constants.Service.EXPLORE_HTTP_USER_SERVICE, context.getInstanceId());
    // NOTE: twill client will try to load all the classes present here - including hive classes but it
    // will fail since Hive classes are not in master classpath, and ignore those classes silently
    injector = createInjector(cConf, hConf, txClientId);
    injector.getInstance(LogAppenderInitializer.class).initialize();
    LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.EXPLORE_HTTP_USER_SERVICE));
    return injector;
}
Also used : LogAppenderInitializer(co.cask.cdap.logging.appender.LogAppenderInitializer) CConfiguration(co.cask.cdap.common.conf.CConfiguration) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext) CConfiguration(co.cask.cdap.common.conf.CConfiguration)

Example 5 with ServiceLoggingContext

use of co.cask.cdap.common.logging.ServiceLoggingContext in project cdap by caskdata.

the class MetricsProcessorTwillRunnable method doInit.

@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;
}
Also used : LogAppenderInitializer(co.cask.cdap.logging.appender.LogAppenderInitializer) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext)

Aggregations

ServiceLoggingContext (co.cask.cdap.common.logging.ServiceLoggingContext)20 ResolvingDiscoverable (co.cask.cdap.common.discovery.ResolvingDiscoverable)8 Discoverable (org.apache.twill.discovery.Discoverable)8 LogAppenderInitializer (co.cask.cdap.logging.appender.LogAppenderInitializer)7 CConfiguration (co.cask.cdap.common.conf.CConfiguration)5 ImmutableList (com.google.common.collect.ImmutableList)3 Configuration (org.apache.hadoop.conf.Configuration)3 MetricsCollectionService (co.cask.cdap.api.metrics.MetricsCollectionService)2 LoggingContext (co.cask.cdap.common.logging.LoggingContext)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 CloseableIterator (co.cask.cdap.api.dataset.lib.CloseableIterator)1 MetricDataQuery (co.cask.cdap.api.metrics.MetricDataQuery)1 MetricStore (co.cask.cdap.api.metrics.MetricStore)1 ProgramRuntimeService (co.cask.cdap.app.runtime.ProgramRuntimeService)1 CommonNettyHttpServiceBuilder (co.cask.cdap.common.http.CommonNettyHttpServiceBuilder)1 ApplicationLoggingContext (co.cask.cdap.common.logging.ApplicationLoggingContext)1 ComponentLoggingContext (co.cask.cdap.common.logging.ComponentLoggingContext)1 NamespaceLoggingContext (co.cask.cdap.common.logging.NamespaceLoggingContext)1