From dc19d8e16809912e9a1bb8098fbe6c6c44e1d3bc Mon Sep 17 00:00:00 2001 From: Jonathan Creasy Date: Wed, 21 Sep 2016 13:40:36 -0500 Subject: [PATCH] Disable Annotation RPC Fix #823 --- src/tools/CliOptions.java | 2 ++ src/tools/TSDMain.java | 2 ++ src/tsd/RpcManager.java | 11 ++++++++--- src/utils/Config.java | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/tools/CliOptions.java b/src/tools/CliOptions.java index a87c45a19f..1c13647387 100644 --- a/src/tools/CliOptions.java +++ b/src/tools/CliOptions.java @@ -124,6 +124,8 @@ static void overloadConfig(final ArgP argp, final Config config) { config.overrideConfig("tsd.core.enable_ui", "false"); } else if (entry.getKey().toLowerCase().equals("--disable-api")) { config.overrideConfig("tsd.core.enable_api", "false"); + } else if (entry.getKey().toLowerCase().equals("--disable-annotations")) { + config.overrideConfig("tsd.core.enable_annotations", "false"); } else if (entry.getKey().toLowerCase().equals("--table")) { config.overrideConfig("tsd.storage.hbase.data_table", entry.getValue()); } else if (entry.getKey().toLowerCase().equals("--uidtable")) { diff --git a/src/tools/TSDMain.java b/src/tools/TSDMain.java index a5bda860a0..5ece423922 100644 --- a/src/tools/TSDMain.java +++ b/src/tools/TSDMain.java @@ -97,6 +97,8 @@ public static void main(String[] args) throws IOException { "Set tsd.core.enable_ui to false (default true)"); argp.addOption("--disable-api", "true|false", "Set tsd.core.enable_api to false (default true)"); + argp.addOption("--disable-annotations", "true|false", + "Set tsd.core.enable_annotations to false (default true)"); argp.addOption("--backlog", "NUM", "Size of connection attempt queue (default: 3072 or kernel" + " somaxconn."); diff --git a/src/tsd/RpcManager.java b/src/tsd/RpcManager.java index 86638c1a12..64623fce37 100644 --- a/src/tsd/RpcManager.java +++ b/src/tsd/RpcManager.java @@ -254,6 +254,7 @@ private void initializeBuiltinRpcs(final String mode, final Boolean enableApi = tsdb.getConfig().getString("tsd.core.enable_api").equals("true"); final Boolean enableUi = tsdb.getConfig().getString("tsd.core.enable_ui").equals("true"); + final Boolean enableAnnotations = tsdb.getConfig().getString("tsd.core.enable_annotations").equals("true"); final Boolean enableDieDieDie = tsdb.getConfig().getString("tsd.no_diediedie").equals("false"); LOG.info("Mode: {}, HTTP UI Enabled: {}, HTTP API Enabled: {}", mode, enableUi, enableApi); @@ -272,7 +273,9 @@ private void initializeBuiltinRpcs(final String mode, final DropCachesRpc dropcaches = new DropCachesRpc(); final ListAggregators aggregators = new ListAggregators(); final SuggestRpc suggest_rpc = new SuggestRpc(); - final AnnotationRpc annotation_rpc = new AnnotationRpc(); + if (enableAnnotations) { + final AnnotationRpc annotation_rpc = new AnnotationRpc(); + } final Version version = new Version(); telnet.put("stats", stats); @@ -296,8 +299,10 @@ private void initializeBuiltinRpcs(final String mode, if (enableApi) { http.put("api/aggregators", aggregators); - http.put("api/annotation", annotation_rpc); - http.put("api/annotations", annotation_rpc); + if (enableAnnotations) { + http.put("api/annotation", annotation_rpc); + http.put("api/annotations", annotation_rpc); + } http.put("api/config", new ShowConfig()); http.put("api/dropcaches", dropcaches); http.put("api/query", new QueryRpc()); diff --git a/src/utils/Config.java b/src/utils/Config.java index 782bf36430..2d92d029cc 100644 --- a/src/utils/Config.java +++ b/src/utils/Config.java @@ -490,6 +490,7 @@ protected void setDefaults() { default_map.put("tsd.core.connections.limit", "0"); default_map.put("tsd.core.enable_api", "true"); default_map.put("tsd.core.enable_ui", "true"); + default_map.put("tsd.core.enable_annotations", "true"); default_map.put("tsd.core.meta.enable_realtime_ts", "false"); default_map.put("tsd.core.meta.enable_realtime_uid", "false"); default_map.put("tsd.core.meta.enable_tsuid_incrementing", "false");