id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
13,400
OpenTSDB/opentsdb
src/utils/Config.java
Config.overrideConfig
public void overrideConfig(final String property, final String value) { properties.put(property, value); loadStaticVariables(); }
java
public void overrideConfig(final String property, final String value) { properties.put(property, value); loadStaticVariables(); }
[ "public", "void", "overrideConfig", "(", "final", "String", "property", ",", "final", "String", "value", ")", "{", "properties", ".", "put", "(", "property", ",", "value", ")", ";", "loadStaticVariables", "(", ")", ";", "}" ]
Allows for modifying properties after creation or loading. WARNING: This should only be used on initialization and is meant for command line overrides. Also note that it will reset all static config variables when called. @param property The name of the property to override @param value The value to store
[ "Allows", "for", "modifying", "properties", "after", "creation", "or", "loading", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L317-L320
13,401
OpenTSDB/opentsdb
src/utils/Config.java
Config.getBoolean
public final boolean getBoolean(final String property) { final String val = properties.get(property).trim().toUpperCase(); if (val.equals("1")) return true; if (val.equals("TRUE")) return true; if (val.equals("YES")) return true; return false; }
java
public final boolean getBoolean(final String property) { final String val = properties.get(property).trim().toUpperCase(); if (val.equals("1")) return true; if (val.equals("TRUE")) return true; if (val.equals("YES")) return true; return false; }
[ "public", "final", "boolean", "getBoolean", "(", "final", "String", "property", ")", "{", "final", "String", "val", "=", "properties", ".", "get", "(", "property", ")", ".", "trim", "(", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "val", ".", ...
Returns the given property as a boolean Property values are case insensitive and the following values will result in a True return value: - 1 - True - Yes Any other values, including an empty string, will result in a False @param property The property to load @return A parsed boolean @throws NullPointerException if ...
[ "Returns", "the", "given", "property", "as", "a", "boolean" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L412-L421
13,402
OpenTSDB/opentsdb
src/utils/Config.java
Config.getDirectoryName
public final String getDirectoryName(final String property) { String directory = properties.get(property); if (directory == null || directory.isEmpty()){ return null; } if (IS_WINDOWS) { // Windows swings both ways. If a forward slash was already used, we'll // add one at the end if mi...
java
public final String getDirectoryName(final String property) { String directory = properties.get(property); if (directory == null || directory.isEmpty()){ return null; } if (IS_WINDOWS) { // Windows swings both ways. If a forward slash was already used, we'll // add one at the end if mi...
[ "public", "final", "String", "getDirectoryName", "(", "final", "String", "property", ")", "{", "String", "directory", "=", "properties", ".", "get", "(", "property", ")", ";", "if", "(", "directory", "==", "null", "||", "directory", ".", "isEmpty", "(", ")...
Returns the directory name, making sure the end is an OS dependent slash @param property The property to load @return The property value with a forward or back slash appended or null if the property wasn't found or the directory was empty.
[ "Returns", "the", "directory", "name", "making", "sure", "the", "end", "is", "an", "OS", "dependent", "slash" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L429-L459
13,403
OpenTSDB/opentsdb
src/utils/Config.java
Config.hasProperty
public final boolean hasProperty(final String property) { final String val = properties.get(property); if (val == null) return false; if (val.isEmpty()) return false; return true; }
java
public final boolean hasProperty(final String property) { final String val = properties.get(property); if (val == null) return false; if (val.isEmpty()) return false; return true; }
[ "public", "final", "boolean", "hasProperty", "(", "final", "String", "property", ")", "{", "final", "String", "val", "=", "properties", ".", "get", "(", "property", ")", ";", "if", "(", "val", "==", "null", ")", "return", "false", ";", "if", "(", "val"...
Determines if the given propery is in the map @param property The property to search for @return True if the property exists and has a value, not an empty string
[ "Determines", "if", "the", "given", "propery", "is", "in", "the", "map" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L466-L473
13,404
OpenTSDB/opentsdb
src/utils/Config.java
Config.dumpConfiguration
public final String dumpConfiguration() { if (properties.isEmpty()) return "No configuration settings stored"; StringBuilder response = new StringBuilder("TSD Configuration:\n"); response.append("File [" + config_location + "]\n"); int line = 0; for (Map.Entry<String, String> entry : properti...
java
public final String dumpConfiguration() { if (properties.isEmpty()) return "No configuration settings stored"; StringBuilder response = new StringBuilder("TSD Configuration:\n"); response.append("File [" + config_location + "]\n"); int line = 0; for (Map.Entry<String, String> entry : properti...
[ "public", "final", "String", "dumpConfiguration", "(", ")", "{", "if", "(", "properties", ".", "isEmpty", "(", ")", ")", "return", "\"No configuration settings stored\"", ";", "StringBuilder", "response", "=", "new", "StringBuilder", "(", "\"TSD Configuration:\\n\"", ...
Returns a simple string with the configured properties for debugging @return A string with information about the config
[ "Returns", "a", "simple", "string", "with", "the", "configured", "properties", "for", "debugging" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L479-L500
13,405
OpenTSDB/opentsdb
src/utils/Config.java
Config.loadConfig
protected void loadConfig() throws IOException { if (config_location != null && !config_location.isEmpty()) { loadConfig(config_location); return; } final ArrayList<String> file_locations = new ArrayList<String>(); // search locally first file_locations.add("opentsdb.conf"); // ad...
java
protected void loadConfig() throws IOException { if (config_location != null && !config_location.isEmpty()) { loadConfig(config_location); return; } final ArrayList<String> file_locations = new ArrayList<String>(); // search locally first file_locations.add("opentsdb.conf"); // ad...
[ "protected", "void", "loadConfig", "(", ")", "throws", "IOException", "{", "if", "(", "config_location", "!=", "null", "&&", "!", "config_location", ".", "isEmpty", "(", ")", ")", "{", "loadConfig", "(", "config_location", ")", ";", "return", ";", "}", "fi...
Searches a list of locations for a valid opentsdb.conf file The config file must be a standard JAVA properties formatted file. If none of the locations have a config file, then the defaults or command line arguments will be used for the configuration Defaults for Linux based systems are: ./opentsdb.conf /etc/opentsdb...
[ "Searches", "a", "list", "of", "locations", "for", "a", "valid", "opentsdb", ".", "conf", "file" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L645-L687
13,406
OpenTSDB/opentsdb
src/utils/Config.java
Config.loadConfig
protected void loadConfig(final String file) throws FileNotFoundException, IOException { final FileInputStream file_stream = new FileInputStream(file); try { final Properties props = new Properties(); props.load(file_stream); // load the hash map loadHashMap(props); // no e...
java
protected void loadConfig(final String file) throws FileNotFoundException, IOException { final FileInputStream file_stream = new FileInputStream(file); try { final Properties props = new Properties(); props.load(file_stream); // load the hash map loadHashMap(props); // no e...
[ "protected", "void", "loadConfig", "(", "final", "String", "file", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "final", "FileInputStream", "file_stream", "=", "new", "FileInputStream", "(", "file", ")", ";", "try", "{", "final", "Properties", ...
Attempts to load the configuration from the given location @param file Path to the file to load @throws IOException Thrown if there was an issue reading the file @throws FileNotFoundException Thrown if the config file was not found
[ "Attempts", "to", "load", "the", "configuration", "from", "the", "given", "location" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L695-L711
13,407
OpenTSDB/opentsdb
src/utils/Config.java
Config.loadStaticVariables
public void loadStaticVariables() { auto_metric = this.getBoolean("tsd.core.auto_create_metrics"); auto_tagk = this.getBoolean("tsd.core.auto_create_tagks"); auto_tagv = this.getBoolean("tsd.core.auto_create_tagvs"); enable_compactions = this.getBoolean("tsd.storage.enable_compaction"); enable_appen...
java
public void loadStaticVariables() { auto_metric = this.getBoolean("tsd.core.auto_create_metrics"); auto_tagk = this.getBoolean("tsd.core.auto_create_tagks"); auto_tagv = this.getBoolean("tsd.core.auto_create_tagvs"); enable_compactions = this.getBoolean("tsd.storage.enable_compaction"); enable_appen...
[ "public", "void", "loadStaticVariables", "(", ")", "{", "auto_metric", "=", "this", ".", "getBoolean", "(", "\"tsd.core.auto_create_metrics\"", ")", ";", "auto_tagk", "=", "this", ".", "getBoolean", "(", "\"tsd.core.auto_create_tagks\"", ")", ";", "auto_tagv", "=", ...
Loads the static class variables for values that are called often. This should be called any time the configuration changes.
[ "Loads", "the", "static", "class", "variables", "for", "values", "that", "are", "called", "often", ".", "This", "should", "be", "called", "any", "time", "the", "configuration", "changes", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L717-L743
13,408
OpenTSDB/opentsdb
src/tsd/client/QueryString.java
QueryString.add
public void add(final String name, final String value) { ArrayList<String> values = super.get(name); if (values == null) { values = new ArrayList<String>(1); // Often there's only 1 value. super.put(name, values); } values.add(value); }
java
public void add(final String name, final String value) { ArrayList<String> values = super.get(name); if (values == null) { values = new ArrayList<String>(1); // Often there's only 1 value. super.put(name, values); } values.add(value); }
[ "public", "void", "add", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "ArrayList", "<", "String", ">", "values", "=", "super", ".", "get", "(", "name", ")", ";", "if", "(", "values", "==", "null", ")", "{", "values", "...
Adds a query string element. @param name The name of the element. @param value The value of the element.
[ "Adds", "a", "query", "string", "element", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/QueryString.java#L73-L80
13,409
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatPutV1
public ChannelBuffer formatPutV1(final Map<String, Object> results) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatPutV1"); }
java
public ChannelBuffer formatPutV1(final Map<String, Object> results) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatPutV1"); }
[ "public", "ChannelBuffer", "formatPutV1", "(", "final", "Map", "<", "String", ",", "Object", ">", "results", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"",...
Formats the results of an HTTP data point storage request @param results A map of results. The map will consist of: <ul><li>success - (long) the number of successfully parsed datapoints</li> <li>failed - (long) the number of datapoint parsing failures</li> <li>errors - (ArrayList&lt;HashMap&lt;String, Object&gt;&gt;) a...
[ "Formats", "the", "results", "of", "an", "HTTP", "data", "point", "storage", "request" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L392-L397
13,410
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatSuggestV1
public ChannelBuffer formatSuggestV1(final List<String> suggestions) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatSuggestV1"); }
java
public ChannelBuffer formatSuggestV1(final List<String> suggestions) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatSuggestV1"); }
[ "public", "ChannelBuffer", "formatSuggestV1", "(", "final", "List", "<", "String", ">", "suggestions", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",", ...
Formats a suggestion response @param suggestions List of suggestions for the given type @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Formats", "a", "suggestion", "response" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L405-L410
13,411
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatAggregatorsV1
public ChannelBuffer formatAggregatorsV1(final Set<String> aggregators) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatAggregatorsV1"); }
java
public ChannelBuffer formatAggregatorsV1(final Set<String> aggregators) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatAggregatorsV1"); }
[ "public", "ChannelBuffer", "formatAggregatorsV1", "(", "final", "Set", "<", "String", ">", "aggregators", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",",...
Format the list of implemented aggregators @param aggregators The list of aggregation functions @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "the", "list", "of", "implemented", "aggregators" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L430-L435
13,412
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatVersionV1
public ChannelBuffer formatVersionV1(final Map<String, String> version) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatVersionV1"); }
java
public ChannelBuffer formatVersionV1(final Map<String, String> version) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatVersionV1"); }
[ "public", "ChannelBuffer", "formatVersionV1", "(", "final", "Map", "<", "String", ",", "String", ">", "version", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented...
Format a hash map of information about the OpenTSDB version @param version A hash map with version information @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "hash", "map", "of", "information", "about", "the", "OpenTSDB", "version" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L443-L448
13,413
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatDropCachesV1
public ChannelBuffer formatDropCachesV1(final Map<String, String> response) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatDropCachesV1"); }
java
public ChannelBuffer formatDropCachesV1(final Map<String, String> response) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatDropCachesV1"); }
[ "public", "ChannelBuffer", "formatDropCachesV1", "(", "final", "Map", "<", "String", ",", "String", ">", "response", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been impleme...
Format a response from the DropCaches call @param response A hash map with a response @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "response", "from", "the", "DropCaches", "call" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L456-L461
13,414
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatLastPointQueryV1
public ChannelBuffer formatLastPointQueryV1( final List<IncomingDataPoint> data_points) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatLastPoi...
java
public ChannelBuffer formatLastPointQueryV1( final List<IncomingDataPoint> data_points) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatLastPoi...
[ "public", "ChannelBuffer", "formatLastPointQueryV1", "(", "final", "List", "<", "IncomingDataPoint", ">", "data_points", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been impleme...
Format a list of last data points @param data_points The results of the query @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "list", "of", "last", "data", "points" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L531-L537
13,415
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatTSMetaListV1
public ChannelBuffer formatTSMetaListV1(final List<TSMeta> metas) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatTSMetaV1"); }
java
public ChannelBuffer formatTSMetaListV1(final List<TSMeta> metas) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatTSMetaV1"); }
[ "public", "ChannelBuffer", "formatTSMetaListV1", "(", "final", "List", "<", "TSMeta", ">", "metas", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",", "th...
Format a a list of TSMeta objects @param metas The list of TSMeta objects to serialize @return A JSON structure @throws JSONException if serialization failed
[ "Format", "a", "a", "list", "of", "TSMeta", "objects" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L571-L576
13,416
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatTreesV1
public ChannelBuffer formatTreesV1(final List<Tree> trees) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatTreesV1"); }
java
public ChannelBuffer formatTreesV1(final List<Tree> trees) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatTreesV1"); }
[ "public", "ChannelBuffer", "formatTreesV1", "(", "final", "List", "<", "Tree", ">", "trees", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",", "this", ...
Format a list of tree objects. Note that the list may be empty if no trees were present. @param trees A list of one or more trees to serialize @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "list", "of", "tree", "objects", ".", "Note", "that", "the", "list", "may", "be", "empty", "if", "no", "trees", "were", "present", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L611-L616
13,417
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatTreeCollisionNotMatchedV1
public ChannelBuffer formatTreeCollisionNotMatchedV1( final Map<String, String> results, final boolean is_collisions) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has...
java
public ChannelBuffer formatTreeCollisionNotMatchedV1( final Map<String, String> results, final boolean is_collisions) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has...
[ "public", "ChannelBuffer", "formatTreeCollisionNotMatchedV1", "(", "final", "Map", "<", "String", ",", "String", ">", "results", ",", "final", "boolean", "is_collisions", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED...
Format a map of one or more TSUIDs that collided or were not matched @param results The list of results. Collisions: key = tsuid, value = collided TSUID. Not Matched: key = tsuid, value = message about non matched rules. @param is_collisions Whether or the map is a collision result set (true) or a not matched set (fals...
[ "Format", "a", "map", "of", "one", "or", "more", "TSUIDs", "that", "collided", "or", "were", "not", "matched" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L641-L647
13,418
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatAnnotationsV1
public ChannelBuffer formatAnnotationsV1(final List<Annotation> notes) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatAnnotationsV1"); }
java
public ChannelBuffer formatAnnotationsV1(final List<Annotation> notes) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatAnnotationsV1"); }
[ "public", "ChannelBuffer", "formatAnnotationsV1", "(", "final", "List", "<", "Annotation", ">", "notes", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",", ...
Format a list of annotation objects @param notes The annotation objects to format @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "list", "of", "annotation", "objects" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L685-L690
13,419
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatStatsV1
public ChannelBuffer formatStatsV1(final List<IncomingDataPoint> stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatStatsV1"); }
java
public ChannelBuffer formatStatsV1(final List<IncomingDataPoint> stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatStatsV1"); }
[ "public", "ChannelBuffer", "formatStatsV1", "(", "final", "List", "<", "IncomingDataPoint", ">", "stats", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",",...
Format a list of statistics @param stats The statistics list to format @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method
[ "Format", "a", "list", "of", "statistics" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L712-L717
13,420
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatThreadStatsV1
public ChannelBuffer formatThreadStatsV1(final List<Map<String, Object>> stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatThreadStatsV1"); }
java
public ChannelBuffer formatThreadStatsV1(final List<Map<String, Object>> stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatThreadStatsV1"); }
[ "public", "ChannelBuffer", "formatThreadStatsV1", "(", "final", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "stats", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoin...
Format a list of thread statistics @param stats The thread statistics list to format @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method @since 2.2
[ "Format", "a", "list", "of", "thread", "statistics" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L726-L731
13,421
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatQueryStatsV1
public ChannelBuffer formatQueryStatsV1(final Map<String, Object> query_stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatQueryStatsV1"); }
java
public ChannelBuffer formatQueryStatsV1(final Map<String, Object> query_stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatQueryStatsV1"); }
[ "public", "ChannelBuffer", "formatQueryStatsV1", "(", "final", "Map", "<", "String", ",", "Object", ">", "query_stats", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been impl...
Format the query stats @param query_stats Map of query statistics @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method @since 2.2
[ "Format", "the", "query", "stats" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L768-L773
13,422
OpenTSDB/opentsdb
src/utils/DateTime.java
DateTime.getDurationUnits
public static final String getDurationUnits(final String duration) { if (duration == null || duration.isEmpty()) { throw new IllegalArgumentException("Duration cannot be null or empty"); } int unit = 0; while (unit < duration.length() && Character.isDigit(duration.charAt(unit))) { u...
java
public static final String getDurationUnits(final String duration) { if (duration == null || duration.isEmpty()) { throw new IllegalArgumentException("Duration cannot be null or empty"); } int unit = 0; while (unit < duration.length() && Character.isDigit(duration.charAt(unit))) { u...
[ "public", "static", "final", "String", "getDurationUnits", "(", "final", "String", "duration", ")", "{", "if", "(", "duration", "==", "null", "||", "duration", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Duration can...
Returns the suffix or "units" of the duration as a string. The result will be ms, s, m, h, d, w, n or y. @param duration The duration in the format #units, e.g. 1d or 6h @return Just the suffix, e.g. 'd' or 'h' @throws IllegalArgumentException if the duration is null, empty or if the units are invalid. @since 2.4
[ "Returns", "the", "suffix", "or", "units", "of", "the", "duration", "as", "a", "string", ".", "The", "result", "will", "be", "ms", "s", "m", "h", "d", "w", "n", "or", "y", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/DateTime.java#L237-L253
13,423
OpenTSDB/opentsdb
src/utils/DateTime.java
DateTime.getDurationInterval
public static final int getDurationInterval(final String duration) { if (duration == null || duration.isEmpty()) { throw new IllegalArgumentException("Duration cannot be null or empty"); } if (duration.contains(".")) { throw new IllegalArgumentException("Floating point intervals are not supporte...
java
public static final int getDurationInterval(final String duration) { if (duration == null || duration.isEmpty()) { throw new IllegalArgumentException("Duration cannot be null or empty"); } if (duration.contains(".")) { throw new IllegalArgumentException("Floating point intervals are not supporte...
[ "public", "static", "final", "int", "getDurationInterval", "(", "final", "String", "duration", ")", "{", "if", "(", "duration", "==", "null", "||", "duration", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Duration can...
Parses the prefix of the duration, the interval and returns it as a number. E.g. if you supply "1d" it will return "1". If you supply "60m" it will return "60". @param duration The duration to parse in the format #units, e.g. "1d" or "60m" @return The interval as an integer, regardless of units. @throws IllegalArgument...
[ "Parses", "the", "prefix", "of", "the", "duration", "the", "interval", "and", "returns", "it", "as", "a", "number", ".", "E", ".", "g", ".", "if", "you", "supply", "1d", "it", "will", "return", "1", ".", "If", "you", "supply", "60m", "it", "will", ...
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/DateTime.java#L265-L286
13,424
OpenTSDB/opentsdb
src/utils/DateTime.java
DateTime.setTimeZone
public static void setTimeZone(final SimpleDateFormat fmt, final String tzname) { if (tzname == null) { return; // Use the default timezone. } final TimeZone tz = DateTime.timezones.get(tzname); if (tz != null) { fmt.setTimeZone(tz); } else { thro...
java
public static void setTimeZone(final SimpleDateFormat fmt, final String tzname) { if (tzname == null) { return; // Use the default timezone. } final TimeZone tz = DateTime.timezones.get(tzname); if (tz != null) { fmt.setTimeZone(tz); } else { thro...
[ "public", "static", "void", "setTimeZone", "(", "final", "SimpleDateFormat", "fmt", ",", "final", "String", "tzname", ")", "{", "if", "(", "tzname", "==", "null", ")", "{", "return", ";", "// Use the default timezone.", "}", "final", "TimeZone", "tz", "=", "...
Applies the given timezone to the given date format. @param fmt Date format to apply the timezone to. @param tzname Name of the timezone, or {@code null} in which case this function is a no-op. @throws IllegalArgumentException if tzname isn't a valid timezone name. @throws NullPointerException if the format is null
[ "Applies", "the", "given", "timezone", "to", "the", "given", "date", "format", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/DateTime.java#L312-L323
13,425
OpenTSDB/opentsdb
src/utils/DateTime.java
DateTime.msFromNanoDiff
public static double msFromNanoDiff(final long end, final long start) { if (end < start) { throw new IllegalArgumentException("End (" + end + ") cannot be less " + "than start (" + start + ")"); } return ((double) end - (double) start) / 1000000; }
java
public static double msFromNanoDiff(final long end, final long start) { if (end < start) { throw new IllegalArgumentException("End (" + end + ") cannot be less " + "than start (" + start + ")"); } return ((double) end - (double) start) / 1000000; }
[ "public", "static", "double", "msFromNanoDiff", "(", "final", "long", "end", ",", "final", "long", "start", ")", "{", "if", "(", "end", "<", "start", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"End (\"", "+", "end", "+", "\") cannot be less...
Calculates the difference between two values and returns the time in milliseconds as a double. @param end The end timestamp @param start The start timestamp @return The value in milliseconds @throws IllegalArgumentException if end is less than start @since 2.2
[ "Calculates", "the", "difference", "between", "two", "values", "and", "returns", "the", "time", "in", "milliseconds", "as", "a", "double", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/DateTime.java#L385-L391
13,426
OpenTSDB/opentsdb
src/utils/DateTime.java
DateTime.unitsToCalendarType
public static int unitsToCalendarType(final String units) { if (units == null || units.isEmpty()) { throw new IllegalArgumentException("Units cannot be null or empty"); } final String lc = units.toLowerCase(); if (lc.equals("ms")) { return Calendar.MILLISECOND; } else if (lc.equals(...
java
public static int unitsToCalendarType(final String units) { if (units == null || units.isEmpty()) { throw new IllegalArgumentException("Units cannot be null or empty"); } final String lc = units.toLowerCase(); if (lc.equals("ms")) { return Calendar.MILLISECOND; } else if (lc.equals(...
[ "public", "static", "int", "unitsToCalendarType", "(", "final", "String", "units", ")", "{", "if", "(", "units", "==", "null", "||", "units", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Units cannot be null or empty\""...
Return the proper Calendar time unit as an integer given the string @param units The unit to parse @return An integer matching a Calendar.&lt;UNIT&gt; enum @throws IllegalArgumentException if the unit is null, empty or doesn't match one of the configured units. @since 2.3
[ "Return", "the", "proper", "Calendar", "time", "unit", "as", "an", "integer", "given", "the", "string" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/DateTime.java#L616-L640
13,427
OpenTSDB/opentsdb
src/query/pojo/Output.java
Output.validate
@Override public void validate() { if (id == null || id.isEmpty()) { throw new IllegalArgumentException("missing or empty id"); } Query.validateId(id); }
java
@Override public void validate() { if (id == null || id.isEmpty()) { throw new IllegalArgumentException("missing or empty id"); } Query.validateId(id); }
[ "@", "Override", "public", "void", "validate", "(", ")", "{", "if", "(", "id", "==", "null", "||", "id", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"missing or empty id\"", ")", ";", "}", "Query", ".", "validat...
Validates the output @throws IllegalArgumentException if one or more parameters were invalid
[ "Validates", "the", "output" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/pojo/Output.java#L61-L66
13,428
OpenTSDB/opentsdb
src/core/Aggregators.java
Aggregators.get
public static Aggregator get(final String name) { final Aggregator agg = aggregators.get(name); if (agg != null) { return agg; } throw new NoSuchElementException("No such aggregator: " + name); }
java
public static Aggregator get(final String name) { final Aggregator agg = aggregators.get(name); if (agg != null) { return agg; } throw new NoSuchElementException("No such aggregator: " + name); }
[ "public", "static", "Aggregator", "get", "(", "final", "String", "name", ")", "{", "final", "Aggregator", "agg", "=", "aggregators", ".", "get", "(", "name", ")", ";", "if", "(", "agg", "!=", "null", ")", "{", "return", "agg", ";", "}", "throw", "new...
Returns the aggregator corresponding to the given name. @param name The name of the aggregator to get. @throws NoSuchElementException if the given name doesn't exist. @see #set
[ "Returns", "the", "aggregator", "corresponding", "to", "the", "given", "name", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Aggregators.java#L222-L228
13,429
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.delete
public Deferred<Object> delete(final TSDB tsdb) { if (start_time < 1) { throw new IllegalArgumentException("The start timestamp has not been set"); } final byte[] tsuid_byte = tsuid != null && !tsuid.isEmpty() ? UniqueId.stringToUid(tsuid) : null; final DeleteRequest delete = new Del...
java
public Deferred<Object> delete(final TSDB tsdb) { if (start_time < 1) { throw new IllegalArgumentException("The start timestamp has not been set"); } final byte[] tsuid_byte = tsuid != null && !tsuid.isEmpty() ? UniqueId.stringToUid(tsuid) : null; final DeleteRequest delete = new Del...
[ "public", "Deferred", "<", "Object", ">", "delete", "(", "final", "TSDB", "tsdb", ")", "{", "if", "(", "start_time", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The start timestamp has not been set\"", ")", ";", "}", "final", "byte"...
Attempts to mark an Annotation object for deletion. Note that if the annoation does not exist in storage, this delete call will not throw an error. @param tsdb The TSDB to use for storage access @return A meaningless Deferred for the caller to wait on until the call is complete. The value may be null.
[ "Attempts", "to", "mark", "an", "Annotation", "object", "for", "deletion", ".", "Note", "that", "if", "the", "annoation", "does", "not", "exist", "in", "storage", "this", "delete", "call", "will", "not", "throw", "an", "error", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L212-L223
13,430
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.getAnnotation
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final long start_time) { return getAnnotation(tsdb, (byte[])null, start_time); }
java
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final long start_time) { return getAnnotation(tsdb, (byte[])null, start_time); }
[ "public", "static", "Deferred", "<", "Annotation", ">", "getAnnotation", "(", "final", "TSDB", "tsdb", ",", "final", "long", "start_time", ")", "{", "return", "getAnnotation", "(", "tsdb", ",", "(", "byte", "[", "]", ")", "null", ",", "start_time", ")", ...
Attempts to fetch a global annotation from storage @param tsdb The TSDB to use for storage access @param start_time The start time as a Unix epoch timestamp @return A valid annotation object if found, null if not
[ "Attempts", "to", "fetch", "a", "global", "annotation", "from", "storage" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L231-L234
13,431
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.getGlobalAnnotations
public static Deferred<List<Annotation>> getGlobalAnnotations(final TSDB tsdb, final long start_time, final long end_time) { if (end_time < 1) { throw new IllegalArgumentException("The end timestamp has not been set"); } if (end_time < start_time) { throw new IllegalArgumentException( ...
java
public static Deferred<List<Annotation>> getGlobalAnnotations(final TSDB tsdb, final long start_time, final long end_time) { if (end_time < 1) { throw new IllegalArgumentException("The end timestamp has not been set"); } if (end_time < start_time) { throw new IllegalArgumentException( ...
[ "public", "static", "Deferred", "<", "List", "<", "Annotation", ">", ">", "getGlobalAnnotations", "(", "final", "TSDB", "tsdb", ",", "final", "long", "start_time", ",", "final", "long", "end_time", ")", "{", "if", "(", "end_time", "<", "1", ")", "{", "th...
Scans through the global annotation storage rows and returns a list of parsed annotation objects. If no annotations were found for the given timespan, the resulting list will be empty. @param tsdb The TSDB to use for storage access @param start_time Start time to scan from. May be 0 @param end_time End time to scan to....
[ "Scans", "through", "the", "global", "annotation", "storage", "rows", "and", "returns", "a", "list", "of", "parsed", "annotation", "objects", ".", "If", "no", "annotations", "were", "found", "for", "the", "given", "timespan", "the", "resulting", "list", "will"...
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L304-L382
13,432
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.timeFromQualifier
private static long timeFromQualifier(final byte[] qualifier, final long base_time) { final long offset; if (qualifier.length == 3) { offset = Bytes.getUnsignedShort(qualifier, 1); return (base_time + offset) * 1000; } else { offset = Bytes.getUnsignedInt(qualifier, 1); return...
java
private static long timeFromQualifier(final byte[] qualifier, final long base_time) { final long offset; if (qualifier.length == 3) { offset = Bytes.getUnsignedShort(qualifier, 1); return (base_time + offset) * 1000; } else { offset = Bytes.getUnsignedInt(qualifier, 1); return...
[ "private", "static", "long", "timeFromQualifier", "(", "final", "byte", "[", "]", "qualifier", ",", "final", "long", "base_time", ")", "{", "final", "long", "offset", ";", "if", "(", "qualifier", ".", "length", "==", "3", ")", "{", "offset", "=", "Bytes"...
Returns a timestamp after parsing an annotation qualifier. @param qualifier The full qualifier (including prefix) on either 3 or 5 bytes @param base_time The base time from the row in seconds @return A timestamp in milliseconds @since 2.1
[ "Returns", "a", "timestamp", "after", "parsing", "an", "annotation", "qualifier", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L638-L648
13,433
OpenTSDB/opentsdb
src/core/IncomingDataPoints.java
IncomingDataPoints.checkMetricAndTags
static void checkMetricAndTags(final String metric, final Map<String, String> tags) { if (tags.size() <= 0) { throw new IllegalArgumentException("Need at least one tag (metric=" + metric + ", tags=" + tags + ')'); } else if (tags.size() > Const.MAX_NUM_TAGS()) { throw new IllegalArgu...
java
static void checkMetricAndTags(final String metric, final Map<String, String> tags) { if (tags.size() <= 0) { throw new IllegalArgumentException("Need at least one tag (metric=" + metric + ", tags=" + tags + ')'); } else if (tags.size() > Const.MAX_NUM_TAGS()) { throw new IllegalArgu...
[ "static", "void", "checkMetricAndTags", "(", "final", "String", "metric", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "if", "(", "tags", ".", "size", "(", ")", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException",...
Validates the given metric and tags. @throws IllegalArgumentException if any of the arguments aren't valid.
[ "Validates", "the", "given", "metric", "and", "tags", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/IncomingDataPoints.java#L104-L121
13,434
OpenTSDB/opentsdb
src/core/IncomingDataPoints.java
IncomingDataPoints.copyInRowKey
private static void copyInRowKey(final byte[] row, final short offset, final byte[] bytes) { System.arraycopy(bytes, 0, row, offset, bytes.length); }
java
private static void copyInRowKey(final byte[] row, final short offset, final byte[] bytes) { System.arraycopy(bytes, 0, row, offset, bytes.length); }
[ "private", "static", "void", "copyInRowKey", "(", "final", "byte", "[", "]", "row", ",", "final", "short", "offset", ",", "final", "byte", "[", "]", "bytes", ")", "{", "System", ".", "arraycopy", "(", "bytes", ",", "0", ",", "row", ",", "offset", ","...
Copies the specified byte array at the specified offset in the row key. @param row The row key into which to copy the bytes. @param offset The offset in the row key to start writing at. @param bytes The bytes to copy.
[ "Copies", "the", "specified", "byte", "array", "at", "the", "specified", "offset", "in", "the", "row", "key", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/IncomingDataPoints.java#L233-L236
13,435
OpenTSDB/opentsdb
src/core/IncomingDataPoints.java
IncomingDataPoints.updateBaseTime
private long updateBaseTime(final long timestamp) { // We force the starting timestamp to be on a MAX_TIMESPAN boundary // so that all TSDs create rows with the same base time. Otherwise // we'd need to coordinate TSDs to avoid creating rows that cover // overlapping time periods. final long base_ti...
java
private long updateBaseTime(final long timestamp) { // We force the starting timestamp to be on a MAX_TIMESPAN boundary // so that all TSDs create rows with the same base time. Otherwise // we'd need to coordinate TSDs to avoid creating rows that cover // overlapping time periods. final long base_ti...
[ "private", "long", "updateBaseTime", "(", "final", "long", "timestamp", ")", "{", "// We force the starting timestamp to be on a MAX_TIMESPAN boundary", "// so that all TSDs create rows with the same base time. Otherwise", "// we'd need to coordinate TSDs to avoid creating rows that cover", ...
Updates the base time in the row key. @param timestamp The timestamp from which to derive the new base time. @return The updated base time.
[ "Updates", "the", "base", "time", "in", "the", "row", "key", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/IncomingDataPoints.java#L245-L260
13,436
OpenTSDB/opentsdb
src/query/expression/ExpressionFactory.java
ExpressionFactory.addTSDBFunctions
public static void addTSDBFunctions(final TSDB tsdb) { available_functions.put("divideSeries", new DivideSeries(tsdb)); available_functions.put("divide", new DivideSeries(tsdb)); available_functions.put("sumSeries", new SumSeries(tsdb)); available_functions.put("sum", new SumSeries(tsdb)); available...
java
public static void addTSDBFunctions(final TSDB tsdb) { available_functions.put("divideSeries", new DivideSeries(tsdb)); available_functions.put("divide", new DivideSeries(tsdb)); available_functions.put("sumSeries", new SumSeries(tsdb)); available_functions.put("sum", new SumSeries(tsdb)); available...
[ "public", "static", "void", "addTSDBFunctions", "(", "final", "TSDB", "tsdb", ")", "{", "available_functions", ".", "put", "(", "\"divideSeries\"", ",", "new", "DivideSeries", "(", "tsdb", ")", ")", ";", "available_functions", ".", "put", "(", "\"divide\"", ",...
Adds more functions to the map that depend on an instantiated TSDB object. Only call this once please. @param tsdb The TSDB object to initialize with
[ "Adds", "more", "functions", "to", "the", "map", "that", "depend", "on", "an", "instantiated", "TSDB", "object", ".", "Only", "call", "this", "once", "please", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/ExpressionFactory.java#L50-L59
13,437
OpenTSDB/opentsdb
src/query/expression/ExpressionFactory.java
ExpressionFactory.getByName
public static Expression getByName(final String function) { final Expression expression = available_functions.get(function); if (expression == null) { throw new UnsupportedOperationException("Function " + function + " has not been implemented"); } return expression; }
java
public static Expression getByName(final String function) { final Expression expression = available_functions.get(function); if (expression == null) { throw new UnsupportedOperationException("Function " + function + " has not been implemented"); } return expression; }
[ "public", "static", "Expression", "getByName", "(", "final", "String", "function", ")", "{", "final", "Expression", "expression", "=", "available_functions", ".", "get", "(", "function", ")", ";", "if", "(", "expression", "==", "null", ")", "{", "throw", "ne...
Returns the expression function given the name @param function The name of the expression to use @return The expression when located @throws UnsupportedOperationException if the requested function hasn't been stored in the map.
[ "Returns", "the", "expression", "function", "given", "the", "name" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/ExpressionFactory.java#L87-L94
13,438
OpenTSDB/opentsdb
src/rollup/RollupSeq.java
RollupSeq.setRow
public void setRow(final KeyValue column) { //This api will be called only with the KeyValues from rollup table, as per //the scan logic if (key != null) { throw new IllegalStateException("setRow was already called on " + this); } key = column.key(); //Check whether the cell is g...
java
public void setRow(final KeyValue column) { //This api will be called only with the KeyValues from rollup table, as per //the scan logic if (key != null) { throw new IllegalStateException("setRow was already called on " + this); } key = column.key(); //Check whether the cell is g...
[ "public", "void", "setRow", "(", "final", "KeyValue", "column", ")", "{", "//This api will be called only with the KeyValues from rollup table, as per", "//the scan logic", "if", "(", "key", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"setRow w...
Sets the row this instance holds in RAM using a row from a scanner. @param column The compacted HBase row to set. @throws IllegalStateException if this method was already called.
[ "Sets", "the", "row", "this", "instance", "holds", "in", "RAM", "using", "a", "row", "from", "a", "scanner", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupSeq.java#L126-L163
13,439
OpenTSDB/opentsdb
src/tools/Search.java
Search.main
public static void main(String[] args) throws Exception { ArgP argp = new ArgP(); CliOptions.addCommon(argp); argp.addOption("--use-data-table", "Scan against the raw data table instead of the meta data table."); args = CliOptions.parse(argp, args); if (args == null) { usage(argp, "Inv...
java
public static void main(String[] args) throws Exception { ArgP argp = new ArgP(); CliOptions.addCommon(argp); argp.addOption("--use-data-table", "Scan against the raw data table instead of the meta data table."); args = CliOptions.parse(argp, args); if (args == null) { usage(argp, "Inv...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "ArgP", "argp", "=", "new", "ArgP", "(", ")", ";", "CliOptions", ".", "addCommon", "(", "argp", ")", ";", "argp", ".", "addOption", "(", "\"--use-data...
Entry point to run the search utility @param args Command line arguments @throws Exception If something goes wrong
[ "Entry", "point", "to", "run", "the", "search", "utility" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/Search.java#L53-L86
13,440
OpenTSDB/opentsdb
src/tools/Search.java
Search.runCommand
private static int runCommand(final TSDB tsdb, final boolean use_data_table, final String[] args) throws Exception { final int nargs = args.length; if (args[0].equals("lookup")) { if (nargs < 2) { // need a query usage(null, "Not enou...
java
private static int runCommand(final TSDB tsdb, final boolean use_data_table, final String[] args) throws Exception { final int nargs = args.length; if (args[0].equals("lookup")) { if (nargs < 2) { // need a query usage(null, "Not enou...
[ "private", "static", "int", "runCommand", "(", "final", "TSDB", "tsdb", ",", "final", "boolean", "use_data_table", ",", "final", "String", "[", "]", "args", ")", "throws", "Exception", "{", "final", "int", "nargs", "=", "args", ".", "length", ";", "if", ...
Determines the command requested of the user can calls the appropriate method. @param tsdb The TSDB to use for communication @param use_data_table Whether or not lookups should be done on the full data table @param args Arguments to parse @return An exit code
[ "Determines", "the", "command", "requested", "of", "the", "user", "can", "calls", "the", "appropriate", "method", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/Search.java#L97-L111
13,441
OpenTSDB/opentsdb
src/tsd/PutDataPointRpc.java
PutDataPointRpc.importDataPoint
protected Deferred<Object> importDataPoint(final TSDB tsdb, final String[] words) { words[0] = null; // Ditch the "put". if (words.length < 5) { // Need at least: metric timestamp value tag // ^ 5 and not 4 because words[0] is "put". throw...
java
protected Deferred<Object> importDataPoint(final TSDB tsdb, final String[] words) { words[0] = null; // Ditch the "put". if (words.length < 5) { // Need at least: metric timestamp value tag // ^ 5 and not 4 because words[0] is "put". throw...
[ "protected", "Deferred", "<", "Object", ">", "importDataPoint", "(", "final", "TSDB", "tsdb", ",", "final", "String", "[", "]", "words", ")", "{", "words", "[", "0", "]", "=", "null", ";", "// Ditch the \"put\".", "if", "(", "words", ".", "length", "<", ...
Imports a single data point. @param tsdb The TSDB to import the data point into. @param words The words describing the data point to import, in the following format: {@code [metric, timestamp, value, ..tags..]} @return A deferred object that indicates the completion of the request. @throws NumberFormatException if the ...
[ "Imports", "a", "single", "data", "point", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/PutDataPointRpc.java#L741-L780
13,442
OpenTSDB/opentsdb
src/tsd/PutDataPointRpc.java
PutDataPointRpc.getHttpDetails
final private HashMap<String, Object> getHttpDetails(final String message, final IncomingDataPoint dp) { final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("error", message); map.put("datapoint", dp); return map; }
java
final private HashMap<String, Object> getHttpDetails(final String message, final IncomingDataPoint dp) { final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("error", message); map.put("datapoint", dp); return map; }
[ "final", "private", "HashMap", "<", "String", ",", "Object", ">", "getHttpDetails", "(", "final", "String", "message", ",", "final", "IncomingDataPoint", "dp", ")", "{", "final", "HashMap", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "...
Simple helper to format an error trying to save a data point @param message The message to return to the user @param dp The datapoint that caused the error @return A hashmap with information @since 2.0
[ "Simple", "helper", "to", "format", "an", "error", "trying", "to", "save", "a", "data", "point" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/PutDataPointRpc.java#L821-L827
13,443
OpenTSDB/opentsdb
src/tsd/PutDataPointRpc.java
PutDataPointRpc.handleStorageException
void handleStorageException(final TSDB tsdb, final IncomingDataPoint dp, final Exception e) { final StorageExceptionHandler handler = tsdb.getStorageExceptionHandler(); if (handler != null) { handler.handleError(dp, e); } }
java
void handleStorageException(final TSDB tsdb, final IncomingDataPoint dp, final Exception e) { final StorageExceptionHandler handler = tsdb.getStorageExceptionHandler(); if (handler != null) { handler.handleError(dp, e); } }
[ "void", "handleStorageException", "(", "final", "TSDB", "tsdb", ",", "final", "IncomingDataPoint", "dp", ",", "final", "Exception", "e", ")", "{", "final", "StorageExceptionHandler", "handler", "=", "tsdb", ".", "getStorageExceptionHandler", "(", ")", ";", "if", ...
Passes a data point off to the storage handler plugin if it has been configured. @param tsdb The TSDB from which to grab the SEH plugin @param dp The data point to process @param e The exception that caused this
[ "Passes", "a", "data", "point", "off", "to", "the", "storage", "handler", "plugin", "if", "it", "has", "been", "configured", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/PutDataPointRpc.java#L836-L842
13,444
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.addOption
public void addOption(final String name, final String meta, final String help) { if (name.isEmpty()) { throw new IllegalArgumentException("empty name"); } else if (name.charAt(0) != '-') { throw new IllegalArgumentException("name must start with a `-':...
java
public void addOption(final String name, final String meta, final String help) { if (name.isEmpty()) { throw new IllegalArgumentException("empty name"); } else if (name.charAt(0) != '-') { throw new IllegalArgumentException("name must start with a `-':...
[ "public", "void", "addOption", "(", "final", "String", "name", ",", "final", "String", "meta", ",", "final", "String", "help", ")", "{", "if", "(", "name", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"empty name\"...
Registers an option in this argument parser. @param name The name of the option to recognize (e.g. {@code --foo}). @param meta The meta-variable to associate with the value of the option. @param help A short description of this option. @throws IllegalArgumentException if the given name was already used. @throws Illegal...
[ "Registers", "an", "option", "in", "this", "argument", "parser", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L74-L92
13,445
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.parse
public String[] parse(final String[] args) { parsed = new HashMap<String, String>(options.size()); ArrayList<String> unparsed = null; for (int i = 0; i < args.length; i++) { final String arg = args[i]; String[] opt = options.get(arg); if (opt != null) { // Perfect match: got --foo ...
java
public String[] parse(final String[] args) { parsed = new HashMap<String, String>(options.size()); ArrayList<String> unparsed = null; for (int i = 0; i < args.length; i++) { final String arg = args[i]; String[] opt = options.get(arg); if (opt != null) { // Perfect match: got --foo ...
[ "public", "String", "[", "]", "parse", "(", "final", "String", "[", "]", "args", ")", "{", "parsed", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", "options", ".", "size", "(", ")", ")", ";", "ArrayList", "<", "String", ">", "unpars...
Parses the command line given in argument. @return The remaining words that weren't options (i.e. that didn't start with a dash). @throws IllegalArgumentException if the given command line wasn't valid.
[ "Parses", "the", "command", "line", "given", "in", "argument", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L123-L171
13,446
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.get
public String get(final String name, final String defaultv) { final String value = get(name); return value == null ? defaultv : value; }
java
public String get(final String name, final String defaultv) { final String value = get(name); return value == null ? defaultv : value; }
[ "public", "String", "get", "(", "final", "String", "name", ",", "final", "String", "defaultv", ")", "{", "final", "String", "value", "=", "get", "(", "name", ")", ";", "return", "value", "==", "null", "?", "defaultv", ":", "value", ";", "}" ]
Returns the value of the given option, or a default value. @param name The name of the option to recognize (e.g. {@code --foo}). @param defaultv The default value to return if the option wasn't given. @throws IllegalArgumentException if this option wasn't registered with {@link #addOption}. @throws IllegalStateExceptio...
[ "Returns", "the", "value", "of", "the", "given", "option", "or", "a", "default", "value", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L199-L202
13,447
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.has
public boolean has(final String name) { if (!options.containsKey(name)) { throw new IllegalArgumentException("Unknown option " + name); } else if (parsed == null) { throw new IllegalStateException("parse() wasn't called"); } return parsed.containsKey(name); }
java
public boolean has(final String name) { if (!options.containsKey(name)) { throw new IllegalArgumentException("Unknown option " + name); } else if (parsed == null) { throw new IllegalStateException("parse() wasn't called"); } return parsed.containsKey(name); }
[ "public", "boolean", "has", "(", "final", "String", "name", ")", "{", "if", "(", "!", "options", ".", "containsKey", "(", "name", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unknown option \"", "+", "name", ")", ";", "}", "else", "...
Returns whether or not the given option was given. @param name The name of the option to recognize (e.g. {@code --foo}). @throws IllegalArgumentException if this option wasn't registered with {@link #addOption}. @throws IllegalStateException if {@link #parse} wasn't called.
[ "Returns", "whether", "or", "not", "the", "given", "option", "was", "given", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L211-L218
13,448
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.addUsageTo
public void addUsageTo(final StringBuilder buf) { final ArrayList<String> names = new ArrayList<String>(options.keySet()); Collections.sort(names); int max_length = 0; for (final String name : names) { final String[] opt = options.get(name); final int length = name.length() + (opt[0]...
java
public void addUsageTo(final StringBuilder buf) { final ArrayList<String> names = new ArrayList<String>(options.keySet()); Collections.sort(names); int max_length = 0; for (final String name : names) { final String[] opt = options.get(name); final int length = name.length() + (opt[0]...
[ "public", "void", "addUsageTo", "(", "final", "StringBuilder", "buf", ")", "{", "final", "ArrayList", "<", "String", ">", "names", "=", "new", "ArrayList", "<", "String", ">", "(", "options", ".", "keySet", "(", ")", ")", ";", "Collections", ".", "sort",...
Appends the usage to the given buffer. @param buf The buffer to write to.
[ "Appends", "the", "usage", "to", "the", "given", "buffer", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L224-L249
13,449
OpenTSDB/opentsdb
src/tools/ArgP.java
ArgP.usage
public String usage() { final StringBuilder buf = new StringBuilder(16 * options.size()); addUsageTo(buf); return buf.toString(); }
java
public String usage() { final StringBuilder buf = new StringBuilder(16 * options.size()); addUsageTo(buf); return buf.toString(); }
[ "public", "String", "usage", "(", ")", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "16", "*", "options", ".", "size", "(", ")", ")", ";", "addUsageTo", "(", "buf", ")", ";", "return", "buf", ".", "toString", "(", ")", ";",...
Returns a usage string.
[ "Returns", "a", "usage", "string", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ArgP.java#L259-L263
13,450
OpenTSDB/opentsdb
src/tools/TextImporter.java
TextImporter.open
private static BufferedReader open(final String path) throws IOException { if (path.equals("-")) { return new BufferedReader(new InputStreamReader(System.in)); } InputStream is = new FileInputStream(path); if (path.endsWith(".gz")) { is = new GZIPInputStream(is); } // I <3 Java's IO...
java
private static BufferedReader open(final String path) throws IOException { if (path.equals("-")) { return new BufferedReader(new InputStreamReader(System.in)); } InputStream is = new FileInputStream(path); if (path.endsWith(".gz")) { is = new GZIPInputStream(is); } // I <3 Java's IO...
[ "private", "static", "BufferedReader", "open", "(", "final", "String", "path", ")", "throws", "IOException", "{", "if", "(", "path", ".", "equals", "(", "\"-\"", ")", ")", "{", "return", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "System"...
Opens a file for reading, handling gzipped files. @param path The file to open. @return A buffered reader to read the file, decompressing it if needed. @throws IOException when shit happens.
[ "Opens", "a", "file", "for", "reading", "handling", "gzipped", "files", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/TextImporter.java#L261-L272
13,451
OpenTSDB/opentsdb
src/query/pojo/Expression.java
Expression.validate
public void validate() { if (id == null || id.isEmpty()) { throw new IllegalArgumentException("missing or empty id"); } Query.validateId(id); if (expr == null || expr.isEmpty()) { throw new IllegalArgumentException("missing or empty expr"); } // parse it just to make sure w...
java
public void validate() { if (id == null || id.isEmpty()) { throw new IllegalArgumentException("missing or empty id"); } Query.validateId(id); if (expr == null || expr.isEmpty()) { throw new IllegalArgumentException("missing or empty expr"); } // parse it just to make sure w...
[ "public", "void", "validate", "(", ")", "{", "if", "(", "id", "==", "null", "||", "id", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"missing or empty id\"", ")", ";", "}", "Query", ".", "validateId", "(", "id", ...
Validates the expression @throws IllegalArgumentException if one or more parameters were invalid
[ "Validates", "the", "expression" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/pojo/Expression.java#L97-L122
13,452
OpenTSDB/opentsdb
src/tools/CliOptions.java
CliOptions.parse
static String[] parse(final ArgP argp, String[] args) { try { args = argp.parse(args); } catch (IllegalArgumentException e) { System.err.println("Invalid usage. " + e.getMessage()); System.exit(2); } honorVerboseFlag(argp); return args; }
java
static String[] parse(final ArgP argp, String[] args) { try { args = argp.parse(args); } catch (IllegalArgumentException e) { System.err.println("Invalid usage. " + e.getMessage()); System.exit(2); } honorVerboseFlag(argp); return args; }
[ "static", "String", "[", "]", "parse", "(", "final", "ArgP", "argp", ",", "String", "[", "]", "args", ")", "{", "try", "{", "args", "=", "argp", ".", "parse", "(", "args", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "Sys...
Parse the command line arguments with the given options. @param opt,ions Options to parse in the given args. @param args Command line arguments to parse. @return The remainder of the command line or {@code null} if {@code args} were invalid and couldn't be parsed.
[ "Parse", "the", "command", "line", "arguments", "with", "the", "given", "options", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliOptions.java#L75-L84
13,453
OpenTSDB/opentsdb
src/tools/CliOptions.java
CliOptions.getConfig
static final Config getConfig(final ArgP argp) throws IOException { // load configuration final Config config; final String config_file = argp.get("--config", ""); if (!config_file.isEmpty()) config = new Config(config_file); else config = new Config(true); // load CLI overloads ...
java
static final Config getConfig(final ArgP argp) throws IOException { // load configuration final Config config; final String config_file = argp.get("--config", ""); if (!config_file.isEmpty()) config = new Config(config_file); else config = new Config(true); // load CLI overloads ...
[ "static", "final", "Config", "getConfig", "(", "final", "ArgP", "argp", ")", "throws", "IOException", "{", "// load configuration", "final", "Config", "config", ";", "final", "String", "config_file", "=", "argp", ".", "get", "(", "\"--config\"", ",", "\"\"", "...
Attempts to load a configuration given a file or default files and overrides with command line arguments @return A config object with user settings or defaults @throws IOException If there was an error opening any of the config files @throws FileNotFoundException If the user provided config file was not found @since 2....
[ "Attempts", "to", "load", "a", "configuration", "given", "a", "file", "or", "default", "files", "and", "overrides", "with", "command", "line", "arguments" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliOptions.java#L94-L109
13,454
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.loadConfigSource
protected static void loadConfigSource(ConfigArgP config, String source) { Properties p = loadConfig(source); Config c = config.getConfig(); for(String key: p.stringPropertyNames()) { String value = p.getProperty(key); ConfigurationItem ci = config.getConfigurationItem(key); if(ci!=n...
java
protected static void loadConfigSource(ConfigArgP config, String source) { Properties p = loadConfig(source); Config c = config.getConfig(); for(String key: p.stringPropertyNames()) { String value = p.getProperty(key); ConfigurationItem ci = config.getConfigurationItem(key); if(ci!=n...
[ "protected", "static", "void", "loadConfigSource", "(", "ConfigArgP", "config", ",", "String", "source", ")", "{", "Properties", "p", "=", "loadConfig", "(", "source", ")", ";", "Config", "c", "=", "config", ".", "getConfig", "(", ")", ";", "for", "(", "...
Applies the properties from the named source to the main configuration @param config the main configuration to apply to @param source the name of the source to apply properties from
[ "Applies", "the", "properties", "from", "the", "named", "source", "to", "the", "main", "configuration" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L207-L218
13,455
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.loadConfig
protected static Properties loadConfig(String name) { try { URL url = new URL(name); return loadConfig(url); } catch (Exception ex) { return loadConfig(new File(name)); } }
java
protected static Properties loadConfig(String name) { try { URL url = new URL(name); return loadConfig(url); } catch (Exception ex) { return loadConfig(new File(name)); } }
[ "protected", "static", "Properties", "loadConfig", "(", "String", "name", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "name", ")", ";", "return", "loadConfig", "(", "url", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ret...
Loads properties from a file or url with the passed name @param name The name of the file or URL @return the loaded properties
[ "Loads", "properties", "from", "a", "file", "or", "url", "with", "the", "passed", "name" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L225-L232
13,456
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.loadConfig
protected static Properties loadConfig(String source, InputStream is) { try { Properties p = new Properties(); p.load(is); // trim the value as it may have trailing white-space Set<String> keys = p.stringPropertyNames(); for(String key: keys) { p.setProperty(key, p.getProperty(...
java
protected static Properties loadConfig(String source, InputStream is) { try { Properties p = new Properties(); p.load(is); // trim the value as it may have trailing white-space Set<String> keys = p.stringPropertyNames(); for(String key: keys) { p.setProperty(key, p.getProperty(...
[ "protected", "static", "Properties", "loadConfig", "(", "String", "source", ",", "InputStream", "is", ")", "{", "try", "{", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "p", ".", "load", "(", "is", ")", ";", "// trim the value as it may have t...
Loads properties from the passed input stream @param source The name of the source the properties are being loaded from @param is The input stream to load from @return the loaded properties
[ "Loads", "properties", "from", "the", "passed", "input", "stream" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L240-L255
13,457
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.loadConfig
protected static Properties loadConfig(File file) { InputStream is = null; try { is = new FileInputStream(file); return loadConfig(file.getAbsolutePath(), is); } catch (Exception ex) { throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + ...
java
protected static Properties loadConfig(File file) { InputStream is = null; try { is = new FileInputStream(file); return loadConfig(file.getAbsolutePath(), is); } catch (Exception ex) { throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + ...
[ "protected", "static", "Properties", "loadConfig", "(", "File", "file", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "FileInputStream", "(", "file", ")", ";", "return", "loadConfig", "(", "file", ".", "getAbsolutePath", "(...
Loads properties from the passed file @param file The file to load from @return the loaded properties
[ "Loads", "properties", "from", "the", "passed", "file" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L262-L272
13,458
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.applyArgs
public String[] applyArgs(String[] clargs) { LOG.debug("Applying Command Line Args {}", Arrays.toString(clargs)); final List<String> nonFlagArgs = new ArrayList<String>(Arrays.asList(clargs)); extractAndApplyFlags(nonFlagArgs); String[] args = nonFlagArgs.toArray(new String[0]); String[] nonArg...
java
public String[] applyArgs(String[] clargs) { LOG.debug("Applying Command Line Args {}", Arrays.toString(clargs)); final List<String> nonFlagArgs = new ArrayList<String>(Arrays.asList(clargs)); extractAndApplyFlags(nonFlagArgs); String[] args = nonFlagArgs.toArray(new String[0]); String[] nonArg...
[ "public", "String", "[", "]", "applyArgs", "(", "String", "[", "]", "clargs", ")", "{", "LOG", ".", "debug", "(", "\"Applying Command Line Args {}\"", ",", "Arrays", ".", "toString", "(", "clargs", ")", ")", ";", "final", "List", "<", "String", ">", "non...
Parses the command line arguments, and where the options are recognized config items, the value is validated, then applied to the config @param clargs The command line arguments @return The un-applied command line arguments
[ "Parses", "the", "command", "line", "arguments", "and", "where", "the", "options", "are", "recognized", "config", "items", "the", "value", "is", "validated", "then", "applied", "to", "the", "config" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L320-L344
13,459
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.getDefaultUsage
public String getDefaultUsage(String...msgs) { StringBuilder b = new StringBuilder("\n"); for(String msg: msgs) { b.append(msg).append("\n"); } b.append(dargp.usage()); return b.toString(); }
java
public String getDefaultUsage(String...msgs) { StringBuilder b = new StringBuilder("\n"); for(String msg: msgs) { b.append(msg).append("\n"); } b.append(dargp.usage()); return b.toString(); }
[ "public", "String", "getDefaultUsage", "(", "String", "...", "msgs", ")", "{", "StringBuilder", "b", "=", "new", "StringBuilder", "(", "\"\\n\"", ")", ";", "for", "(", "String", "msg", ":", "msgs", ")", "{", "b", ".", "append", "(", "msg", ")", ".", ...
Returns a default usage banner with optional prefixed messages, one per line. @param msgs The optional message @return the formatted usage banner
[ "Returns", "a", "default", "usage", "banner", "with", "optional", "prefixed", "messages", "one", "per", "line", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L408-L415
13,460
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.getExtendedUsage
public String getExtendedUsage(String...msgs) { StringBuilder b = new StringBuilder("\n"); for(String msg: msgs) { b.append(msg).append("\n"); } b.append(argp.usage()); return b.toString(); }
java
public String getExtendedUsage(String...msgs) { StringBuilder b = new StringBuilder("\n"); for(String msg: msgs) { b.append(msg).append("\n"); } b.append(argp.usage()); return b.toString(); }
[ "public", "String", "getExtendedUsage", "(", "String", "...", "msgs", ")", "{", "StringBuilder", "b", "=", "new", "StringBuilder", "(", "\"\\n\"", ")", ";", "for", "(", "String", "msg", ":", "msgs", ")", "{", "b", ".", "append", "(", "msg", ")", ".", ...
Returns an extended usage banner with optional prefixed messages, one per line. @param msgs The optional message @return the formatted usage banner
[ "Returns", "an", "extended", "usage", "banner", "with", "optional", "prefixed", "messages", "one", "per", "line", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L422-L429
13,461
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.log
public static void log(String format, Object...args) { System.out.println(String.format(format, args)); }
java
public static void log(String format, Object...args) { System.out.println(String.format(format, args)); }
[ "public", "static", "void", "log", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "System", ".", "out", ".", "println", "(", "String", ".", "format", "(", "format", ",", "args", ")", ")", ";", "}" ]
System out logger @param format The message format @param args The message arg tokens
[ "System", "out", "logger" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L437-L439
13,462
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.processConfigValue
public static String processConfigValue(CharSequence text) { final String pv = evaluate(tokenReplaceSysProps(text)); return (pv==null || pv.trim().isEmpty()) ? null : pv; }
java
public static String processConfigValue(CharSequence text) { final String pv = evaluate(tokenReplaceSysProps(text)); return (pv==null || pv.trim().isEmpty()) ? null : pv; }
[ "public", "static", "String", "processConfigValue", "(", "CharSequence", "text", ")", "{", "final", "String", "pv", "=", "evaluate", "(", "tokenReplaceSysProps", "(", "text", ")", ")", ";", "return", "(", "pv", "==", "null", "||", "pv", ".", "trim", "(", ...
Performs sys-prop and js evals on the passed value @param text The value to process @return the processed value
[ "Performs", "sys", "-", "prop", "and", "js", "evals", "on", "the", "passed", "value" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L446-L449
13,463
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.tokenReplaceSysProps
public static String tokenReplaceSysProps(CharSequence text) { if(text==null) return null; Matcher m = SYS_PROP_PATTERN.matcher(text); StringBuffer ret = new StringBuffer(); while(m.find()) { String replacement = decodeToken(m.group(1), m.group(2)==null ? "<null>" : m.group(2)); if(replaceme...
java
public static String tokenReplaceSysProps(CharSequence text) { if(text==null) return null; Matcher m = SYS_PROP_PATTERN.matcher(text); StringBuffer ret = new StringBuffer(); while(m.find()) { String replacement = decodeToken(m.group(1), m.group(2)==null ? "<null>" : m.group(2)); if(replaceme...
[ "public", "static", "String", "tokenReplaceSysProps", "(", "CharSequence", "text", ")", "{", "if", "(", "text", "==", "null", ")", "return", "null", ";", "Matcher", "m", "=", "SYS_PROP_PATTERN", ".", "matcher", "(", "text", ")", ";", "StringBuffer", "ret", ...
Replaces all matched tokens with the matching system property value or a configured default @param text The text to process @return The substituted string
[ "Replaces", "all", "matched", "tokens", "with", "the", "matching", "system", "property", "value", "or", "a", "configured", "default" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L456-L472
13,464
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.evaluate
public static String evaluate(CharSequence text) { if(text==null) return null; Matcher m = JS_PATTERN.matcher(text); StringBuffer ret = new StringBuffer(); final boolean isNas = scriptEngine.getFactory().getEngineName().toLowerCase().contains("nashorn"); while(m.find()) { String source = (isNa...
java
public static String evaluate(CharSequence text) { if(text==null) return null; Matcher m = JS_PATTERN.matcher(text); StringBuffer ret = new StringBuffer(); final boolean isNas = scriptEngine.getFactory().getEngineName().toLowerCase().contains("nashorn"); while(m.find()) { String source = (isNa...
[ "public", "static", "String", "evaluate", "(", "CharSequence", "text", ")", "{", "if", "(", "text", "==", "null", ")", "return", "null", ";", "Matcher", "m", "=", "JS_PATTERN", ".", "matcher", "(", "text", ")", ";", "StringBuffer", "ret", "=", "new", "...
Evaluates JS expressions defines as configuration values @param text The value of a configuration item to evaluate for JS expressions @return The passed value with any embedded JS expressions evaluated and replaced
[ "Evaluates", "JS", "expressions", "defines", "as", "configuration", "values" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L479-L506
13,465
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.hasNonOption
public boolean hasNonOption(String nonOptionKey) { if(nonOptionArgs==null || nonOptionArgs.length==0 || nonOptionKey==null || nonOptionKey.trim().isEmpty()) return false; return Arrays.binarySearch(nonOptionArgs, nonOptionKey) >= 0; }
java
public boolean hasNonOption(String nonOptionKey) { if(nonOptionArgs==null || nonOptionArgs.length==0 || nonOptionKey==null || nonOptionKey.trim().isEmpty()) return false; return Arrays.binarySearch(nonOptionArgs, nonOptionKey) >= 0; }
[ "public", "boolean", "hasNonOption", "(", "String", "nonOptionKey", ")", "{", "if", "(", "nonOptionArgs", "==", "null", "||", "nonOptionArgs", ".", "length", "==", "0", "||", "nonOptionKey", "==", "null", "||", "nonOptionKey", ".", "trim", "(", ")", ".", "...
Determines if the passed key is contained in the non option args @param nonOptionKey The non option key to check for @return true if the passed key is present, false otherwise
[ "Determines", "if", "the", "passed", "key", "is", "contained", "in", "the", "non", "option", "args" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L799-L802
13,466
OpenTSDB/opentsdb
src/tsd/SearchRpc.java
SearchRpc.parseQueryString
private final SearchQuery parseQueryString(final HttpQuery query, final SearchType type) { final SearchQuery search_query = new SearchQuery(); if (type == SearchType.LOOKUP) { final String query_string = query.getRequiredQueryStringParam("m"); search_query.setTags(new ArrayList<Pair<Stri...
java
private final SearchQuery parseQueryString(final HttpQuery query, final SearchType type) { final SearchQuery search_query = new SearchQuery(); if (type == SearchType.LOOKUP) { final String query_string = query.getRequiredQueryStringParam("m"); search_query.setTags(new ArrayList<Pair<Stri...
[ "private", "final", "SearchQuery", "parseQueryString", "(", "final", "HttpQuery", "query", ",", "final", "SearchType", "type", ")", "{", "final", "SearchQuery", "search_query", "=", "new", "SearchQuery", "(", ")", ";", "if", "(", "type", "==", "SearchType", "....
Parses required search values from the query string @param query The HTTP query to work with @param type The type of search query requested @return A parsed SearchQuery object
[ "Parses", "required", "search", "values", "from", "the", "query", "string" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/SearchRpc.java#L106-L161
13,467
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.internalError
@Override public void internalError(final Exception cause) { logError("Internal Server Error on " + request().getUri(), cause); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (this.api_version) { ...
java
@Override public void internalError(final Exception cause) { logError("Internal Server Error on " + request().getUri(), cause); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (this.api_version) { ...
[ "@", "Override", "public", "void", "internalError", "(", "final", "Exception", "cause", ")", "{", "logError", "(", "\"Internal Server Error on \"", "+", "request", "(", ")", ".", "getUri", "(", ")", ",", "cause", ")", ";", "if", "(", "this", ".", "api_vers...
Sends a 500 error page to the client. Handles responses from deprecated API calls as well as newer, versioned API calls @param cause The unexpected exception that caused this error.
[ "Sends", "a", "500", "error", "page", "to", "the", "client", ".", "Handles", "responses", "from", "deprecated", "API", "calls", "as", "well", "as", "newer", "versioned", "API", "calls" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L348-L386
13,468
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.badRequest
@Override public void badRequest(final BadRequestException exception) { logWarn("Bad Request on " + request().getUri() + ": " + exception.getMessage()); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (thi...
java
@Override public void badRequest(final BadRequestException exception) { logWarn("Bad Request on " + request().getUri() + ": " + exception.getMessage()); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (thi...
[ "@", "Override", "public", "void", "badRequest", "(", "final", "BadRequestException", "exception", ")", "{", "logWarn", "(", "\"Bad Request on \"", "+", "request", "(", ")", ".", "getUri", "(", ")", "+", "\": \"", "+", "exception", ".", "getMessage", "(", ")...
Sends an error message to the client. Handles responses from deprecated API calls. @param exception The exception that was thrown
[ "Sends", "an", "error", "message", "to", "the", "client", ".", "Handles", "responses", "from", "deprecated", "API", "calls", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L402-L433
13,469
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.notFound
@Override public void notFound() { logWarn("Not Found: " + request().getUri()); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (this.api_version) { case 1: default: sendReply(Htt...
java
@Override public void notFound() { logWarn("Not Found: " + request().getUri()); if (this.api_version > 0) { // always default to the latest version of the error formatter since we // need to return something switch (this.api_version) { case 1: default: sendReply(Htt...
[ "@", "Override", "public", "void", "notFound", "(", ")", "{", "logWarn", "(", "\"Not Found: \"", "+", "request", "(", ")", ".", "getUri", "(", ")", ")", ";", "if", "(", "this", ".", "api_version", ">", "0", ")", "{", "// always default to the latest versio...
Sends a 404 error page to the client. Handles responses from deprecated API calls
[ "Sends", "a", "404", "error", "page", "to", "the", "client", ".", "Handles", "responses", "from", "deprecated", "API", "calls" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L439-L458
13,470
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.redirect
public void redirect(final String location) { // set the header AND a meta refresh just in case response().headers().set("Location", location); sendReply(HttpResponseStatus.OK, new StringBuilder( "<html></head><meta http-equiv=\"refresh\" content=\"0; url=" + location + "\"></head...
java
public void redirect(final String location) { // set the header AND a meta refresh just in case response().headers().set("Location", location); sendReply(HttpResponseStatus.OK, new StringBuilder( "<html></head><meta http-equiv=\"refresh\" content=\"0; url=" + location + "\"></head...
[ "public", "void", "redirect", "(", "final", "String", "location", ")", "{", "// set the header AND a meta refresh just in case", "response", "(", ")", ".", "headers", "(", ")", ".", "set", "(", "\"Location\"", ",", "location", ")", ";", "sendReply", "(", "HttpRe...
Redirects the client's browser to the given location.
[ "Redirects", "the", "client", "s", "browser", "to", "the", "given", "location", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L461-L470
13,471
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.escapeJson
static void escapeJson(final String s, final StringBuilder buf) { final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': cas...
java
static void escapeJson(final String s, final StringBuilder buf) { final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': cas...
[ "static", "void", "escapeJson", "(", "final", "String", "s", ",", "final", "StringBuilder", "buf", ")", "{", "final", "int", "length", "=", "s", ".", "length", "(", ")", ";", "int", "extra", "=", "0", ";", "// First count how many extra chars we'll need, if an...
Escapes a string appropriately to be a valid in JSON. Valid JSON strings are defined in RFC 4627, Section 2.5. @param s The string to escape, which is assumed to be in . @param buf The buffer into which to write the escaped string.
[ "Escapes", "a", "string", "appropriately", "to", "be", "a", "valid", "in", "JSON", ".", "Valid", "JSON", "strings", "are", "defined", "in", "RFC", "4627", "Section", "2", ".", "5", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L478-L523
13,472
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.done
@Override public void done() { final int processing_time = processingTimeMillis(); httplatency.add(processing_time); logInfo("HTTP " + request().getUri() + " done in " + processing_time + "ms"); deferred.callback(null); }
java
@Override public void done() { final int processing_time = processingTimeMillis(); httplatency.add(processing_time); logInfo("HTTP " + request().getUri() + " done in " + processing_time + "ms"); deferred.callback(null); }
[ "@", "Override", "public", "void", "done", "(", ")", "{", "final", "int", "processing_time", "=", "processingTimeMillis", "(", ")", ";", "httplatency", ".", "add", "(", "processing_time", ")", ";", "logInfo", "(", "\"HTTP \"", "+", "request", "(", ")", "."...
Method to call after writing the HTTP response to the wire.
[ "Method", "to", "call", "after", "writing", "the", "HTTP", "response", "to", "the", "wire", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L685-L691
13,473
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.guessMimeType
private String guessMimeType(final ChannelBuffer buf) { final String mimetype = guessMimeTypeFromUri(request().getUri()); return mimetype == null ? guessMimeTypeFromContents(buf) : mimetype; }
java
private String guessMimeType(final ChannelBuffer buf) { final String mimetype = guessMimeTypeFromUri(request().getUri()); return mimetype == null ? guessMimeTypeFromContents(buf) : mimetype; }
[ "private", "String", "guessMimeType", "(", "final", "ChannelBuffer", "buf", ")", "{", "final", "String", "mimetype", "=", "guessMimeTypeFromUri", "(", "request", "(", ")", ".", "getUri", "(", ")", ")", ";", "return", "mimetype", "==", "null", "?", "guessMime...
Returns the result of an attempt to guess the MIME type of the response. @param buf The content of the reply to send.
[ "Returns", "the", "result", "of", "an", "attempt", "to", "guess", "the", "MIME", "type", "of", "the", "response", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L709-L712
13,474
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.guessMimeTypeFromUri
private static String guessMimeTypeFromUri(final String uri) { final int questionmark = uri.indexOf('?', 1); // 1 => skip the initial / final int end = (questionmark > 0 ? questionmark : uri.length()) - 1; if (end < 5) { // Need at least: "/a.js" return null; } final char a = uri.charAt(end ...
java
private static String guessMimeTypeFromUri(final String uri) { final int questionmark = uri.indexOf('?', 1); // 1 => skip the initial / final int end = (questionmark > 0 ? questionmark : uri.length()) - 1; if (end < 5) { // Need at least: "/a.js" return null; } final char a = uri.charAt(end ...
[ "private", "static", "String", "guessMimeTypeFromUri", "(", "final", "String", "uri", ")", "{", "final", "int", "questionmark", "=", "uri", ".", "indexOf", "(", "'", "'", ",", "1", ")", ";", "// 1 => skip the initial /", "final", "int", "end", "=", "(", "q...
Attempts to guess the MIME type by looking at the URI requested. @param uri The URI from which to infer the MIME type.
[ "Attempts", "to", "guess", "the", "MIME", "type", "by", "looking", "at", "the", "URI", "requested", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L718-L746
13,475
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.guessMimeTypeFromContents
private String guessMimeTypeFromContents(final ChannelBuffer buf) { if (!buf.readable()) { logWarn("Sending an empty result?! buf=" + buf); return "text/plain"; } final int firstbyte = buf.getUnsignedByte(buf.readerIndex()); switch (firstbyte) { case '<': // <html or <!DOCTYPE ...
java
private String guessMimeTypeFromContents(final ChannelBuffer buf) { if (!buf.readable()) { logWarn("Sending an empty result?! buf=" + buf); return "text/plain"; } final int firstbyte = buf.getUnsignedByte(buf.readerIndex()); switch (firstbyte) { case '<': // <html or <!DOCTYPE ...
[ "private", "String", "guessMimeTypeFromContents", "(", "final", "ChannelBuffer", "buf", ")", "{", "if", "(", "!", "buf", ".", "readable", "(", ")", ")", "{", "logWarn", "(", "\"Sending an empty result?! buf=\"", "+", "buf", ")", ";", "return", "\"text/plain\"", ...
Simple "content sniffing". May not be a great idea, but will do until this class has a better API. @param buf The content of the reply to send. @return The MIME type guessed from {@code buf}.
[ "Simple", "content", "sniffing", ".", "May", "not", "be", "a", "great", "idea", "but", "will", "do", "until", "this", "class", "has", "a", "better", "API", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L754-L770
13,476
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.makePage
public static StringBuilder makePage(final String htmlheader, final String title, final String subtitle, final String body) { final StringBuilder buf = new StringBuilder( BOILERPLATE_LENGTH + (...
java
public static StringBuilder makePage(final String htmlheader, final String title, final String subtitle, final String body) { final StringBuilder buf = new StringBuilder( BOILERPLATE_LENGTH + (...
[ "public", "static", "StringBuilder", "makePage", "(", "final", "String", "htmlheader", ",", "final", "String", "title", ",", "final", "String", "subtitle", ",", "final", "String", "body", ")", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", ...
Easy way to generate a small, simple HTML page. @param htmlheader Text to insert in the {@code head} tag. Ignored if {@code null}. @param title What should be in the {@code title} tag of the page. @param subtitle Small sentence to use next to the TSD logo. @param body The body of the page (excluding the {@code body} ta...
[ "Easy", "way", "to", "generate", "a", "small", "simple", "HTML", "page", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L929-L948
13,477
OpenTSDB/opentsdb
src/tools/FsckOptions.java
FsckOptions.addDataOptions
public static void addDataOptions(final ArgP argp) { argp.addOption("--full-scan", "Scan the entire data table."); argp.addOption("--fix", "Fix errors as they're found. Use in combination with" + " other flags."); argp.addOption("--fix-all", "Set all flags and fix errors as they're found."); arg...
java
public static void addDataOptions(final ArgP argp) { argp.addOption("--full-scan", "Scan the entire data table."); argp.addOption("--fix", "Fix errors as they're found. Use in combination with" + " other flags."); argp.addOption("--fix-all", "Set all flags and fix errors as they're found."); arg...
[ "public", "static", "void", "addDataOptions", "(", "final", "ArgP", "argp", ")", "{", "argp", ".", "addOption", "(", "\"--full-scan\"", ",", "\"Scan the entire data table.\"", ")", ";", "argp", ".", "addOption", "(", "\"--fix\"", ",", "\"Fix errors as they're found....
Add data table fsck options to the command line parser @param argp The parser to add options to
[ "Add", "data", "table", "fsck", "options", "to", "the", "command", "line", "parser" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/FsckOptions.java#L77-L100
13,478
OpenTSDB/opentsdb
src/query/expression/Absolute.java
Absolute.abs
private DataPoints abs(final DataPoints points) { // TODO(cl) - Using an array as the size function may not return the exact // results and we should figure a way to avoid copying data anyway. final List<DataPoint> dps = new ArrayList<DataPoint>(); final SeekableView view = points.iterator(); while...
java
private DataPoints abs(final DataPoints points) { // TODO(cl) - Using an array as the size function may not return the exact // results and we should figure a way to avoid copying data anyway. final List<DataPoint> dps = new ArrayList<DataPoint>(); final SeekableView view = points.iterator(); while...
[ "private", "DataPoints", "abs", "(", "final", "DataPoints", "points", ")", "{", "// TODO(cl) - Using an array as the size function may not return the exact", "// results and we should figure a way to avoid copying data anyway.", "final", "List", "<", "DataPoint", ">", "dps", "=", ...
Iterate over each data point and store the absolute value @param points The data points to modify @return The resulting data points
[ "Iterate", "over", "each", "data", "point", "and", "store", "the", "absolute", "value" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/Absolute.java#L63-L82
13,479
OpenTSDB/opentsdb
src/tree/TreeBuilder.java
TreeBuilder.processParsedValue
private void processParsedValue(final String parsed_value) { if (rule.getCompiledRegex() == null && (rule.getSeparator() == null || rule.getSeparator().isEmpty())) { // we don't have a regex and we don't need to separate, so just use the // name of the timseries setCurrentName(parsed_valu...
java
private void processParsedValue(final String parsed_value) { if (rule.getCompiledRegex() == null && (rule.getSeparator() == null || rule.getSeparator().isEmpty())) { // we don't have a regex and we don't need to separate, so just use the // name of the timseries setCurrentName(parsed_valu...
[ "private", "void", "processParsedValue", "(", "final", "String", "parsed_value", ")", "{", "if", "(", "rule", ".", "getCompiledRegex", "(", ")", "==", "null", "&&", "(", "rule", ".", "getSeparator", "(", ")", "==", "null", "||", "rule", ".", "getSeparator"...
Routes the parsed value to the proper processing method for altering the display name depending on the current rule. This can route to the regex handler or the split processor. Or if neither splits or regex are specified for the rule, the parsed value is set as the branch name. @param parsed_value The value parsed from...
[ "Routes", "the", "parsed", "value", "to", "the", "proper", "processing", "method", "for", "altering", "the", "display", "name", "depending", "on", "the", "current", "rule", ".", "This", "can", "route", "to", "the", "regex", "handler", "or", "the", "split", ...
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/TreeBuilder.java#L932-L948
13,480
OpenTSDB/opentsdb
src/tree/TreeBuilder.java
TreeBuilder.processRegexRule
private void processRegexRule(final String parsed_value) { if (rule.getCompiledRegex() == null) { throw new IllegalArgumentException("Regex was null for rule: " + rule); } final Matcher matcher = rule.getCompiledRegex().matcher(parsed_value); if (matcher.find()) { // The first gr...
java
private void processRegexRule(final String parsed_value) { if (rule.getCompiledRegex() == null) { throw new IllegalArgumentException("Regex was null for rule: " + rule); } final Matcher matcher = rule.getCompiledRegex().matcher(parsed_value); if (matcher.find()) { // The first gr...
[ "private", "void", "processRegexRule", "(", "final", "String", "parsed_value", ")", "{", "if", "(", "rule", ".", "getCompiledRegex", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Regex was null for rule: \"", "+", "rule", ...
Runs the parsed string through a regex and attempts to extract a value from the specified group index. Group indexes start at 0. If the regex was not matched, or an extracted value for the requested group did not exist, then the processor returns and the rule will be considered a no-match. @param parsed_value The value...
[ "Runs", "the", "parsed", "string", "through", "a", "regex", "and", "attempts", "to", "extract", "a", "value", "from", "the", "specified", "group", "index", ".", "Group", "indexes", "start", "at", "0", ".", "If", "the", "regex", "was", "not", "matched", "...
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/TreeBuilder.java#L1003-L1032
13,481
OpenTSDB/opentsdb
src/tree/TreeBuilder.java
TreeBuilder.resetState
private void resetState() { meta = null; splits = null; rule_idx = 0; split_idx = 0; current_branch = null; rule = null; not_matched = null; if (root != null) { if (root.getBranches() != null) { root.getBranches().clear(); } if (root.getLeaves() != null) { ...
java
private void resetState() { meta = null; splits = null; rule_idx = 0; split_idx = 0; current_branch = null; rule = null; not_matched = null; if (root != null) { if (root.getBranches() != null) { root.getBranches().clear(); } if (root.getLeaves() != null) { ...
[ "private", "void", "resetState", "(", ")", "{", "meta", "=", "null", ";", "splits", "=", "null", ";", "rule_idx", "=", "0", ";", "split_idx", "=", "0", ";", "current_branch", "=", "null", ";", "rule", "=", "null", ";", "not_matched", "=", "null", ";"...
Resets local state variables to their defaults
[ "Resets", "local", "state", "variables", "to", "their", "defaults" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/TreeBuilder.java#L1143-L1160
13,482
OpenTSDB/opentsdb
src/tsd/RTPublisher.java
RTPublisher.sinkDataPoint
public final Deferred<Object> sinkDataPoint(final String metric, final long timestamp, final byte[] value, final Map<String, String> tags, final byte[] tsuid, final short flags) { if ((flags & Const.FLAG_FLOAT) != 0x0) { return publishDataPoint(metric, timestamp, Internal.extractFloat...
java
public final Deferred<Object> sinkDataPoint(final String metric, final long timestamp, final byte[] value, final Map<String, String> tags, final byte[] tsuid, final short flags) { if ((flags & Const.FLAG_FLOAT) != 0x0) { return publishDataPoint(metric, timestamp, Internal.extractFloat...
[ "public", "final", "Deferred", "<", "Object", ">", "sinkDataPoint", "(", "final", "String", "metric", ",", "final", "long", "timestamp", ",", "final", "byte", "[", "]", "value", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ",", "final"...
Called by the TSD when a new, raw data point is published. Because this is called after a data point is queued, the value has been converted to a byte array so we need to convert it back to an integer or floating point value. Instead of requiring every implementation to perform the calculation we perform it here and le...
[ "Called", "by", "the", "TSD", "when", "a", "new", "raw", "data", "point", "is", "published", ".", "Because", "this", "is", "called", "after", "a", "data", "point", "is", "queued", "the", "value", "has", "been", "converted", "to", "a", "byte", "array", ...
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/RTPublisher.java#L97-L108
13,483
OpenTSDB/opentsdb
src/tsd/RTPublisher.java
RTPublisher.publishHistogramPoint
public Deferred<Object> publishHistogramPoint(final String metric, final long timestamp, final byte[] value, final Map<String, String> tags, final byte[] tsuid) { ...
java
public Deferred<Object> publishHistogramPoint(final String metric, final long timestamp, final byte[] value, final Map<String, String> tags, final byte[] tsuid) { ...
[ "public", "Deferred", "<", "Object", ">", "publishHistogramPoint", "(", "final", "String", "metric", ",", "final", "long", "timestamp", ",", "final", "byte", "[", "]", "value", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", ...
Called any time a new histogram point is published @param metric The name of the metric associated with the data point @param timestamp Timestamp as a Unix epoch in seconds or milliseconds (depending on the TSD's configuration) @param value Encoded raw data blob for the histogram point @param tags Tagk/v pairs @param t...
[ "Called", "any", "time", "a", "new", "histogram", "point", "is", "published" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/RTPublisher.java#L159-L164
13,484
OpenTSDB/opentsdb
src/rollup/RollupInterval.java
RollupInterval.validateAndCompile
void validateAndCompile() { if (temporal_table_name == null || temporal_table_name.isEmpty()) { throw new IllegalArgumentException("The rollup table cannot be null or empty"); } temporal_table = temporal_table_name.getBytes(Const.ASCII_CHARSET); if (groupby_table_name == null || groupby_table...
java
void validateAndCompile() { if (temporal_table_name == null || temporal_table_name.isEmpty()) { throw new IllegalArgumentException("The rollup table cannot be null or empty"); } temporal_table = temporal_table_name.getBytes(Const.ASCII_CHARSET); if (groupby_table_name == null || groupby_table...
[ "void", "validateAndCompile", "(", ")", "{", "if", "(", "temporal_table_name", "==", "null", "||", "temporal_table_name", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The rollup table cannot be null or empty\"", ")", ";", "...
Calculates the number of intervals in a given span for the rollup interval and makes sure we have table names. It also sets the table byte arrays. @return The number of intervals in the span @throws IllegalArgumentException if milliseconds were passed in the interval or the interval couldn't be parsed, the tables are m...
[ "Calculates", "the", "number", "of", "intervals", "in", "a", "given", "span", "for", "the", "rollup", "interval", "and", "makes", "sure", "we", "have", "table", "names", ".", "It", "also", "sets", "the", "table", "byte", "arrays", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupInterval.java#L169-L232
13,485
OpenTSDB/opentsdb
src/core/AppendDataPoints.java
AppendDataPoints.getBytes
public byte[] getBytes() { final byte[] bytes = new byte[qualifier.length + value.length]; System.arraycopy(this.qualifier, 0, bytes, 0, qualifier.length); System.arraycopy(value, 0, bytes, qualifier.length, value.length); return bytes; }
java
public byte[] getBytes() { final byte[] bytes = new byte[qualifier.length + value.length]; System.arraycopy(this.qualifier, 0, bytes, 0, qualifier.length); System.arraycopy(value, 0, bytes, qualifier.length, value.length); return bytes; }
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "final", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "qualifier", ".", "length", "+", "value", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "qualifier", ",", "...
Concatenates the qualifier and value for appending to a column in the backing data store. @return A byte array to append to the value of a column.
[ "Concatenates", "the", "qualifier", "and", "value", "for", "appending", "to", "a", "column", "in", "the", "backing", "data", "store", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/AppendDataPoints.java#L93-L98
13,486
OpenTSDB/opentsdb
src/tools/CliUtils.java
CliUtils.getMaxMetricID
static long getMaxMetricID(final TSDB tsdb) { // first up, we need the max metric ID so we can split up the data table // amongst threads. final GetRequest get = new GetRequest(tsdb.uidTable(), new byte[] { 0 }); get.family("id".getBytes(CHARSET)); get.qualifier("metrics".getBytes(CHARSET)); Arr...
java
static long getMaxMetricID(final TSDB tsdb) { // first up, we need the max metric ID so we can split up the data table // amongst threads. final GetRequest get = new GetRequest(tsdb.uidTable(), new byte[] { 0 }); get.family("id".getBytes(CHARSET)); get.qualifier("metrics".getBytes(CHARSET)); Arr...
[ "static", "long", "getMaxMetricID", "(", "final", "TSDB", "tsdb", ")", "{", "// first up, we need the max metric ID so we can split up the data table", "// amongst threads.", "final", "GetRequest", "get", "=", "new", "GetRequest", "(", "tsdb", ".", "uidTable", "(", ")", ...
Returns the max metric ID from the UID table @param tsdb The TSDB to use for data access @return The max metric ID as an integer value, may be 0 if the UID table hasn't been initialized or is missing the UID row or metrics column. @throws IllegalStateException if the UID column can't be found or couldn't be parsed
[ "Returns", "the", "max", "metric", "ID", "from", "the", "UID", "table" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliUtils.java#L102-L122
13,487
OpenTSDB/opentsdb
src/tools/CliUtils.java
CliUtils.getDataTableScanner
static final Scanner getDataTableScanner(final TSDB tsdb, final long start_id, final long end_id) throws HBaseException { final short metric_width = TSDB.metrics_width(); final byte[] start_row = Arrays.copyOfRange(Bytes.fromLong(start_id), 8 - metric_width, 8); final byte[] end_row = A...
java
static final Scanner getDataTableScanner(final TSDB tsdb, final long start_id, final long end_id) throws HBaseException { final short metric_width = TSDB.metrics_width(); final byte[] start_row = Arrays.copyOfRange(Bytes.fromLong(start_id), 8 - metric_width, 8); final byte[] end_row = A...
[ "static", "final", "Scanner", "getDataTableScanner", "(", "final", "TSDB", "tsdb", ",", "final", "long", "start_id", ",", "final", "long", "end_id", ")", "throws", "HBaseException", "{", "final", "short", "metric_width", "=", "TSDB", ".", "metrics_width", "(", ...
Returns a scanner set to iterate over a range of metrics in the main tsdb-data table. @param tsdb The TSDB to use for data access @param start_id A metric ID to start scanning on @param end_id A metric ID to end scanning on @return A scanner on the "t" CF configured for the specified range @throws HBaseException if som...
[ "Returns", "a", "scanner", "set", "to", "iterate", "over", "a", "range", "of", "metrics", "in", "the", "main", "tsdb", "-", "data", "table", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliUtils.java#L133-L146
13,488
OpenTSDB/opentsdb
src/tsd/client/MetricForm.java
MetricForm.getFilters
private List<Filter> getFilters(final boolean group_by) { final int ntags = getNumTags(); final List<Filter> filters = new ArrayList<Filter>(ntags); for (int tag = 0; tag < ntags; tag++) { final Filter filter = new Filter(); filter.tagk = getTagName(tag); filter.tagv = getTagValue(tag); ...
java
private List<Filter> getFilters(final boolean group_by) { final int ntags = getNumTags(); final List<Filter> filters = new ArrayList<Filter>(ntags); for (int tag = 0; tag < ntags; tag++) { final Filter filter = new Filter(); filter.tagk = getTagName(tag); filter.tagv = getTagValue(tag); ...
[ "private", "List", "<", "Filter", ">", "getFilters", "(", "final", "boolean", "group_by", ")", "{", "final", "int", "ntags", "=", "getNumTags", "(", ")", ";", "final", "List", "<", "Filter", ">", "filters", "=", "new", "ArrayList", "<", "Filter", ">", ...
Helper method to extract the tags from the row set and sort them before sending to the API so that we avoid a bug wherein the sort order changes on reload. @param group_by Whether or not to fetch group by or non-group by filters. @return A non-null list of filters. May be empty.
[ "Helper", "method", "to", "extract", "the", "tags", "from", "the", "row", "set", "and", "sort", "them", "before", "sending", "to", "the", "API", "so", "that", "we", "avoid", "a", "bug", "wherein", "the", "sort", "order", "changes", "on", "reload", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/MetricForm.java#L467-L485
13,489
OpenTSDB/opentsdb
src/tsd/client/MetricForm.java
MetricForm.setSelectedItem
private void setSelectedItem(final ListBox list, final String item) { final int nitems = list.getItemCount(); for (int i = 0; i < nitems; i++) { if (item.equals(list.getValue(i))) { list.setSelectedIndex(i); return; } } }
java
private void setSelectedItem(final ListBox list, final String item) { final int nitems = list.getItemCount(); for (int i = 0; i < nitems; i++) { if (item.equals(list.getValue(i))) { list.setSelectedIndex(i); return; } } }
[ "private", "void", "setSelectedItem", "(", "final", "ListBox", "list", ",", "final", "String", "item", ")", "{", "final", "int", "nitems", "=", "list", ".", "getItemCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nitems", ";"...
If the given item is in the list, mark it as selected. @param list The list to manipulate. @param item The item to select if present.
[ "If", "the", "given", "item", "is", "in", "the", "list", "mark", "it", "as", "selected", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/MetricForm.java#L689-L697
13,490
OpenTSDB/opentsdb
src/utils/Threads.java
Threads.newTimer
public static HashedWheelTimer newTimer(final int ticks, final int ticks_per_wheel, final String name) { class TimerThreadNamer implements ThreadNameDeterminer { @Override public String determineThreadName(String currentThreadName, String proposedThreadName) throws Exception { r...
java
public static HashedWheelTimer newTimer(final int ticks, final int ticks_per_wheel, final String name) { class TimerThreadNamer implements ThreadNameDeterminer { @Override public String determineThreadName(String currentThreadName, String proposedThreadName) throws Exception { r...
[ "public", "static", "HashedWheelTimer", "newTimer", "(", "final", "int", "ticks", ",", "final", "int", "ticks_per_wheel", ",", "final", "String", "name", ")", "{", "class", "TimerThreadNamer", "implements", "ThreadNameDeterminer", "{", "@", "Override", "public", "...
Returns a new HashedWheelTimer with a name and default ticks @param ticks How many ticks per second to sleep between executions, in ms @param ticks_per_wheel The size of the wheel @param name The name to add to the thread name @return A timer
[ "Returns", "a", "new", "HashedWheelTimer", "with", "a", "name", "and", "default", "ticks" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Threads.java#L85-L96
13,491
OpenTSDB/opentsdb
src/query/pojo/Downsampler.java
Downsampler.validate
public void validate() { if (interval == null || interval.isEmpty()) { throw new IllegalArgumentException("Missing or empty interval"); } DateTime.parseDuration(interval); if (aggregator == null || aggregator.isEmpty()) { throw new IllegalArgumentException("Missing or empty aggregator")...
java
public void validate() { if (interval == null || interval.isEmpty()) { throw new IllegalArgumentException("Missing or empty interval"); } DateTime.parseDuration(interval); if (aggregator == null || aggregator.isEmpty()) { throw new IllegalArgumentException("Missing or empty aggregator")...
[ "public", "void", "validate", "(", ")", "{", "if", "(", "interval", "==", "null", "||", "interval", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Missing or empty interval\"", ")", ";", "}", "DateTime", ".", "parseDu...
Validates the downsampler @throws IllegalArgumentException if one or more parameters were invalid
[ "Validates", "the", "downsampler" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/pojo/Downsampler.java#L60-L78
13,492
OpenTSDB/opentsdb
src/query/expression/NumericFillPolicy.java
NumericFillPolicy.validate
public void validate() { if (policy == null) { if (value == 0) { policy = FillPolicy.ZERO; } else if (Double.isNaN(value)) { policy = FillPolicy.NOT_A_NUMBER; } else { policy = FillPolicy.SCALAR; } } else { switch (policy) { case NONE: case NOT_A...
java
public void validate() { if (policy == null) { if (value == 0) { policy = FillPolicy.ZERO; } else if (Double.isNaN(value)) { policy = FillPolicy.NOT_A_NUMBER; } else { policy = FillPolicy.SCALAR; } } else { switch (policy) { case NONE: case NOT_A...
[ "public", "void", "validate", "(", ")", "{", "if", "(", "policy", "==", "null", ")", "{", "if", "(", "value", "==", "0", ")", "{", "policy", "=", "FillPolicy", ".", "ZERO", ";", "}", "else", "if", "(", "Double", ".", "isNaN", "(", "value", ")", ...
Makes sure the policy name and value are a suitable combination. If one or the other is missing then we set the other with the proper value. @throws IllegalArgumentException if the combination is bad
[ "Makes", "sure", "the", "policy", "name", "and", "value", "are", "a", "suitable", "combination", ".", "If", "one", "or", "the", "other", "is", "missing", "then", "we", "set", "the", "other", "with", "the", "proper", "value", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/NumericFillPolicy.java#L140-L175
13,493
OpenTSDB/opentsdb
src/core/HistogramCodecManager.java
HistogramCodecManager.getCodec
public HistogramDataPointCodec getCodec(final int id) { final HistogramDataPointCodec codec = codecs.get(id); if (codec == null) { throw new IllegalArgumentException("No codec found mapped to ID " + id); } return codec; }
java
public HistogramDataPointCodec getCodec(final int id) { final HistogramDataPointCodec codec = codecs.get(id); if (codec == null) { throw new IllegalArgumentException("No codec found mapped to ID " + id); } return codec; }
[ "public", "HistogramDataPointCodec", "getCodec", "(", "final", "int", "id", ")", "{", "final", "HistogramDataPointCodec", "codec", "=", "codecs", ".", "get", "(", "id", ")", ";", "if", "(", "codec", "==", "null", ")", "{", "throw", "new", "IllegalArgumentExc...
Return the instance of the given codec. @param id The numeric ID of the codec (the first byte in storage). @return The instance of the given codec @throws IllegalArgumentException if no codec was found for the given ID.
[ "Return", "the", "instance", "of", "the", "given", "codec", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/HistogramCodecManager.java#L148-L154
13,494
OpenTSDB/opentsdb
src/core/HistogramCodecManager.java
HistogramCodecManager.getCodec
public int getCodec(final Class<?> clazz) { if (clazz == null) { throw new IllegalArgumentException("Clazz cannot be null."); } final Integer id = codecs_ids.get(clazz); if (id == null) { throw new IllegalArgumentException("No codec ID assigned to class " + clazz); } retur...
java
public int getCodec(final Class<?> clazz) { if (clazz == null) { throw new IllegalArgumentException("Clazz cannot be null."); } final Integer id = codecs_ids.get(clazz); if (id == null) { throw new IllegalArgumentException("No codec ID assigned to class " + clazz); } retur...
[ "public", "int", "getCodec", "(", "final", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Clazz cannot be null.\"", ")", ";", "}", "final", "Integer", "id", "=", ...
Return the ID of the given codec. @param clazz The non-null class to search for. @return The ID of the codec. @throws IllegalArgumentException if the class was null or no ID was assigned to the class.
[ "Return", "the", "ID", "of", "the", "given", "codec", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/HistogramCodecManager.java#L163-L173
13,495
OpenTSDB/opentsdb
src/core/HistogramCodecManager.java
HistogramCodecManager.encode
public byte[] encode(final int id, final Histogram data_point, final boolean include_id) { final HistogramDataPointCodec codec = getCodec(id); return codec.encode(data_point, include_id); }
java
public byte[] encode(final int id, final Histogram data_point, final boolean include_id) { final HistogramDataPointCodec codec = getCodec(id); return codec.encode(data_point, include_id); }
[ "public", "byte", "[", "]", "encode", "(", "final", "int", "id", ",", "final", "Histogram", "data_point", ",", "final", "boolean", "include_id", ")", "{", "final", "HistogramDataPointCodec", "codec", "=", "getCodec", "(", "id", ")", ";", "return", "codec", ...
Finds the proper codec and calls it's encode method to create a byte array with the given ID as the first byte. @param id The ID of the histogram type to search for. @param data_point The non-null data point to encode. @param include_id Whether or not to include the ID prefix when encoding. @return A non-null and non-e...
[ "Finds", "the", "proper", "codec", "and", "calls", "it", "s", "encode", "method", "to", "create", "a", "byte", "array", "with", "the", "given", "ID", "as", "the", "first", "byte", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/HistogramCodecManager.java#L185-L190
13,496
OpenTSDB/opentsdb
src/core/HistogramCodecManager.java
HistogramCodecManager.decode
public Histogram decode(final int id, final byte[] raw_data, final boolean includes_id) { final HistogramDataPointCodec codec = getCodec(id); return codec.decode(raw_data, includes_id); }
java
public Histogram decode(final int id, final byte[] raw_data, final boolean includes_id) { final HistogramDataPointCodec codec = getCodec(id); return codec.decode(raw_data, includes_id); }
[ "public", "Histogram", "decode", "(", "final", "int", "id", ",", "final", "byte", "[", "]", "raw_data", ",", "final", "boolean", "includes_id", ")", "{", "final", "HistogramDataPointCodec", "codec", "=", "getCodec", "(", "id", ")", ";", "return", "codec", ...
Finds the proper codec and calls it's decode method to return the histogram data point for queries or validation. @param id The ID of the histogram type to search for. @param raw_data The non-null and non-empty byte array to parse. Should NOT include the first byte of the ID in the data. @param includes_id Whether or n...
[ "Finds", "the", "proper", "codec", "and", "calls", "it", "s", "decode", "method", "to", "return", "the", "histogram", "data", "point", "for", "queries", "or", "validation", "." ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/HistogramCodecManager.java#L201-L206
13,497
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.execute
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doColle...
java
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doColle...
[ "public", "Deferred", "<", "Object", ">", "execute", "(", "final", "TSDB", "tsdb", ",", "final", "Channel", "chan", ",", "final", "String", "[", "]", "cmd", ")", "{", "final", "boolean", "canonical", "=", "tsdb", ".", "getConfig", "(", ")", ".", "getBo...
Telnet RPC responder that returns the stats in ASCII style @param tsdb The TSDB to use for fetching stats @param chan The netty channel to respond on @param cmd call parameters
[ "Telnet", "RPC", "responder", "that", "returns", "the", "stats", "in", "ASCII", "style" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L59-L67
13,498
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.execute
public void execute(final TSDB tsdb, final HttpQuery query) { // only accept GET/POST if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST) { throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, "Method not allowed", "The HTTP method [" + query.method().getN...
java
public void execute(final TSDB tsdb, final HttpQuery query) { // only accept GET/POST if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST) { throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, "Method not allowed", "The HTTP method [" + query.method().getN...
[ "public", "void", "execute", "(", "final", "TSDB", "tsdb", ",", "final", "HttpQuery", "query", ")", "{", "// only accept GET/POST", "if", "(", "query", ".", "method", "(", ")", "!=", "HttpMethod", ".", "GET", "&&", "query", ".", "method", "(", ")", "!=",...
HTTP resposne handler @param tsdb The TSDB to which we belong @param query The query to parse and respond to
[ "HTTP", "resposne", "handler" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L74-L131
13,499
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.doCollectStats
private void doCollectStats(final TSDB tsdb, final StatsCollector collector, final boolean canonical) { collector.addHostTag(canonical); ConnectionManager.collectStats(collector); RpcHandler.collectStats(collector); RpcManager.collectStats(collector); collectThreadStats(collector); tsdb.c...
java
private void doCollectStats(final TSDB tsdb, final StatsCollector collector, final boolean canonical) { collector.addHostTag(canonical); ConnectionManager.collectStats(collector); RpcHandler.collectStats(collector); RpcManager.collectStats(collector); collectThreadStats(collector); tsdb.c...
[ "private", "void", "doCollectStats", "(", "final", "TSDB", "tsdb", ",", "final", "StatsCollector", "collector", ",", "final", "boolean", "canonical", ")", "{", "collector", ".", "addHostTag", "(", "canonical", ")", ";", "ConnectionManager", ".", "collectStats", ...
Helper to record the statistics for the current TSD @param tsdb The TSDB to use for fetching stats @param collector The collector class to call for emitting stats
[ "Helper", "to", "record", "the", "statistics", "for", "the", "current", "TSD" ]
3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L138-L146