From b1fa08f5cabd12ff83606b6ecef29d394e16e01d Mon Sep 17 00:00:00 2001 From: Dominik Riemer Date: Wed, 13 Sep 2023 21:53:56 +0200 Subject: [PATCH] Add more logging to pipeline element installation --- .../manager/endpoint/EndpointItemFetcher.java | 12 +++++------- .../manager/setup/ExtensionsInstallationTask.java | 4 ++-- .../setup/PipelineElementInstallationStep.java | 6 ++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java index 0cfda6e2b7..6be697a01d 100644 --- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java @@ -18,13 +18,12 @@ package org.apache.streampipes.manager.endpoint; +import org.apache.streampipes.manager.execution.ExtensionServiceExecutions; import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpoint; import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpointItem; import org.apache.streampipes.serializers.json.JacksonSerializer; import com.fasterxml.jackson.core.type.TypeReference; -import org.apache.http.client.fluent.Request; -import org.apache.http.message.BasicHeader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,18 +48,17 @@ public List getItems() { private List getEndpointItems(ExtensionsServiceEndpoint e) { try { - String result = Request.Get(e.getEndpointUrl()) - .addHeader(new BasicHeader("Accept", "application/json")) - .connectTimeout(1000) + String result = ExtensionServiceExecutions + .extServiceGetRequest(e.getEndpointUrl()) .execute() .returnContent() .asString(); return JacksonSerializer.getObjectMapper() - .readValue(result, new TypeReference>() { + .readValue(result, new TypeReference<>() { }); } catch (IOException e1) { - logger.warn("Processing Element Descriptions could not be fetched from RDF endpoint: " + e.getEndpointUrl()); + logger.warn("Processing Element Descriptions could not be fetched from endpoint: " + e.getEndpointUrl()); return new ArrayList<>(); } } diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/ExtensionsInstallationTask.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/ExtensionsInstallationTask.java index 51864794e4..092806580b 100644 --- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/ExtensionsInstallationTask.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/ExtensionsInstallationTask.java @@ -55,7 +55,7 @@ public void run() { do { endpoints = new EndpointFetcher().getEndpoints(); numberOfAttempts++; - if (endpoints.size() == 0) { + if (endpoints.isEmpty()) { LOG.info("Found 0 endpoints - waiting {} seconds to make sure all endpoints have properly started", SLEEP_TIME_SECONDS); try { @@ -64,7 +64,7 @@ public void run() { e.printStackTrace(); } } - } while (endpoints.size() == 0 && numberOfAttempts < MAX_RETRIES); + } while (endpoints.isEmpty() && numberOfAttempts < MAX_RETRIES); LOG.info("Found {} endpoints from which we will install extensions.", endpoints.size()); LOG.info( "Further available extensions can always be installed by navigating to the 'Install pipeline elements' view"); diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/PipelineElementInstallationStep.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/PipelineElementInstallationStep.java index 319318eeb1..081379d3c0 100644 --- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/PipelineElementInstallationStep.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/PipelineElementInstallationStep.java @@ -23,12 +23,17 @@ import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpointItem; import org.apache.streampipes.model.message.Message; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.Collections; import java.util.List; public class PipelineElementInstallationStep extends InstallationStep { + private static final Logger LOG = LoggerFactory.getLogger(PipelineElementInstallationStep.class); + private final ExtensionsServiceEndpoint endpoint; private final String principalSid; @@ -42,6 +47,7 @@ public PipelineElementInstallationStep(ExtensionsServiceEndpoint endpoint, public void install() { List statusMessages = new ArrayList<>(); List items = Operations.getEndpointUriContents(Collections.singletonList(endpoint)); + LOG.info("Found {} endpoint items for endpoint {}", items.size(), endpoint.getEndpointUrl()); for (ExtensionsServiceEndpointItem item : items) { statusMessages.add(new EndpointItemParser().parseAndAddEndpointItem(item.getUri(), principalSid, true));