@Inject ReportClient(NodeInfo nodeInfo, @ForReportClient HttpClient httpClient, ReportClientConfig reportClientConfig, ReportTagConfig reportTagConfig, ObjectMapper objectMapper) { this.objectMapper = objectMapper; requireNonNull(nodeInfo, "nodeInfo is null"); requireNonNull(reportClientConfig, "reportClientConfig is null"); requireNonNull(reportTagConfig, "reportTagConfig is null"); Builder<String, String> builder = ImmutableMap.builder(); builder.put("application", nodeInfo.getApplication()); builder.put("host", nodeInfo.getInternalHostname()); builder.put("environment", nodeInfo.getEnvironment()); builder.put("pool", nodeInfo.getPool()); builder.putAll(reportTagConfig.getTags()); this.instanceTags = builder.build(); this.httpClient = requireNonNull(httpClient, "httpClient is null"); }
@Provides @Singleton NodeInfo createNodeInfo(NodeConfig config) { return new NodeInfo("test-application", config); }
@Inject public LauncherLifecycleManager(AgentConfig config, NodeInfo nodeInfo, HttpServerInfo httpServerInfo) { this(nodeInfo.getEnvironment(), nodeInfo.getInternalIp(), nodeInfo.getExternalAddress(), nodeInfo.getBindIp(), config.getLauncherTimeout(), config.getLauncherStopTimeout(), uriBuilderFrom(httpServerInfo.getHttpsUri() != null ? httpServerInfo.getHttpsUri() : httpServerInfo.getHttpUri()).appendPath("/v1/serviceInventory").build() ); }
@Inject ReportCollector( NodeInfo nodeInfo, MinuteBucketIdProvider bucketIdProvider, ReportedBeanRegistry reportedBeanRegistry, ReportSink reportSink) { applicationPrefix = LOWER_HYPHEN.to(UPPER_CAMEL, nodeInfo.getApplication()) + "."; this.bucketIdProvider = requireNonNull(bucketIdProvider, "bucketIdProvider is null"); this.reportedBeanRegistry = requireNonNull(reportedBeanRegistry, "reportedBeanRegistry is null"); this.reportSink = requireNonNull(reportSink, "reportSink is null"); ImmutableMap.Builder<String, String> versionTagsBuilder = ImmutableMap.builder(); if (!nodeInfo.getApplicationVersion().isEmpty()) { versionTagsBuilder.put("applicationVersion", nodeInfo.getApplicationVersion()); } if (!nodeInfo.getPlatformVersion().isEmpty()) { versionTagsBuilder.put("platformVersion", nodeInfo.getPlatformVersion()); } this.versionTags = versionTagsBuilder.build(); }
httpChannel = createChannel(nodeInfo.getBindIp(), config.getHttpPort(), config.getHttpAcceptQueueSize()); httpUri = buildUri("http", InetAddresses.toUriString(nodeInfo.getInternalIp()), port(httpChannel)); httpExternalUri = buildUri("http", nodeInfo.getExternalAddress(), httpUri.getPort()); httpsChannel = createChannel(nodeInfo.getBindIp(), config.getHttpsPort(), config.getHttpAcceptQueueSize()); httpsUri = buildUri("https", nodeInfo.getInternalHostname(), port(httpsChannel)); adminChannel = createChannel(nodeInfo.getBindIp(), config.getAdminPort(), config.getHttpAcceptQueueSize()); if (config.isHttpsEnabled()) { adminUri = buildUri("https", nodeInfo.getInternalHostname(), port(adminChannel)); adminExternalUri = null; adminUri = buildUri("http", InetAddresses.toUriString(nodeInfo.getInternalIp()), port(adminChannel)); adminExternalUri = buildUri("http", nodeInfo.getExternalAddress(), adminUri.getPort());
@Inject public Agent(AgentConfig config, HttpServerInfo httpServerInfo, NodeInfo nodeInfo, DeploymentManagerFactory deploymentManagerFactory, LifecycleManager lifecycleManager) { this(nodeInfo.getNodeId(), nodeInfo.getLocation(), config.getSlotsDir(), httpServerInfo.getHttpUri(), httpServerInfo.getHttpExternalUri(), config.getResourcesFile(), deploymentManagerFactory, lifecycleManager, config.getMaxLockWait() ); }
rpcAddress = nodeInfo.getBindIp(); rpcPort = config.getRpcPort(); .put("disk_access_mode", "auto") .put("storage_port", config.getStoragePort()) .put("listen_address", InetAddresses.toUriString(nodeInfo.getInternalIp())) .put("rpc_address", InetAddresses.toUriString(rpcAddress)) .put("rpc_port", rpcPort)
@Override public <T> ListenableFuture<Void> post(final Iterable<T> events) throws IllegalArgumentException { requireNonNull(events, "eventsSupplier is null"); TraceToken token = getCurrentTraceToken(); Request request = preparePost() .setUri(URI.create("v2/event")) .setHeader("User-Agent", nodeInfo.getNodeId()) .setHeader("Content-Type", MEDIA_TYPE_JSON.toString()) .setBodySource((DynamicBodySource) out -> eventWriter.createEventWriter(events.iterator(), token, out)) .build(); return httpClient.executeAsync(request, EVENT_RESPONSE_HANDLER); }
@Inject public SimpleDbStateManager(AmazonSimpleDB simpleDb, NodeInfo nodeInfo) { this.simpleDb = simpleDb; domainName = "galaxy-" + nodeInfo.getEnvironment(); }
public EventJsonSerializer(NodeInfo nodeInfo, @Nullable String token, EventTypeMetadata<T> eventTypeMetadata) { this.token = token; this.eventTypeMetadata = checkNotNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }
public static CassandraServerInfo getServerInfo() { Preconditions.checkState(initialized.get(), "Embedded Cassandra instance not yet initialized. Make sure to call tryInitialize() before calling this method."); return new CassandraServerInfo(nodeInfo.getBindIp(), rpcPort); }
@Inject public Coordinator(NodeInfo nodeInfo, HttpServerInfo httpServerInfo, CoordinatorConfig config, RemoteAgentFactory remoteAgentFactory, Repository repository, Provisioner provisioner, StateManager stateManager, ServiceInventory serviceInventory) { this( new CoordinatorStatus(nodeInfo.getInstanceId(), CoordinatorLifecycleState.ONLINE, extractMachineId(nodeInfo.getLocation(), UUID.randomUUID().toString()), httpServerInfo.getHttpUri(), httpServerInfo.getHttpExternalUri(), nodeInfo.getLocation(), null), remoteAgentFactory, repository, provisioner, stateManager, serviceInventory, checkNotNull(config, "config is null").getStatusExpiration(), config.isAllowDuplicateInstallationsOnAnAgent()); }
context.addFilter(new FilterHolder(new TraceTokenFilter(nodeInfo.getInternalIp(), clientAddressExtractor)), "/*", null);
@JsonProperty String getApplication() { return getNodeInfo().getApplication(); }
@JsonProperty String getApplicationVersion() { String applicationVersion = getNodeInfo().getApplicationVersion(); if (applicationVersion.isEmpty()) { return null; } return applicationVersion; }
@Inject public DirectoryDeploymentManagerFactory(NodeInfo nodeInfo, AgentConfig config) { this(nodeInfo.getLocation(), config.getSlotsDir(), config.getTarTimeout()); }
try { NodeInfo nodeInfo = injector.getInstance(NodeInfo.class); log.info("Node ID %s", nodeInfo.getNodeId());
@Inject public ServiceInventoryResource(Coordinator coordinator, ServiceInventory serviceInventory, NodeInfo nodeInfo) { Preconditions.checkNotNull(coordinator, "coordinator is null"); Preconditions.checkNotNull(serviceInventory, "serviceInventory is null"); Preconditions.checkNotNull(nodeInfo, "nodeInfo is null"); this.coordinator = coordinator; this.serviceInventory = serviceInventory; this.environment = nodeInfo.getEnvironment(); }
EventJsonSerializer(NodeInfo nodeInfo, @Nullable TraceToken token, EventTypeMetadata<T> eventTypeMetadata) { if (token == null || eventTypeMetadata.getTraceTokenField() != null) { this.token = null; } else if (token.size() == 1) { this.token = token.get("id"); } else { this.token = TRACE_TOKEN_JSON_CODEC.toJson(token); } this.eventTypeMetadata = requireNonNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }
httpConnector.setPort(httpServerInfo.getHttpUri().getPort()); httpConnector.setIdleTimeout(config.getNetworkMaxIdleTime().toMillis()); httpConnector.setHost(nodeInfo.getBindIp().getHostAddress()); httpConnector.setAcceptQueueSize(config.getHttpAcceptQueueSize()); httpsConnector.setPort(httpServerInfo.getHttpsUri().getPort()); httpsConnector.setIdleTimeout(config.getNetworkMaxIdleTime().toMillis()); httpsConnector.setHost(nodeInfo.getBindIp().getHostAddress()); httpsConnector.setAcceptQueueSize(config.getHttpAcceptQueueSize()); adminConnector.setPort(httpServerInfo.getAdminUri().getPort()); adminConnector.setIdleTimeout(config.getNetworkMaxIdleTime().toMillis()); adminConnector.setHost(nodeInfo.getBindIp().getHostAddress()); adminConnector.setAcceptQueueSize(config.getHttpAcceptQueueSize());