You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2018/10/28 02:22:36 UTC

[incubator-skywalking] branch webapp/proxy created (now 1328d1a)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a change to branch webapp/proxy
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git.


      at 1328d1a  Add undefined node icon

This branch includes the following new commits:

     new 1d3b136  Remove backend service discovery
     new af6e1a7  Merge branch 'master' of https://github.com/apache/incubator-skywalking
     new 1328d1a  Add undefined node icon

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-skywalking] 02/03: Merge branch 'master' of https://github.com/apache/incubator-skywalking

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch webapp/proxy
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit af6e1a7d2da437e6dcd49d8228e8320c96fbf816
Merge: 1d3b136 b11d479
Author: gaohongtao <ha...@gmail.com>
AuthorDate: Sun Oct 28 10:17:55 2018 +0800

    Merge branch 'master' of https://github.com/apache/incubator-skywalking

 .../apm/commons/datacarrier/DataCarrier.java       |   6 +
 .../apm/commons/datacarrier/buffer/Buffer.java     |   6 +
 .../skywalking/apm/agent/core/conf/Config.java     |  18 ++-
 .../agent/core/conf/SnifferConfigInitializer.java  |  23 ++-
 .../core/dictionary/NetworkAddressDictionary.java  |   7 +-
 .../core/dictionary/OperationNameDictionary.java   |  11 ++
 .../apm/agent/core/listener/ResetConfListener.java |  84 +++++++++++
 .../apm/agent/core/listener/ResetStatus.java       |  35 +++++
 .../apm/agent/core/listener/Reseter.java           | 159 +++++++++++++++++++++
 .../core/remote/AppAndServiceRegisterClient.java   |  49 ++++---
 .../core/remote/TraceSegmentServiceClient.java     |   9 +-
 ...ache.skywalking.apm.agent.core.boot.BootService |   1 +
 .../apm/agent/core/boot/ServiceManagerTest.java    |   2 +-
 apm-sniffer/config/agent.config                    |   9 ++
 .../service/ServiceInstanceInventoryRegister.java  |   2 +-
 .../src/main/resources/query-protocol              |   2 +-
 .../register/provider/RegisterModuleProvider.java  |   7 -
 .../handler/v5/ServiceInstancePingPkgHandler.java  |  60 ++++++++
 18 files changed, 445 insertions(+), 45 deletions(-)


[incubator-skywalking] 03/03: Add undefined node icon

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch webapp/proxy
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 1328d1acadab545f8225a4c4a0f7cbbdfab5330a
Author: gaohongtao <ha...@gmail.com>
AuthorDate: Sun Oct 28 10:20:03 2018 +0800

    Add undefined node icon
---
 .../apm/webapp/proxy/CollectorServerList.java      | 69 ----------------
 .../skywalking/apm/webapp/proxy/MvcConfig.java     | 67 +++++++++++++++
 apm-webapp/src/main/resources/application.yml      |  5 +-
 .../apm/webapp/proxy/NIWSServerListTest.java       | 95 ----------------------
 4 files changed, 71 insertions(+), 165 deletions(-)

diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java
deleted file mode 100644
index 5babc5f..0000000
--- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.apm.webapp.proxy;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.netflix.client.config.CommonClientConfigKey;
-import com.netflix.client.config.IClientConfig;
-import com.netflix.loadbalancer.AbstractServerList;
-import com.netflix.loadbalancer.Server;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-public class CollectorServerList extends AbstractServerList<Server> {
-    
-    private IClientConfig clientConfig;
-
-    public List<Server> getInitialListOfServers() {
-        return fetchServer();
-    }
-
-    public List<Server> getUpdatedListOfServers() {
-        return fetchServer();
-    }
-
-    public void initWithNiwsConfig(IClientConfig clientConfig) {
-        this.clientConfig = clientConfig;
-    }
-
-    protected List<Server> derive(String value) {
-        List<Server> list = Lists.newArrayList();
-        if (Strings.isNullOrEmpty(value)) {
-            return list;
-        }
-        String[] serverArray = value.split(",");
-        for (String s : serverArray) {
-            list.add(new Server(s.trim()));
-        }
-        return list;
-    }
-
-    private List<Server> fetchServer() {
-        return derive(this.clientConfig.get(CommonClientConfigKey.ListOfServers));
-    }
-}
diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java
new file mode 100644
index 0000000..81c40ba
--- /dev/null
+++ b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.webapp.proxy;
+
+import java.io.IOException;
+import java.util.Arrays;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.resource.PathResourceResolver;
+
+/**
+ * Additional MVC Configuration.
+ * 
+ * @author gaohongtao
+ */
+@Configuration
+@EnableWebMvc
+public class MvcConfig extends WebMvcConfigurerAdapter {
+    @Override
+    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
+        registry
+            .addResourceHandler("/**")
+            .addResourceLocations("classpath:/public/")
+            .setCachePeriod(3600)
+            .resourceChain(true)
+            .addResolver(new PathResourceResolver() {
+                @Override protected Resource getResource(String resourcePath, Resource location) throws IOException {
+                    Resource raw =  super.getResource(resourcePath, location);
+                    if (raw != null || !resourcePath.startsWith("img/node")) {
+                        return raw;
+                    }
+                    Resource resource = location.createRelative("img/node/UNDEFINED.png");
+                    if (!resource.exists() || !resource.isReadable()) {
+                        return null;
+                    }
+                    if (this.checkResource(resource, location)) {
+                        return resource;
+                    }
+
+                    if (this.logger.isTraceEnabled()) {
+                        Resource[] allowedLocations = this.getAllowedLocations();
+                        this.logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved but resource \"" + resource.getURL() + "\" is neither under the current location \"" + location.getURL() + "\" nor under any of the allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]"));
+                    }
+                    return null;
+                }
+            });
+    }
+}
\ No newline at end of file
diff --git a/apm-webapp/src/main/resources/application.yml b/apm-webapp/src/main/resources/application.yml
index c7aa9f4..aa9dde8 100644
--- a/apm-webapp/src/main/resources/application.yml
+++ b/apm-webapp/src/main/resources/application.yml
@@ -16,6 +16,7 @@
 
 server:
   port: 8080
+
 zuul:
   ignoredServices: '*'
   routes:
@@ -27,9 +28,11 @@ collector:
   path: /graphql
   ribbon:
     listOfServers: 127.0.0.1:10800
-    NIWSServerListClassName: org.apache.skywalking.apm.webapp.proxy.CollectorServerList
 
 security:
   user:
     admin:
       password: admin
+logging:
+  config: classpath
+      
diff --git a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/proxy/NIWSServerListTest.java b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/proxy/NIWSServerListTest.java
deleted file mode 100644
index 38748ce..0000000
--- a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/proxy/NIWSServerListTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.apm.webapp.proxy;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.Environment;
-import org.springframework.core.env.MapPropertySource;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.netflix.loadbalancer.Server;
-import com.netflix.loadbalancer.ServerList;
-import com.netflix.loadbalancer.ZoneAwareLoadBalancer;
-import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest
-@DirtiesContext
-public class NIWSServerListTest {
-    @Autowired
-    private Environment env;
-
-    @Autowired
-    private SpringClientFactory factory;
-
-    private Map<String, String> serverListClassNames = new HashMap<String, String>();
-
-    @Before
-    public void initServerListClassNames() {
-        for (Iterator<?> iter = ((AbstractEnvironment) env).getPropertySources().iterator(); iter.hasNext();) {
-            Object propertySource = iter.next();
-            if (propertySource instanceof MapPropertySource) {
-                Map<String, Object> mapPropertySource = ((MapPropertySource) propertySource).getSource();
-                for (Map.Entry<String, Object> entry : mapPropertySource.entrySet()) {
-                    String key = entry.getKey();
-                    int index;
-                    if (key.endsWith(".NIWSServerListClassName") &&
-                            (index = key.indexOf(".ribbon")) > 0) {
-                        String clientName = key.substring(0, index);
-                        serverListClassNames.put(clientName,(String)entry.getValue());
-                    }
-                }
-            }
-        }
-    }
-
-    @Test
-    public void serverListClass() throws ClassNotFoundException {
-        for (String serverListClassName : serverListClassNames.values()) {
-            Class<?> clazz = Class.forName(serverListClassName);
-        }
-    }
-
-    @Test
-    public void serverListFliter() {
-        for (Map.Entry<String, String> entry : serverListClassNames.entrySet()) {
-            String clientName = entry.getKey();
-            String serverListClassName = entry.getValue();
-            ServerList<Server> serverList = getLoadBalancer(clientName).getServerListImpl();
-            assertNotNull("Client: " + clientName + "'s ServerListImpl is null",serverList);
-            assertEquals("Clinet: " + clientName + "'s ServerListImpl not Same with setting in configs",
-                    serverListClassName, serverList.getClass().getName());
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private ZoneAwareLoadBalancer<Server> getLoadBalancer(String name) {
-        return (ZoneAwareLoadBalancer<Server>)this.factory.getLoadBalancer(name);
-    }
-}


[incubator-skywalking] 01/03: Remove backend service discovery

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch webapp/proxy
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 1d3b1362ef2a825c8663bc3172584de36ae77221
Author: gaohongtao <ha...@gmail.com>
AuthorDate: Sat Oct 27 21:26:48 2018 +0800

    Remove backend service discovery
---
 .../apm/webapp/proxy/CollectorServerList.java      | 24 ++--------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java
index 2df2b0d..5babc5f 100644
--- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java
+++ b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/CollectorServerList.java
@@ -36,12 +36,7 @@ import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
 
 public class CollectorServerList extends AbstractServerList<Server> {
-    private static final Logger logger = LoggerFactory.getLogger(CollectorServerList.class);
-
-    private final CopyOnWriteArrayList<Server> servers = new CopyOnWriteArrayList<>();
-
-    private final Gson gson = new Gson();
-
+    
     private IClientConfig clientConfig;
 
     public List<Server> getInitialListOfServers() {
@@ -69,21 +64,6 @@ public class CollectorServerList extends AbstractServerList<Server> {
     }
 
     private List<Server> fetchServer() {
-        for (Server server : derive(this.clientConfig.get(CommonClientConfigKey.ListOfServers))) {
-            try {
-                String uiServerResponse = HttpClientTools.INSTANCE.get("http://" + server.getHostPort() + "/ui/jetty", null);
-                logger.debug("uiServerResponse: {}", uiServerResponse);
-                JsonArray serverArray = gson.fromJson(uiServerResponse, JsonArray.class);
-                if (serverArray == null || serverArray.size() == 0) {
-                    logger.warn("emtry grpc server array, skip : {}", server);
-                    continue;
-                }
-                return Lists.newArrayList(StreamSupport.stream(serverArray.spliterator(), false).map(f -> new Server(f.getAsString())).collect(Collectors.toList()));
-            } catch (IOException e) {
-                logger.error(e.getMessage(), e);
-            }
-        }
-        logger.warn("none agentstream server return available grpc server.");
-        return servers;
+        return derive(this.clientConfig.get(CommonClientConfigKey.ListOfServers));
     }
 }