Search in sources :

Example 1 with ProfileMetricService

use of io.cdap.cdap.internal.profile.ProfileMetricService in project cdap by caskdata.

the class DefaultRuntimeJob method createCoreServices.

@VisibleForTesting
Deque<Service> createCoreServices(Injector injector, Arguments systemArgs, Cluster cluster) {
    Deque<Service> services = new LinkedList<>();
    services.add(injector.getInstance(LogAppenderLoaderService.class));
    MessagingService messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        services.add((Service) messagingService);
    }
    services.add(injector.getInstance(MessagingHttpService.class));
    // Metrics need TMS, hence start it after TMS.
    MetricsCollectionService metricsCollectionService = injector.getInstance(MetricsCollectionService.class);
    services.add(metricsCollectionService);
    // Starts the traffic relay if monitoring is done through SSH tunnel
    if (injector.getInstance(RuntimeMonitorType.class) == RuntimeMonitorType.SSH) {
        services.add(injector.getInstance(TrafficRelayService.class));
    }
    runtimeClientService = injector.getInstance(RuntimeClientService.class);
    services.add(runtimeClientService);
    // Creates a service to emit profile metrics
    ProgramRunId programRunId = injector.getInstance(ProgramRunId.class);
    ProfileId profileId = SystemArguments.getProfileIdFromArgs(programRunId.getNamespaceId(), systemArgs.asMap()).orElseThrow(() -> new IllegalStateException("Missing profile information for program run " + programRunId));
    services.add(new ProfileMetricService(metricsCollectionService, programRunId, profileId, cluster.getNodes().size()));
    return services;
}
Also used : ProfileId(io.cdap.cdap.proto.id.ProfileId) LogAppenderLoaderService(io.cdap.cdap.logging.appender.loader.LogAppenderLoaderService) RuntimeMonitorType(io.cdap.cdap.runtime.spi.RuntimeMonitorType) ProfileMetricService(io.cdap.cdap.internal.profile.ProfileMetricService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) RuntimeClientService(io.cdap.cdap.internal.app.runtime.monitor.RuntimeClientService) Service(com.google.common.util.concurrent.Service) ProfileMetricService(io.cdap.cdap.internal.profile.ProfileMetricService) LogAppenderLoaderService(io.cdap.cdap.logging.appender.loader.LogAppenderLoaderService) MessagingService(io.cdap.cdap.messaging.MessagingService) AbstractIdleService(com.google.common.util.concurrent.AbstractIdleService) MessagingHttpService(io.cdap.cdap.messaging.server.MessagingHttpService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) MessagingHttpService(io.cdap.cdap.messaging.server.MessagingHttpService) LinkedList(java.util.LinkedList) MessagingService(io.cdap.cdap.messaging.MessagingService) ProgramRunId(io.cdap.cdap.proto.id.ProgramRunId) RuntimeClientService(io.cdap.cdap.internal.app.runtime.monitor.RuntimeClientService) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with ProfileMetricService

use of io.cdap.cdap.internal.profile.ProfileMetricService in project cdap by cdapio.

the class DefaultRuntimeJob method createCoreServices.

@VisibleForTesting
Deque<Service> createCoreServices(Injector injector, Arguments systemArgs, Cluster cluster) {
    Deque<Service> services = new LinkedList<>();
    services.add(injector.getInstance(LogAppenderLoaderService.class));
    MessagingService messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        services.add((Service) messagingService);
    }
    services.add(injector.getInstance(MessagingHttpService.class));
    // Metrics need TMS, hence start it after TMS.
    MetricsCollectionService metricsCollectionService = injector.getInstance(MetricsCollectionService.class);
    services.add(metricsCollectionService);
    // Starts the traffic relay if monitoring is done through SSH tunnel
    if (injector.getInstance(RuntimeMonitorType.class) == RuntimeMonitorType.SSH) {
        services.add(injector.getInstance(TrafficRelayService.class));
    }
    runtimeClientService = injector.getInstance(RuntimeClientService.class);
    services.add(runtimeClientService);
    // Creates a service to emit profile metrics
    ProgramRunId programRunId = injector.getInstance(ProgramRunId.class);
    ProfileId profileId = SystemArguments.getProfileIdFromArgs(programRunId.getNamespaceId(), systemArgs.asMap()).orElseThrow(() -> new IllegalStateException("Missing profile information for program run " + programRunId));
    services.add(new ProfileMetricService(metricsCollectionService, programRunId, profileId, cluster.getNodes().size()));
    return services;
}
Also used : ProfileId(io.cdap.cdap.proto.id.ProfileId) LogAppenderLoaderService(io.cdap.cdap.logging.appender.loader.LogAppenderLoaderService) RuntimeMonitorType(io.cdap.cdap.runtime.spi.RuntimeMonitorType) ProfileMetricService(io.cdap.cdap.internal.profile.ProfileMetricService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) RuntimeClientService(io.cdap.cdap.internal.app.runtime.monitor.RuntimeClientService) Service(com.google.common.util.concurrent.Service) ProfileMetricService(io.cdap.cdap.internal.profile.ProfileMetricService) LogAppenderLoaderService(io.cdap.cdap.logging.appender.loader.LogAppenderLoaderService) MessagingService(io.cdap.cdap.messaging.MessagingService) AbstractIdleService(com.google.common.util.concurrent.AbstractIdleService) MessagingHttpService(io.cdap.cdap.messaging.server.MessagingHttpService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) MessagingHttpService(io.cdap.cdap.messaging.server.MessagingHttpService) LinkedList(java.util.LinkedList) MessagingService(io.cdap.cdap.messaging.MessagingService) ProgramRunId(io.cdap.cdap.proto.id.ProgramRunId) RuntimeClientService(io.cdap.cdap.internal.app.runtime.monitor.RuntimeClientService) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 AbstractIdleService (com.google.common.util.concurrent.AbstractIdleService)2 Service (com.google.common.util.concurrent.Service)2 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)2 RuntimeClientService (io.cdap.cdap.internal.app.runtime.monitor.RuntimeClientService)2 ProfileMetricService (io.cdap.cdap.internal.profile.ProfileMetricService)2 LogAppenderLoaderService (io.cdap.cdap.logging.appender.loader.LogAppenderLoaderService)2 MessagingService (io.cdap.cdap.messaging.MessagingService)2 MessagingHttpService (io.cdap.cdap.messaging.server.MessagingHttpService)2 ProfileId (io.cdap.cdap.proto.id.ProfileId)2 ProgramRunId (io.cdap.cdap.proto.id.ProgramRunId)2 RuntimeMonitorType (io.cdap.cdap.runtime.spi.RuntimeMonitorType)2 LinkedList (java.util.LinkedList)2