You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/04/01 06:27:11 UTC

[skywalking] branch master updated: Append the root slash(/) to getIndex and getTemplate requests in ES client (#6663)

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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new b8a040e  Append the root slash(/) to getIndex and getTemplate requests in ES client (#6663)
b8a040e is described below

commit b8a040ea74e3197c3f693122f8ee3a33b444ef46
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Apr 1 14:26:57 2021 +0800

    Append the root slash(/) to getIndex and getTemplate requests in ES client (#6663)
    
    * Append the root slash(/) to getIndex and getTemplate requests
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
    
    * Document this bug
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 CHANGES.md                                                            | 1 +
 .../oap/server/library/client/elasticsearch/ElasticSearchClient.java  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index dc5441e..f7dedb5 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -65,6 +65,7 @@ Release Notes.
 * Add function `retagByK8sMeta` and opt type `K8sRetagType.Pod2Service` in MAL for k8s to relate pods and services.
 * Fix ALS K8SServiceRegistry didn't remove the correct entry.
 * Using "service.istio.io/canonical-name" to replace "app" label to resolve Envoy ALS service name
+* Append the root slash(/) to getIndex and getTemplate requests in ES client
 
 #### UI
 * Update selector scroller to show in all pages.
diff --git a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java
index 9f215c3..503fa30 100644
--- a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java
+++ b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java
@@ -234,7 +234,7 @@ public class ElasticSearchClient implements Client, HealthCheckable {
         indexName = formatIndexName(indexName);
         try {
             Response response = client.getLowLevelClient()
-                                      .performRequest(HttpGet.METHOD_NAME, indexName);
+                                      .performRequest(HttpGet.METHOD_NAME, "/" + indexName);
             int statusCode = response.getStatusLine().getStatusCode();
             if (statusCode != HttpStatus.SC_OK) {
                 healthChecker.health();
@@ -341,7 +341,7 @@ public class ElasticSearchClient implements Client, HealthCheckable {
         name = formatIndexName(name);
         try {
             Response response = client.getLowLevelClient()
-                                      .performRequest(HttpGet.METHOD_NAME, "_template/" + name);
+                                      .performRequest(HttpGet.METHOD_NAME, "/_template/" + name);
             int statusCode = response.getStatusLine().getStatusCode();
             if (statusCode != HttpStatus.SC_OK) {
                 healthChecker.health();