partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
HDFSNameNode._set_metric
Set a metric
hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py
def _set_metric(self, metric_name, metric_type, value, tags=None): """ Set a metric """ if metric_type == self.GAUGE: self.gauge(metric_name, value, tags=tags) else: self.log.error('Metric type "{}" unknown'.format(metric_type))
def _set_metric(self, metric_name, metric_type, value, tags=None): """ Set a metric """ if metric_type == self.GAUGE: self.gauge(metric_name, value, tags=tags) else: self.log.error('Metric type "{}" unknown'.format(metric_type))
[ "Set", "a", "metric" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py#L131-L138
[ "def", "_set_metric", "(", "self", ",", "metric_name", ",", "metric_type", ",", "value", ",", "tags", "=", "None", ")", ":", "if", "metric_type", "==", "self", ".", "GAUGE", ":", "self", ".", "gauge", "(", "metric_name", ",", "value", ",", "tags", "=",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
HDFSNameNode._rest_request_to_json
Query the given URL and return the JSON response
hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py
def _rest_request_to_json(self, instance, url, object_path, query_params, tags=None): """ Query the given URL and return the JSON response """ if object_path: url = self._join_url_dir(url, object_path) # Add query_params as arguments if query_params: ...
def _rest_request_to_json(self, instance, url, object_path, query_params, tags=None): """ Query the given URL and return the JSON response """ if object_path: url = self._join_url_dir(url, object_path) # Add query_params as arguments if query_params: ...
[ "Query", "the", "given", "URL", "and", "return", "the", "JSON", "response" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py#L140-L218
[ "def", "_rest_request_to_json", "(", "self", ",", "instance", ",", "url", ",", "object_path", ",", "query_params", ",", "tags", "=", "None", ")", ":", "if", "object_path", ":", "url", "=", "self", ".", "_join_url_dir", "(", "url", ",", "object_path", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
HDFSNameNode._join_url_dir
Join a URL with multiple directories
hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py
def _join_url_dir(cls, url, *args): """ Join a URL with multiple directories """ for path in args: url = url.rstrip('/') + '/' url = urljoin(url, path.lstrip('/')) return url
def _join_url_dir(cls, url, *args): """ Join a URL with multiple directories """ for path in args: url = url.rstrip('/') + '/' url = urljoin(url, path.lstrip('/')) return url
[ "Join", "a", "URL", "with", "multiple", "directories" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py#L221-L230
[ "def", "_join_url_dir", "(", "cls", ",", "url", ",", "*", "args", ")", ":", "for", "path", "in", "args", ":", "url", "=", "url", ".", "rstrip", "(", "'/'", ")", "+", "'/'", "url", "=", "urljoin", "(", "url", ",", "path", ".", "lstrip", "(", "'/...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_maybe_add_read_preference
Add $readPreference to spec when appropriate.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _maybe_add_read_preference(spec, read_preference): """Add $readPreference to spec when appropriate.""" mode = read_preference.mode tag_sets = read_preference.tag_sets max_staleness = read_preference.max_staleness # Only add $readPreference if it's something other than primary to avoid # prob...
def _maybe_add_read_preference(spec, read_preference): """Add $readPreference to spec when appropriate.""" mode = read_preference.mode tag_sets = read_preference.tag_sets max_staleness = read_preference.max_staleness # Only add $readPreference if it's something other than primary to avoid # prob...
[ "Add", "$readPreference", "to", "spec", "when", "appropriate", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L72-L90
[ "def", "_maybe_add_read_preference", "(", "spec", ",", "read_preference", ")", ":", "mode", "=", "read_preference", ".", "mode", "tag_sets", "=", "read_preference", ".", "tag_sets", "max_staleness", "=", "read_preference", ".", "max_staleness", "# Only add $readPreferen...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_convert_write_result
Convert a legacy write result to write commmand format.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _convert_write_result(operation, command, result): """Convert a legacy write result to write commmand format.""" # Based on _merge_legacy from bulk.py affected = result.get("n", 0) res = {"ok": 1, "n": affected} errmsg = result.get("errmsg", result.get("err", "")) if errmsg: # The w...
def _convert_write_result(operation, command, result): """Convert a legacy write result to write commmand format.""" # Based on _merge_legacy from bulk.py affected = result.get("n", 0) res = {"ok": 1, "n": affected} errmsg = result.get("errmsg", result.get("err", "")) if errmsg: # The w...
[ "Convert", "a", "legacy", "write", "result", "to", "write", "commmand", "format", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L99-L135
[ "def", "_convert_write_result", "(", "operation", ",", "command", ",", "result", ")", ":", "# Based on _merge_legacy from bulk.py", "affected", "=", "result", ".", "get", "(", "\"n\"", ",", "0", ")", "res", "=", "{", "\"ok\"", ":", "1", ",", "\"n\"", ":", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_gen_explain_command
Generate an explain command document.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _gen_explain_command( coll, spec, projection, skip, limit, batch_size, options, read_concern): """Generate an explain command document.""" cmd = _gen_find_command( coll, spec, projection, skip, limit, batch_size, options) if read_concern.level: return SON([('explain', cmd...
def _gen_explain_command( coll, spec, projection, skip, limit, batch_size, options, read_concern): """Generate an explain command document.""" cmd = _gen_find_command( coll, spec, projection, skip, limit, batch_size, options) if read_concern.level: return SON([('explain', cmd...
[ "Generate", "an", "explain", "command", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L161-L169
[ "def", "_gen_explain_command", "(", "coll", ",", "spec", ",", "projection", ",", "skip", ",", "limit", ",", "batch_size", ",", "options", ",", "read_concern", ")", ":", "cmd", "=", "_gen_find_command", "(", "coll", ",", "spec", ",", "projection", ",", "ski...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_gen_find_command
Generate a find command document.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _gen_find_command(coll, spec, projection, skip, limit, batch_size, options, read_concern=DEFAULT_READ_CONCERN, collation=None): """Generate a find command document.""" cmd = SON([('find', coll)]) if '$query' in spec: cmd.update([(_MODIFIERS[key], val) ...
def _gen_find_command(coll, spec, projection, skip, limit, batch_size, options, read_concern=DEFAULT_READ_CONCERN, collation=None): """Generate a find command document.""" cmd = SON([('find', coll)]) if '$query' in spec: cmd.update([(_MODIFIERS[key], val) ...
[ "Generate", "a", "find", "command", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L172-L206
[ "def", "_gen_find_command", "(", "coll", ",", "spec", ",", "projection", ",", "skip", ",", "limit", ",", "batch_size", ",", "options", ",", "read_concern", "=", "DEFAULT_READ_CONCERN", ",", "collation", "=", "None", ")", ":", "cmd", "=", "SON", "(", "[", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_gen_get_more_command
Generate a getMore command document.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _gen_get_more_command(cursor_id, coll, batch_size, max_await_time_ms): """Generate a getMore command document.""" cmd = SON([('getMore', cursor_id), ('collection', coll)]) if batch_size: cmd['batchSize'] = batch_size if max_await_time_ms is not None: cmd['maxTimeMS'] =...
def _gen_get_more_command(cursor_id, coll, batch_size, max_await_time_ms): """Generate a getMore command document.""" cmd = SON([('getMore', cursor_id), ('collection', coll)]) if batch_size: cmd['batchSize'] = batch_size if max_await_time_ms is not None: cmd['maxTimeMS'] =...
[ "Generate", "a", "getMore", "command", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L209-L217
[ "def", "_gen_get_more_command", "(", "cursor_id", ",", "coll", ",", "batch_size", ",", "max_await_time_ms", ")", ":", "cmd", "=", "SON", "(", "[", "(", "'getMore'", ",", "cursor_id", ")", ",", "(", "'collection'", ",", "coll", ")", "]", ")", "if", "batch...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
__last_error
Data to send to do a lastError.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def __last_error(namespace, args): """Data to send to do a lastError. """ cmd = SON([("getlasterror", 1)]) cmd.update(args) splitns = namespace.split('.', 1) return query(0, splitns[0] + '.$cmd', 0, -1, cmd, None, DEFAULT_CODEC_OPTIONS)
def __last_error(namespace, args): """Data to send to do a lastError. """ cmd = SON([("getlasterror", 1)]) cmd.update(args) splitns = namespace.split('.', 1) return query(0, splitns[0] + '.$cmd', 0, -1, cmd, None, DEFAULT_CODEC_OPTIONS)
[ "Data", "to", "send", "to", "do", "a", "lastError", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L359-L366
[ "def", "__last_error", "(", "namespace", ",", "args", ")", ":", "cmd", "=", "SON", "(", "[", "(", "\"getlasterror\"", ",", "1", ")", "]", ")", "cmd", ".", "update", "(", "args", ")", "splitns", "=", "namespace", ".", "split", "(", "'.'", ",", "1", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
__pack_message
Takes message data and adds a message header based on the operation. Returns the resultant message string.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def __pack_message(operation, data): """Takes message data and adds a message header based on the operation. Returns the resultant message string. """ request_id = _randint() message = struct.pack("<i", 16 + len(data)) message += struct.pack("<i", request_id) message += _ZERO_32 # response...
def __pack_message(operation, data): """Takes message data and adds a message header based on the operation. Returns the resultant message string. """ request_id = _randint() message = struct.pack("<i", 16 + len(data)) message += struct.pack("<i", request_id) message += _ZERO_32 # response...
[ "Takes", "message", "data", "and", "adds", "a", "message", "header", "based", "on", "the", "operation", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L369-L379
[ "def", "__pack_message", "(", "operation", ",", "data", ")", ":", "request_id", "=", "_randint", "(", ")", "message", "=", "struct", ".", "pack", "(", "\"<i\"", ",", "16", "+", "len", "(", "data", ")", ")", "message", "+=", "struct", ".", "pack", "("...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
insert
Get an **insert** message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def insert(collection_name, docs, check_keys, safe, last_error_args, continue_on_error, opts): """Get an **insert** message.""" options = 0 if continue_on_error: options += 1 data = struct.pack("<i", options) data += bson._make_c_string(collection_name) encoded = [bson.BSON.en...
def insert(collection_name, docs, check_keys, safe, last_error_args, continue_on_error, opts): """Get an **insert** message.""" options = 0 if continue_on_error: options += 1 data = struct.pack("<i", options) data += bson._make_c_string(collection_name) encoded = [bson.BSON.en...
[ "Get", "an", "**", "insert", "**", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L382-L402
[ "def", "insert", "(", "collection_name", ",", "docs", ",", "check_keys", ",", "safe", ",", "last_error_args", ",", "continue_on_error", ",", "opts", ")", ":", "options", "=", "0", "if", "continue_on_error", ":", "options", "+=", "1", "data", "=", "struct", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
update
Get an **update** message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def update(collection_name, upsert, multi, spec, doc, safe, last_error_args, check_keys, opts): """Get an **update** message. """ options = 0 if upsert: options += 1 if multi: options += 2 data = _ZERO_32 data += bson._make_c_string(collection_name) data += st...
def update(collection_name, upsert, multi, spec, doc, safe, last_error_args, check_keys, opts): """Get an **update** message. """ options = 0 if upsert: options += 1 if multi: options += 2 data = _ZERO_32 data += bson._make_c_string(collection_name) data += st...
[ "Get", "an", "**", "update", "**", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L407-L430
[ "def", "update", "(", "collection_name", ",", "upsert", ",", "multi", ",", "spec", ",", "doc", ",", "safe", ",", "last_error_args", ",", "check_keys", ",", "opts", ")", ":", "options", "=", "0", "if", "upsert", ":", "options", "+=", "1", "if", "multi",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
query
Get a **query** message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def query(options, collection_name, num_to_skip, num_to_return, query, field_selector, opts, check_keys=False): """Get a **query** message. """ data = struct.pack("<I", options) data += bson._make_c_string(collection_name) data += struct.pack("<i", num_to_skip) data += struct.pack("<i"...
def query(options, collection_name, num_to_skip, num_to_return, query, field_selector, opts, check_keys=False): """Get a **query** message. """ data = struct.pack("<I", options) data += bson._make_c_string(collection_name) data += struct.pack("<i", num_to_skip) data += struct.pack("<i"...
[ "Get", "a", "**", "query", "**", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L435-L451
[ "def", "query", "(", "options", ",", "collection_name", ",", "num_to_skip", ",", "num_to_return", ",", "query", ",", "field_selector", ",", "opts", ",", "check_keys", "=", "False", ")", ":", "data", "=", "struct", ".", "pack", "(", "\"<I\"", ",", "options"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
delete
Get a **delete** message. `opts` is a CodecOptions. `flags` is a bit vector that may contain the SingleRemove flag or not: http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-delete
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def delete(collection_name, spec, safe, last_error_args, opts, flags=0): """Get a **delete** message. `opts` is a CodecOptions. `flags` is a bit vector that may contain the SingleRemove flag or not: http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-delete """ ...
def delete(collection_name, spec, safe, last_error_args, opts, flags=0): """Get a **delete** message. `opts` is a CodecOptions. `flags` is a bit vector that may contain the SingleRemove flag or not: http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-delete """ ...
[ "Get", "a", "**", "delete", "**", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L468-L489
[ "def", "delete", "(", "collection_name", ",", "spec", ",", "safe", ",", "last_error_args", ",", "opts", ",", "flags", "=", "0", ")", ":", "data", "=", "_ZERO_32", "data", "+=", "bson", ".", "_make_c_string", "(", "collection_name", ")", "data", "+=", "st...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
kill_cursors
Get a **killCursors** message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def kill_cursors(cursor_ids): """Get a **killCursors** message. """ data = _ZERO_32 data += struct.pack("<i", len(cursor_ids)) for cursor_id in cursor_ids: data += struct.pack("<q", cursor_id) return __pack_message(2007, data)
def kill_cursors(cursor_ids): """Get a **killCursors** message. """ data = _ZERO_32 data += struct.pack("<i", len(cursor_ids)) for cursor_id in cursor_ids: data += struct.pack("<q", cursor_id) return __pack_message(2007, data)
[ "Get", "a", "**", "killCursors", "**", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L492-L499
[ "def", "kill_cursors", "(", "cursor_ids", ")", ":", "data", "=", "_ZERO_32", "data", "+=", "struct", ".", "pack", "(", "\"<i\"", ",", "len", "(", "cursor_ids", ")", ")", "for", "cursor_id", "in", "cursor_ids", ":", "data", "+=", "struct", ".", "pack", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_do_batched_write_command
Execute a batch of insert, update, or delete commands.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _do_batched_write_command(namespace, operation, command, docs, check_keys, opts, ctx): """Execute a batch of insert, update, or delete commands. """ max_bson_size = ctx.max_bson_size max_write_batch_size = ctx.max_write_batch_size # Max BSON object size + 16k - 2 by...
def _do_batched_write_command(namespace, operation, command, docs, check_keys, opts, ctx): """Execute a batch of insert, update, or delete commands. """ max_bson_size = ctx.max_bson_size max_write_batch_size = ctx.max_write_batch_size # Max BSON object size + 16k - 2 by...
[ "Execute", "a", "batch", "of", "insert", "update", "or", "delete", "commands", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L706-L814
[ "def", "_do_batched_write_command", "(", "namespace", ",", "operation", ",", "command", ",", "docs", ",", "check_keys", ",", "opts", ",", "ctx", ")", ":", "max_bson_size", "=", "ctx", ".", "max_bson_size", "max_write_batch_size", "=", "ctx", ".", "max_write_batc...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Query.as_command
Return a find command document for this query. Should be called *after* get_message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def as_command(self): """Return a find command document for this query. Should be called *after* get_message. """ if '$explain' in self.spec: self.name = 'explain' return _gen_explain_command( self.coll, self.spec, self.fields, self.ntoskip, ...
def as_command(self): """Return a find command document for this query. Should be called *after* get_message. """ if '$explain' in self.spec: self.name = 'explain' return _gen_explain_command( self.coll, self.spec, self.fields, self.ntoskip, ...
[ "Return", "a", "find", "command", "document", "for", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L244-L258
[ "def", "as_command", "(", "self", ")", ":", "if", "'$explain'", "in", "self", ".", "spec", ":", "self", ".", "name", "=", "'explain'", "return", "_gen_explain_command", "(", "self", ".", "coll", ",", "self", ".", "spec", ",", "self", ".", "fields", ","...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Query.get_message
Get a query message, possibly setting the slaveOk bit.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def get_message(self, set_slave_ok, is_mongos, use_cmd=False): """Get a query message, possibly setting the slaveOk bit.""" if set_slave_ok: # Set the slaveOk bit. flags = self.flags | 4 else: flags = self.flags ns = _UJOIN % (self.db, self.coll) ...
def get_message(self, set_slave_ok, is_mongos, use_cmd=False): """Get a query message, possibly setting the slaveOk bit.""" if set_slave_ok: # Set the slaveOk bit. flags = self.flags | 4 else: flags = self.flags ns = _UJOIN % (self.db, self.coll) ...
[ "Get", "a", "query", "message", "possibly", "setting", "the", "slaveOk", "bit", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L260-L291
[ "def", "get_message", "(", "self", ",", "set_slave_ok", ",", "is_mongos", ",", "use_cmd", "=", "False", ")", ":", "if", "set_slave_ok", ":", "# Set the slaveOk bit.", "flags", "=", "self", ".", "flags", "|", "4", "else", ":", "flags", "=", "self", ".", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_GetMore.as_command
Return a getMore command document for this query.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def as_command(self): """Return a getMore command document for this query.""" return _gen_get_more_command(self.cursor_id, self.coll, self.ntoreturn, self.max_await_time_ms), self.db
def as_command(self): """Return a getMore command document for this query.""" return _gen_get_more_command(self.cursor_id, self.coll, self.ntoreturn, self.max_await_time_ms), self.db
[ "Return", "a", "getMore", "command", "document", "for", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L311-L315
[ "def", "as_command", "(", "self", ")", ":", "return", "_gen_get_more_command", "(", "self", ".", "cursor_id", ",", "self", ".", "coll", ",", "self", ".", "ntoreturn", ",", "self", ".", "max_await_time_ms", ")", ",", "self", ".", "db" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_GetMore.get_message
Get a getmore message.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def get_message(self, dummy0, dummy1, use_cmd=False): """Get a getmore message.""" ns = _UJOIN % (self.db, self.coll) if use_cmd: ns = _UJOIN % (self.db, "$cmd") spec = self.as_command()[0] return query(0, ns, 0, -1, spec, None, self.codec_options) ...
def get_message(self, dummy0, dummy1, use_cmd=False): """Get a getmore message.""" ns = _UJOIN % (self.db, self.coll) if use_cmd: ns = _UJOIN % (self.db, "$cmd") spec = self.as_command()[0] return query(0, ns, 0, -1, spec, None, self.codec_options) ...
[ "Get", "a", "getmore", "message", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L317-L328
[ "def", "get_message", "(", "self", ",", "dummy0", ",", "dummy1", ",", "use_cmd", "=", "False", ")", ":", "ns", "=", "_UJOIN", "%", "(", "self", ".", "db", ",", "self", ".", "coll", ")", "if", "use_cmd", ":", "ns", "=", "_UJOIN", "%", "(", "self",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_BulkWriteContext.legacy_write
A proxy for SocketInfo.legacy_write that handles event publishing.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def legacy_write(self, request_id, msg, max_doc_size, acknowledged, docs): """A proxy for SocketInfo.legacy_write that handles event publishing. """ if self.publish: duration = datetime.datetime.now() - self.start_time cmd = self._start(request_id, docs) start...
def legacy_write(self, request_id, msg, max_doc_size, acknowledged, docs): """A proxy for SocketInfo.legacy_write that handles event publishing. """ if self.publish: duration = datetime.datetime.now() - self.start_time cmd = self._start(request_id, docs) start...
[ "A", "proxy", "for", "SocketInfo", ".", "legacy_write", "that", "handles", "event", "publishing", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L542-L571
[ "def", "legacy_write", "(", "self", ",", "request_id", ",", "msg", ",", "max_doc_size", ",", "acknowledged", ",", "docs", ")", ":", "if", "self", ".", "publish", ":", "duration", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "self", ".",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_BulkWriteContext.write_command
A proxy for SocketInfo.write_command that handles event publishing.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def write_command(self, request_id, msg, docs): """A proxy for SocketInfo.write_command that handles event publishing. """ if self.publish: duration = datetime.datetime.now() - self.start_time self._start(request_id, docs) start = datetime.datetime.now() ...
def write_command(self, request_id, msg, docs): """A proxy for SocketInfo.write_command that handles event publishing. """ if self.publish: duration = datetime.datetime.now() - self.start_time self._start(request_id, docs) start = datetime.datetime.now() ...
[ "A", "proxy", "for", "SocketInfo", ".", "write_command", "that", "handles", "event", "publishing", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L573-L592
[ "def", "write_command", "(", "self", ",", "request_id", ",", "msg", ",", "docs", ")", ":", "if", "self", ".", "publish", ":", "duration", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "self", ".", "start_time", "self", ".", "_start", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_BulkWriteContext._start
Publish a CommandStartedEvent.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _start(self, request_id, docs): """Publish a CommandStartedEvent.""" cmd = self.command.copy() cmd[self.field] = docs self.listeners.publish_command_start( cmd, self.db_name, request_id, self.sock_info.address, self.op_id) return cmd
def _start(self, request_id, docs): """Publish a CommandStartedEvent.""" cmd = self.command.copy() cmd[self.field] = docs self.listeners.publish_command_start( cmd, self.db_name, request_id, self.sock_info.address, self.op_id) return cmd
[ "Publish", "a", "CommandStartedEvent", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L594-L601
[ "def", "_start", "(", "self", ",", "request_id", ",", "docs", ")", ":", "cmd", "=", "self", ".", "command", ".", "copy", "(", ")", "cmd", "[", "self", ".", "field", "]", "=", "docs", "self", ".", "listeners", ".", "publish_command_start", "(", "cmd",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_BulkWriteContext._succeed
Publish a CommandSucceededEvent.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _succeed(self, request_id, reply, duration): """Publish a CommandSucceededEvent.""" self.listeners.publish_command_success( duration, reply, self.name, request_id, self.sock_info.address, self.op_id)
def _succeed(self, request_id, reply, duration): """Publish a CommandSucceededEvent.""" self.listeners.publish_command_success( duration, reply, self.name, request_id, self.sock_info.address, self.op_id)
[ "Publish", "a", "CommandSucceededEvent", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L603-L607
[ "def", "_succeed", "(", "self", ",", "request_id", ",", "reply", ",", "duration", ")", ":", "self", ".", "listeners", ".", "publish_command_success", "(", "duration", ",", "reply", ",", "self", ".", "name", ",", "request_id", ",", "self", ".", "sock_info",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_BulkWriteContext._fail
Publish a CommandFailedEvent.
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
def _fail(self, request_id, failure, duration): """Publish a CommandFailedEvent.""" self.listeners.publish_command_failure( duration, failure, self.name, request_id, self.sock_info.address, self.op_id)
def _fail(self, request_id, failure, duration): """Publish a CommandFailedEvent.""" self.listeners.publish_command_failure( duration, failure, self.name, request_id, self.sock_info.address, self.op_id)
[ "Publish", "a", "CommandFailedEvent", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L609-L613
[ "def", "_fail", "(", "self", ",", "request_id", ",", "failure", ",", "duration", ")", ":", "self", ".", "listeners", ".", "publish_command_failure", "(", "duration", ",", "failure", ",", "self", ".", "name", ",", "request_id", ",", "self", ".", "sock_info"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_machine_bytes
Get the machine portion of an ObjectId.
tokumx/datadog_checks/tokumx/vendor/bson/objectid.py
def _machine_bytes(): """Get the machine portion of an ObjectId. """ machine_hash = hashlib.md5() if PY3: # gethostname() returns a unicode string in python 3.x # while update() requires a byte string. machine_hash.update(socket.gethostname().encode()) else: # Calling...
def _machine_bytes(): """Get the machine portion of an ObjectId. """ machine_hash = hashlib.md5() if PY3: # gethostname() returns a unicode string in python 3.x # while update() requires a byte string. machine_hash.update(socket.gethostname().encode()) else: # Calling...
[ "Get", "the", "machine", "portion", "of", "an", "ObjectId", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/objectid.py#L35-L46
[ "def", "_machine_bytes", "(", ")", ":", "machine_hash", "=", "hashlib", ".", "md5", "(", ")", "if", "PY3", ":", "# gethostname() returns a unicode string in python 3.x", "# while update() requires a byte string.", "machine_hash", ".", "update", "(", "socket", ".", "geth...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ObjectId.from_datetime
Create a dummy ObjectId instance with a specific generation time. This method is useful for doing range queries on a field containing :class:`ObjectId` instances. .. warning:: It is not safe to insert a document containing an ObjectId generated using this method. This met...
tokumx/datadog_checks/tokumx/vendor/bson/objectid.py
def from_datetime(cls, generation_time): """Create a dummy ObjectId instance with a specific generation time. This method is useful for doing range queries on a field containing :class:`ObjectId` instances. .. warning:: It is not safe to insert a document containing an Objec...
def from_datetime(cls, generation_time): """Create a dummy ObjectId instance with a specific generation time. This method is useful for doing range queries on a field containing :class:`ObjectId` instances. .. warning:: It is not safe to insert a document containing an Objec...
[ "Create", "a", "dummy", "ObjectId", "instance", "with", "a", "specific", "generation", "time", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/objectid.py#L113-L145
[ "def", "from_datetime", "(", "cls", ",", "generation_time", ")", ":", "if", "generation_time", ".", "utcoffset", "(", ")", "is", "not", "None", ":", "generation_time", "=", "generation_time", "-", "generation_time", ".", "utcoffset", "(", ")", "timestamp", "="...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ObjectId.is_valid
Checks if a `oid` string is valid or not. :Parameters: - `oid`: the object id to validate .. versionadded:: 2.3
tokumx/datadog_checks/tokumx/vendor/bson/objectid.py
def is_valid(cls, oid): """Checks if a `oid` string is valid or not. :Parameters: - `oid`: the object id to validate .. versionadded:: 2.3 """ if not oid: return False try: ObjectId(oid) return True except (InvalidI...
def is_valid(cls, oid): """Checks if a `oid` string is valid or not. :Parameters: - `oid`: the object id to validate .. versionadded:: 2.3 """ if not oid: return False try: ObjectId(oid) return True except (InvalidI...
[ "Checks", "if", "a", "oid", "string", "is", "valid", "or", "not", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/objectid.py#L148-L163
[ "def", "is_valid", "(", "cls", ",", "oid", ")", ":", "if", "not", "oid", ":", "return", "False", "try", ":", "ObjectId", "(", "oid", ")", "return", "True", "except", "(", "InvalidId", ",", "TypeError", ")", ":", "return", "False" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ObjectId.__generate
Generate a new value for this ObjectId.
tokumx/datadog_checks/tokumx/vendor/bson/objectid.py
def __generate(self): """Generate a new value for this ObjectId. """ # 4 bytes current time oid = struct.pack(">i", int(time.time())) # 3 bytes machine oid += ObjectId._machine_bytes # 2 bytes pid oid += struct.pack(">H", os.getpid() % 0xFFFF) ...
def __generate(self): """Generate a new value for this ObjectId. """ # 4 bytes current time oid = struct.pack(">i", int(time.time())) # 3 bytes machine oid += ObjectId._machine_bytes # 2 bytes pid oid += struct.pack(">H", os.getpid() % 0xFFFF) ...
[ "Generate", "a", "new", "value", "for", "this", "ObjectId", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/objectid.py#L165-L183
[ "def", "__generate", "(", "self", ")", ":", "# 4 bytes current time", "oid", "=", "struct", ".", "pack", "(", "\">i\"", ",", "int", "(", "time", ".", "time", "(", ")", ")", ")", "# 3 bytes machine", "oid", "+=", "ObjectId", ".", "_machine_bytes", "# 2 byte...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ObjectId.__validate
Validate and use the given id for this ObjectId. Raises TypeError if id is not an instance of (:class:`basestring` (:class:`str` or :class:`bytes` in python 3), ObjectId) and InvalidId if it is not a valid ObjectId. :Parameters: - `oid`: a valid ObjectId
tokumx/datadog_checks/tokumx/vendor/bson/objectid.py
def __validate(self, oid): """Validate and use the given id for this ObjectId. Raises TypeError if id is not an instance of (:class:`basestring` (:class:`str` or :class:`bytes` in python 3), ObjectId) and InvalidId if it is not a valid ObjectId. :Parameters: -...
def __validate(self, oid): """Validate and use the given id for this ObjectId. Raises TypeError if id is not an instance of (:class:`basestring` (:class:`str` or :class:`bytes` in python 3), ObjectId) and InvalidId if it is not a valid ObjectId. :Parameters: -...
[ "Validate", "and", "use", "the", "given", "id", "for", "this", "ObjectId", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/objectid.py#L185-L209
[ "def", "__validate", "(", "self", ",", "oid", ")", ":", "if", "isinstance", "(", "oid", ",", "ObjectId", ")", ":", "self", ".", "__id", "=", "oid", ".", "binary", "# bytes or unicode in python 2, str in python 3", "elif", "isinstance", "(", "oid", ",", "stri...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_master_address
Get the master address from the instance configuration
spark/datadog_checks/spark/spark.py
def _get_master_address(self, instance): """ Get the master address from the instance configuration """ master_address = instance.get(MASTER_ADDRESS) if master_address is None: master_address = instance.get(DEPRECATED_MASTER_ADDRESS) if master_address: ...
def _get_master_address(self, instance): """ Get the master address from the instance configuration """ master_address = instance.get(MASTER_ADDRESS) if master_address is None: master_address = instance.get(DEPRECATED_MASTER_ADDRESS) if master_address: ...
[ "Get", "the", "master", "address", "from", "the", "instance", "configuration" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L232-L249
[ "def", "_get_master_address", "(", "self", ",", "instance", ")", ":", "master_address", "=", "instance", ".", "get", "(", "MASTER_ADDRESS", ")", "if", "master_address", "is", "None", ":", "master_address", "=", "instance", ".", "get", "(", "DEPRECATED_MASTER_ADD...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_request_url
Get the request address, build with proxy if necessary
spark/datadog_checks/spark/spark.py
def _get_request_url(self, instance, url): """ Get the request address, build with proxy if necessary """ parsed = urlparse(url) _url = url if not (parsed.netloc and parsed.scheme) and is_affirmative(instance.get('spark_proxy_enabled', False)): master_address...
def _get_request_url(self, instance, url): """ Get the request address, build with proxy if necessary """ parsed = urlparse(url) _url = url if not (parsed.netloc and parsed.scheme) and is_affirmative(instance.get('spark_proxy_enabled', False)): master_address...
[ "Get", "the", "request", "address", "build", "with", "proxy", "if", "necessary" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L251-L263
[ "def", "_get_request_url", "(", "self", ",", "instance", ",", "url", ")", ":", "parsed", "=", "urlparse", "(", "url", ")", "_url", "=", "url", "if", "not", "(", "parsed", ".", "netloc", "and", "parsed", ".", "scheme", ")", "and", "is_affirmative", "(",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_running_apps
Determine what mode was specified
spark/datadog_checks/spark/spark.py
def _get_running_apps(self, instance, requests_config): """ Determine what mode was specified """ tags = instance.get('tags', []) if tags is None: tags = [] master_address = self._get_master_address(instance) # Get the cluster name from the instance co...
def _get_running_apps(self, instance, requests_config): """ Determine what mode was specified """ tags = instance.get('tags', []) if tags is None: tags = [] master_address = self._get_master_address(instance) # Get the cluster name from the instance co...
[ "Determine", "what", "mode", "was", "specified" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L265-L302
[ "def", "_get_running_apps", "(", "self", ",", "instance", ",", "requests_config", ")", ":", "tags", "=", "instance", ".", "get", "(", "'tags'", ",", "[", "]", ")", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "master_address", "=", "self", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._standalone_init
Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications
spark/datadog_checks/spark/spark.py
def _standalone_init(self, spark_master_address, pre_20_mode, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications """ metrics_json = self._rest_request_to_json( spark_master_address, SPARK_MASTER_STATE_PATH,...
def _standalone_init(self, spark_master_address, pre_20_mode, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications """ metrics_json = self._rest_request_to_json( spark_master_address, SPARK_MASTER_STATE_PATH,...
[ "Return", "a", "dictionary", "of", "{", "app_id", ":", "(", "app_name", "tracking_url", ")", "}", "for", "the", "running", "Spark", "applications" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L304-L348
[ "def", "_standalone_init", "(", "self", ",", "spark_master_address", ",", "pre_20_mode", ",", "requests_config", ",", "tags", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "spark_master_address", ",", "SPARK_MASTER_STATE_PATH", ",", "SPARK_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._mesos_init
Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications.
spark/datadog_checks/spark/spark.py
def _mesos_init(self, instance, master_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. """ running_apps = {} metrics_json = self._rest_request_to_json( master_address, MESOS_MASTER_APP_PAT...
def _mesos_init(self, instance, master_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. """ running_apps = {} metrics_json = self._rest_request_to_json( master_address, MESOS_MASTER_APP_PAT...
[ "Return", "a", "dictionary", "of", "{", "app_id", ":", "(", "app_name", "tracking_url", ")", "}", "for", "running", "Spark", "applications", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L350-L385
[ "def", "_mesos_init", "(", "self", ",", "instance", ",", "master_address", ",", "requests_config", ",", "tags", ")", ":", "running_apps", "=", "{", "}", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "master_address", ",", "MESOS_MASTER_APP_PATH",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._yarn_init
Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications.
spark/datadog_checks/spark/spark.py
def _yarn_init(self, rm_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. """ running_apps = self._yarn_get_running_spark_apps(rm_address, requests_config, tags) # Report success after gathering all met...
def _yarn_init(self, rm_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. """ running_apps = self._yarn_get_running_spark_apps(rm_address, requests_config, tags) # Report success after gathering all met...
[ "Return", "a", "dictionary", "of", "{", "app_id", ":", "(", "app_name", "tracking_url", ")", "}", "for", "running", "Spark", "applications", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L387-L401
[ "def", "_yarn_init", "(", "self", ",", "rm_address", ",", "requests_config", ",", "tags", ")", ":", "running_apps", "=", "self", ".", "_yarn_get_running_spark_apps", "(", "rm_address", ",", "requests_config", ",", "tags", ")", "# Report success after gathering all met...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_standalone_app_url
Return the application URL from the app info page on the Spark master. Due to a bug, we need to parse the HTML manually because we cannot fetch JSON data from HTTP interface.
spark/datadog_checks/spark/spark.py
def _get_standalone_app_url(self, app_id, spark_master_address, requests_config, tags): """ Return the application URL from the app info page on the Spark master. Due to a bug, we need to parse the HTML manually because we cannot fetch JSON data from HTTP interface. """ a...
def _get_standalone_app_url(self, app_id, spark_master_address, requests_config, tags): """ Return the application URL from the app info page on the Spark master. Due to a bug, we need to parse the HTML manually because we cannot fetch JSON data from HTTP interface. """ a...
[ "Return", "the", "application", "URL", "from", "the", "app", "info", "page", "on", "the", "Spark", "master", ".", "Due", "to", "a", "bug", "we", "need", "to", "parse", "the", "HTML", "manually", "because", "we", "cannot", "fetch", "JSON", "data", "from",...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L403-L422
[ "def", "_get_standalone_app_url", "(", "self", ",", "app_id", ",", "spark_master_address", ",", "requests_config", ",", "tags", ")", ":", "app_page", "=", "self", ".", "_rest_request", "(", "spark_master_address", ",", "SPARK_MASTER_APP_PATH", ",", "SPARK_STANDALONE_S...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._yarn_get_running_spark_apps
Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. The `app_id` returned is that of the YARN application. This will eventually be mapped into a Spark application ID.
spark/datadog_checks/spark/spark.py
def _yarn_get_running_spark_apps(self, rm_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. The `app_id` returned is that of the YARN application. This will eventually be mapped into a Spark application ID. ...
def _yarn_get_running_spark_apps(self, rm_address, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications. The `app_id` returned is that of the YARN application. This will eventually be mapped into a Spark application ID. ...
[ "Return", "a", "dictionary", "of", "{", "app_id", ":", "(", "app_name", "tracking_url", ")", "}", "for", "running", "Spark", "applications", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L424-L454
[ "def", "_yarn_get_running_spark_apps", "(", "self", ",", "rm_address", ",", "requests_config", ",", "tags", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "rm_address", ",", "YARN_APPS_PATH", ",", "YARN_SERVICE_CHECK", ",", "requests_config"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_spark_app_ids
Traverses the Spark application master in YARN to get a Spark application ID. Return a dictionary of {app_id: (app_name, tracking_url)} for Spark applications
spark/datadog_checks/spark/spark.py
def _get_spark_app_ids(self, running_apps, requests_config, tags): """ Traverses the Spark application master in YARN to get a Spark application ID. Return a dictionary of {app_id: (app_name, tracking_url)} for Spark applications """ spark_apps = {} for app_id, (app_name...
def _get_spark_app_ids(self, running_apps, requests_config, tags): """ Traverses the Spark application master in YARN to get a Spark application ID. Return a dictionary of {app_id: (app_name, tracking_url)} for Spark applications """ spark_apps = {} for app_id, (app_name...
[ "Traverses", "the", "Spark", "application", "master", "in", "YARN", "to", "get", "a", "Spark", "application", "ID", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L456-L475
[ "def", "_get_spark_app_ids", "(", "self", ",", "running_apps", ",", "requests_config", ",", "tags", ")", ":", "spark_apps", "=", "{", "}", "for", "app_id", ",", "(", "app_name", ",", "tracking_url", ")", "in", "iteritems", "(", "running_apps", ")", ":", "r...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._spark_job_metrics
Get metrics for each Spark job.
spark/datadog_checks/spark/spark.py
def _spark_job_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark job. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response = self._re...
def _spark_job_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark job. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response = self._re...
[ "Get", "metrics", "for", "each", "Spark", "job", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L477-L497
[ "def", "_spark_job_metrics", "(", "self", ",", "instance", ",", "running_apps", ",", "addl_tags", ",", "requests_config", ")", ":", "for", "app_id", ",", "(", "app_name", ",", "tracking_url", ")", "in", "iteritems", "(", "running_apps", ")", ":", "base_url", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._spark_executor_metrics
Get metrics for each Spark executor.
spark/datadog_checks/spark/spark.py
def _spark_executor_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark executor. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response ...
def _spark_executor_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark executor. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response ...
[ "Get", "metrics", "for", "each", "Spark", "executor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L521-L542
[ "def", "_spark_executor_metrics", "(", "self", ",", "instance", ",", "running_apps", ",", "addl_tags", ",", "requests_config", ")", ":", "for", "app_id", ",", "(", "app_name", ",", "tracking_url", ")", "in", "iteritems", "(", "running_apps", ")", ":", "base_ur...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._spark_rdd_metrics
Get metrics for each Spark RDD.
spark/datadog_checks/spark/spark.py
def _spark_rdd_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark RDD. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response = self._re...
def _spark_rdd_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each Spark RDD. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): base_url = self._get_request_url(instance, tracking_url) response = self._re...
[ "Get", "metrics", "for", "each", "Spark", "RDD", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L544-L562
[ "def", "_spark_rdd_metrics", "(", "self", ",", "instance", ",", "running_apps", ",", "addl_tags", ",", "requests_config", ")", ":", "for", "app_id", ",", "(", "app_name", ",", "tracking_url", ")", "in", "iteritems", "(", "running_apps", ")", ":", "base_url", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._spark_streaming_statistics_metrics
Get metrics for each application streaming statistics.
spark/datadog_checks/spark/spark.py
def _spark_streaming_statistics_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each application streaming statistics. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): try: base_url = self._get_request...
def _spark_streaming_statistics_metrics(self, instance, running_apps, addl_tags, requests_config): """ Get metrics for each application streaming statistics. """ for app_id, (app_name, tracking_url) in iteritems(running_apps): try: base_url = self._get_request...
[ "Get", "metrics", "for", "each", "application", "streaming", "statistics", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L564-L590
[ "def", "_spark_streaming_statistics_metrics", "(", "self", ",", "instance", ",", "running_apps", ",", "addl_tags", ",", "requests_config", ")", ":", "for", "app_id", ",", "(", "app_name", ",", "tracking_url", ")", "in", "iteritems", "(", "running_apps", ")", ":"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._set_metric
Set a metric
spark/datadog_checks/spark/spark.py
def _set_metric(self, metric_name, metric_type, value, tags=None): """ Set a metric """ if tags is None: tags = [] if metric_type == GAUGE: self.gauge(metric_name, value, tags=tags) elif metric_type == COUNT: self.count(metric_name, val...
def _set_metric(self, metric_name, metric_type, value, tags=None): """ Set a metric """ if tags is None: tags = [] if metric_type == GAUGE: self.gauge(metric_name, value, tags=tags) elif metric_type == COUNT: self.count(metric_name, val...
[ "Set", "a", "metric" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L605-L618
[ "def", "_set_metric", "(", "self", ",", "metric_name", ",", "metric_type", ",", "value", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "if", "metric_type", "==", "GAUGE", ":", "self", ".", "gauge", "(", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._rest_request
Query the given URL and return the response
spark/datadog_checks/spark/spark.py
def _rest_request(self, url, object_path, service_name, requests_config, tags, *args, **kwargs): """ Query the given URL and return the response """ service_check_tags = ['url:%s' % self._get_url_base(url)] + tags if object_path: url = self._join_url_dir(url, object_...
def _rest_request(self, url, object_path, service_name, requests_config, tags, *args, **kwargs): """ Query the given URL and return the response """ service_check_tags = ['url:%s' % self._get_url_base(url)] + tags if object_path: url = self._join_url_dir(url, object_...
[ "Query", "the", "given", "URL", "and", "return", "the", "response" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L620-L691
[ "def", "_rest_request", "(", "self", ",", "url", ",", "object_path", ",", "service_name", ",", "requests_config", ",", "tags", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "service_check_tags", "=", "[", "'url:%s'", "%", "self", ".", "_get_url_base...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._rest_request_to_json
Query the given URL and return the JSON response
spark/datadog_checks/spark/spark.py
def _rest_request_to_json(self, address, object_path, service_name, requests_config, tags, *args, **kwargs): """ Query the given URL and return the JSON response """ response = self._rest_request(address, object_path, service_name, requests_config, tags, *args, **kwargs) try: ...
def _rest_request_to_json(self, address, object_path, service_name, requests_config, tags, *args, **kwargs): """ Query the given URL and return the JSON response """ response = self._rest_request(address, object_path, service_name, requests_config, tags, *args, **kwargs) try: ...
[ "Query", "the", "given", "URL", "and", "return", "the", "JSON", "response" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L693-L711
[ "def", "_rest_request_to_json", "(", "self", ",", "address", ",", "object_path", ",", "service_name", ",", "requests_config", ",", "tags", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_rest_request", "(", "address", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SparkCheck._get_url_base
Return the base of a URL
spark/datadog_checks/spark/spark.py
def _get_url_base(cls, url): """ Return the base of a URL """ s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, '', '', ''])
def _get_url_base(cls, url): """ Return the base of a URL """ s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, '', '', ''])
[ "Return", "the", "base", "of", "a", "URL" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L725-L730
[ "def", "_get_url_base", "(", "cls", ",", "url", ")", ":", "s", "=", "urlsplit", "(", "url", ")", "return", "urlunsplit", "(", "[", "s", ".", "scheme", ",", "s", ".", "netloc", ",", "''", ",", "''", ",", "''", "]", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
parse_capacity_tags
This parses tags from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min
cisco_aci/datadog_checks/cisco_aci/helpers.py
def parse_capacity_tags(dn): """ This parses tags from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min """ tags = [] pod = get_pod_from_dn(dn) if pod: tags.append("fabric_pod_id:{}".format(pod)) node = get_node_from_dn(dn) ...
def parse_capacity_tags(dn): """ This parses tags from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min """ tags = [] pod = get_pod_from_dn(dn) if pod: tags.append("fabric_pod_id:{}".format(pod)) node = get_node_from_dn(dn) ...
[ "This", "parses", "tags", "from", "a", "dn", "designator", ".", "They", "look", "like", "this", ":", "topology", "/", "pod", "-", "1", "/", "node", "-", "101", "/", "sys", "/", "phys", "-", "[", "eth1", "/", "6", "]", "/", "CDeqptMacsectxpkts5min" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cisco_aci/datadog_checks/cisco_aci/helpers.py#L16-L29
[ "def", "parse_capacity_tags", "(", "dn", ")", ":", "tags", "=", "[", "]", "pod", "=", "get_pod_from_dn", "(", "dn", ")", "if", "pod", ":", "tags", ".", "append", "(", "\"fabric_pod_id:{}\"", ".", "format", "(", "pod", ")", ")", "node", "=", "get_node_f...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_event_tags_from_dn
This grabs the event tags from the dn designator. They look like this: uni/tn-DataDog/ap-DtDg-AP1-EcommerceApp/epg-DtDg-Ecomm/HDl2IngrPktsAg1h
cisco_aci/datadog_checks/cisco_aci/helpers.py
def get_event_tags_from_dn(dn): """ This grabs the event tags from the dn designator. They look like this: uni/tn-DataDog/ap-DtDg-AP1-EcommerceApp/epg-DtDg-Ecomm/HDl2IngrPktsAg1h """ tags = [] node = get_node_from_dn(dn) if node: tags.append("node:" + node) app = get_app_from_dn(...
def get_event_tags_from_dn(dn): """ This grabs the event tags from the dn designator. They look like this: uni/tn-DataDog/ap-DtDg-AP1-EcommerceApp/epg-DtDg-Ecomm/HDl2IngrPktsAg1h """ tags = [] node = get_node_from_dn(dn) if node: tags.append("node:" + node) app = get_app_from_dn(...
[ "This", "grabs", "the", "event", "tags", "from", "the", "dn", "designator", ".", "They", "look", "like", "this", ":", "uni", "/", "tn", "-", "DataDog", "/", "ap", "-", "DtDg", "-", "AP1", "-", "EcommerceApp", "/", "epg", "-", "DtDg", "-", "Ecomm", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cisco_aci/datadog_checks/cisco_aci/helpers.py#L98-L122
[ "def", "get_event_tags_from_dn", "(", "dn", ")", ":", "tags", "=", "[", "]", "node", "=", "get_node_from_dn", "(", "dn", ")", "if", "node", ":", "tags", ".", "append", "(", "\"node:\"", "+", "node", ")", "app", "=", "get_app_from_dn", "(", "dn", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_hostname_from_dn
This parses the hostname from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min
cisco_aci/datadog_checks/cisco_aci/helpers.py
def get_hostname_from_dn(dn): """ This parses the hostname from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min """ pod = get_pod_from_dn(dn) node = get_node_from_dn(dn) if pod and node: return "pod-{}-node-{}".format(pod, node) ...
def get_hostname_from_dn(dn): """ This parses the hostname from a dn designator. They look like this: topology/pod-1/node-101/sys/phys-[eth1/6]/CDeqptMacsectxpkts5min """ pod = get_pod_from_dn(dn) node = get_node_from_dn(dn) if pod and node: return "pod-{}-node-{}".format(pod, node) ...
[ "This", "parses", "the", "hostname", "from", "a", "dn", "designator", ".", "They", "look", "like", "this", ":", "topology", "/", "pod", "-", "1", "/", "node", "-", "101", "/", "sys", "/", "phys", "-", "[", "eth1", "/", "6", "]", "/", "CDeqptMacsect...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cisco_aci/datadog_checks/cisco_aci/helpers.py#L125-L135
[ "def", "get_hostname_from_dn", "(", "dn", ")", ":", "pod", "=", "get_pod_from_dn", "(", "dn", ")", "node", "=", "get_node_from_dn", "(", "dn", ")", "if", "pod", "and", "node", ":", "return", "\"pod-{}-node-{}\"", ".", "format", "(", "pod", ",", "node", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_attributes
the json objects look like this: { "objType": { "attributes": { ... } } It always has the attributes nested below the object type This helper provides a way of getting at the attributes
cisco_aci/datadog_checks/cisco_aci/helpers.py
def get_attributes(obj): """ the json objects look like this: { "objType": { "attributes": { ... } } It always has the attributes nested below the object type This helper provides a way of getting at the attributes """ if not obj or type(obj) is not dict: re...
def get_attributes(obj): """ the json objects look like this: { "objType": { "attributes": { ... } } It always has the attributes nested below the object type This helper provides a way of getting at the attributes """ if not obj or type(obj) is not dict: re...
[ "the", "json", "objects", "look", "like", "this", ":", "{", "objType", ":", "{", "attributes", ":", "{", "...", "}", "}", "It", "always", "has", "the", "attributes", "nested", "below", "the", "object", "type", "This", "helper", "provides", "a", "way", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cisco_aci/datadog_checks/cisco_aci/helpers.py#L153-L190
[ "def", "get_attributes", "(", "obj", ")", ":", "if", "not", "obj", "or", "type", "(", "obj", ")", "is", "not", "dict", ":", "return", "{", "}", "keys", "=", "list", "(", "obj", ".", "keys", "(", ")", ")", "if", "len", "(", "keys", ")", ">", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
check_metric_can_be_zero
When a counter is reset, don't send a zero because it will look bad on the graphs This checks if the zero makes sense or not
cisco_aci/datadog_checks/cisco_aci/helpers.py
def check_metric_can_be_zero(metric_name, metric_value, json_attributes): """ When a counter is reset, don't send a zero because it will look bad on the graphs This checks if the zero makes sense or not """ if "last" in metric_name.lower(): return True if not metric_value: return...
def check_metric_can_be_zero(metric_name, metric_value, json_attributes): """ When a counter is reset, don't send a zero because it will look bad on the graphs This checks if the zero makes sense or not """ if "last" in metric_name.lower(): return True if not metric_value: return...
[ "When", "a", "counter", "is", "reset", "don", "t", "send", "a", "zero", "because", "it", "will", "look", "bad", "on", "the", "graphs", "This", "checks", "if", "the", "zero", "makes", "sense", "or", "not" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cisco_aci/datadog_checks/cisco_aci/helpers.py#L193-L210
[ "def", "check_metric_can_be_zero", "(", "metric_name", ",", "metric_value", ",", "json_attributes", ")", ":", "if", "\"last\"", "in", "metric_name", ".", "lower", "(", ")", ":", "return", "True", "if", "not", "metric_value", ":", "return", "False", "try", ":",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
create
Create scaffolding for a new integration.
datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py
def create(ctx, name, integration_type, location, non_interactive, quiet, dry_run): """Create scaffolding for a new integration.""" repo_choice = ctx.obj['repo_choice'] root = resolve_path(location) if location else get_root() path_sep = os.path.sep integration_dir = os.path.join(root, normalize_pa...
def create(ctx, name, integration_type, location, non_interactive, quiet, dry_run): """Create scaffolding for a new integration.""" repo_choice = ctx.obj['repo_choice'] root = resolve_path(location) if location else get_root() path_sep = os.path.sep integration_dir = os.path.join(root, normalize_pa...
[ "Create", "scaffolding", "for", "a", "new", "integration", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py#L95-L139
[ "def", "create", "(", "ctx", ",", "name", ",", "integration_type", ",", "location", ",", "non_interactive", ",", "quiet", ",", "dry_run", ")", ":", "repo_choice", "=", "ctx", ".", "obj", "[", "'repo_choice'", "]", "root", "=", "resolve_path", "(", "locatio...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
freeze
Freezes any mutable object including dictionaries and lists for hashing. Accepts nested dictionaries.
datadog_checks_base/datadog_checks/base/utils/containers.py
def freeze(o): """ Freezes any mutable object including dictionaries and lists for hashing. Accepts nested dictionaries. """ if isinstance(o, (tuple, list)): return tuple(sorted(freeze(e) for e in o)) if isinstance(o, dict): return tuple(sorted((k, freeze(v)) for k, v in iterite...
def freeze(o): """ Freezes any mutable object including dictionaries and lists for hashing. Accepts nested dictionaries. """ if isinstance(o, (tuple, list)): return tuple(sorted(freeze(e) for e in o)) if isinstance(o, dict): return tuple(sorted((k, freeze(v)) for k, v in iterite...
[ "Freezes", "any", "mutable", "object", "including", "dictionaries", "and", "lists", "for", "hashing", ".", "Accepts", "nested", "dictionaries", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/containers.py#L7-L21
[ "def", "freeze", "(", "o", ")", ":", "if", "isinstance", "(", "o", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "tuple", "(", "sorted", "(", "freeze", "(", "e", ")", "for", "e", "in", "o", ")", ")", "if", "isinstance", "(", "o", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_decimal_to_128
Converts a decimal.Decimal to BID (high bits, low bits). :Parameters: - `value`: An instance of decimal.Decimal
tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py
def _decimal_to_128(value): """Converts a decimal.Decimal to BID (high bits, low bits). :Parameters: - `value`: An instance of decimal.Decimal """ with decimal.localcontext(_DEC128_CTX) as ctx: value = ctx.create_decimal(value) if value.is_infinite(): return _NINF if value.is...
def _decimal_to_128(value): """Converts a decimal.Decimal to BID (high bits, low bits). :Parameters: - `value`: An instance of decimal.Decimal """ with decimal.localcontext(_DEC128_CTX) as ctx: value = ctx.create_decimal(value) if value.is_infinite(): return _NINF if value.is...
[ "Converts", "a", "decimal", ".", "Decimal", "to", "BID", "(", "high", "bits", "low", "bits", ")", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py#L107-L153
[ "def", "_decimal_to_128", "(", "value", ")", ":", "with", "decimal", ".", "localcontext", "(", "_DEC128_CTX", ")", "as", "ctx", ":", "value", "=", "ctx", ".", "create_decimal", "(", "value", ")", "if", "value", ".", "is_infinite", "(", ")", ":", "return"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Decimal128.to_decimal
Returns an instance of :class:`decimal.Decimal` for this :class:`Decimal128`.
tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py
def to_decimal(self): """Returns an instance of :class:`decimal.Decimal` for this :class:`Decimal128`. """ high = self.__high low = self.__low sign = 1 if (high & _SIGN) else 0 if (high & _SNAN) == _SNAN: return decimal.Decimal((sign, (), 'N')) ...
def to_decimal(self): """Returns an instance of :class:`decimal.Decimal` for this :class:`Decimal128`. """ high = self.__high low = self.__low sign = 1 if (high & _SIGN) else 0 if (high & _SNAN) == _SNAN: return decimal.Decimal((sign, (), 'N')) ...
[ "Returns", "an", "instance", "of", ":", "class", ":", "decimal", ".", "Decimal", "for", "this", ":", "class", ":", "Decimal128", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py#L266-L307
[ "def", "to_decimal", "(", "self", ")", ":", "high", "=", "self", ".", "__high", "low", "=", "self", ".", "__low", "sign", "=", "1", "if", "(", "high", "&", "_SIGN", ")", "else", "0", "if", "(", "high", "&", "_SNAN", ")", "==", "_SNAN", ":", "re...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Decimal128.from_bid
Create an instance of :class:`Decimal128` from Binary Integer Decimal string. :Parameters: - `value`: 16 byte string (128-bit IEEE 754-2008 decimal floating point in Binary Integer Decimal (BID) format).
tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py
def from_bid(cls, value): """Create an instance of :class:`Decimal128` from Binary Integer Decimal string. :Parameters: - `value`: 16 byte string (128-bit IEEE 754-2008 decimal floating point in Binary Integer Decimal (BID) format). """ if not isinstance(va...
def from_bid(cls, value): """Create an instance of :class:`Decimal128` from Binary Integer Decimal string. :Parameters: - `value`: 16 byte string (128-bit IEEE 754-2008 decimal floating point in Binary Integer Decimal (BID) format). """ if not isinstance(va...
[ "Create", "an", "instance", "of", ":", "class", ":", "Decimal128", "from", "Binary", "Integer", "Decimal", "string", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py#L310-L322
[ "def", "from_bid", "(", "cls", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"value must be an instance of bytes\"", ")", "if", "len", "(", "value", ")", "!=", "16", ":", "raise", "V...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
IBMMQConfig._compile_tag_re
Compile regex strings from queue_tag_re option and return list of compiled regex/tag pairs
ibm_mq/datadog_checks/ibm_mq/config.py
def _compile_tag_re(self): """ Compile regex strings from queue_tag_re option and return list of compiled regex/tag pairs """ queue_tag_list = [] for regex_str, tags in iteritems(self._queue_tag_re): try: queue_tag_list.append([re.compile(regex_str), [...
def _compile_tag_re(self): """ Compile regex strings from queue_tag_re option and return list of compiled regex/tag pairs """ queue_tag_list = [] for regex_str, tags in iteritems(self._queue_tag_re): try: queue_tag_list.append([re.compile(regex_str), [...
[ "Compile", "regex", "strings", "from", "queue_tag_re", "option", "and", "return", "list", "of", "compiled", "regex", "/", "tag", "pairs" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ibm_mq/datadog_checks/ibm_mq/config.py#L78-L88
[ "def", "_compile_tag_re", "(", "self", ")", ":", "queue_tag_list", "=", "[", "]", "for", "regex_str", ",", "tags", "in", "iteritems", "(", "self", ".", "_queue_tag_re", ")", ":", "try", ":", "queue_tag_list", ".", "append", "(", "[", "re", ".", "compile"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_get_server_type
Determine the server type from an ismaster response.
tokumx/datadog_checks/tokumx/vendor/pymongo/ismaster.py
def _get_server_type(doc): """Determine the server type from an ismaster response.""" if not doc.get('ok'): return SERVER_TYPE.Unknown if doc.get('isreplicaset'): return SERVER_TYPE.RSGhost elif doc.get('setName'): if doc.get('hidden'): return SERVER_TYPE.RSOther ...
def _get_server_type(doc): """Determine the server type from an ismaster response.""" if not doc.get('ok'): return SERVER_TYPE.Unknown if doc.get('isreplicaset'): return SERVER_TYPE.RSGhost elif doc.get('setName'): if doc.get('hidden'): return SERVER_TYPE.RSOther ...
[ "Determine", "the", "server", "type", "from", "an", "ismaster", "response", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/ismaster.py#L24-L45
[ "def", "_get_server_type", "(", "doc", ")", ":", "if", "not", "doc", ".", "get", "(", "'ok'", ")", ":", "return", "SERVER_TYPE", ".", "Unknown", "if", "doc", ".", "get", "(", "'isreplicaset'", ")", ":", "return", "SERVER_TYPE", ".", "RSGhost", "elif", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
IsMaster.all_hosts
List of hosts, passives, and arbiters known to this server.
tokumx/datadog_checks/tokumx/vendor/pymongo/ismaster.py
def all_hosts(self): """List of hosts, passives, and arbiters known to this server.""" return set(imap(common.clean_node, itertools.chain( self._doc.get('hosts', []), self._doc.get('passives', []), self._doc.get('arbiters', []))))
def all_hosts(self): """List of hosts, passives, and arbiters known to this server.""" return set(imap(common.clean_node, itertools.chain( self._doc.get('hosts', []), self._doc.get('passives', []), self._doc.get('arbiters', []))))
[ "List", "of", "hosts", "passives", "and", "arbiters", "known", "to", "this", "server", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/ismaster.py#L77-L82
[ "def", "all_hosts", "(", "self", ")", ":", "return", "set", "(", "imap", "(", "common", ".", "clean_node", ",", "itertools", ".", "chain", "(", "self", ".", "_doc", ".", "get", "(", "'hosts'", ",", "[", "]", ")", ",", "self", ".", "_doc", ".", "g...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
GitlabRunnerCheck._create_gitlab_runner_prometheus_instance
Set up the gitlab_runner instance so it can be used in OpenMetricsBaseCheck
gitlab_runner/datadog_checks/gitlab_runner/gitlab_runner.py
def _create_gitlab_runner_prometheus_instance(self, instance, init_config): """ Set up the gitlab_runner instance so it can be used in OpenMetricsBaseCheck """ # Mapping from Prometheus metrics names to Datadog ones # For now it's a 1:1 mapping allowed_metrics = init_conf...
def _create_gitlab_runner_prometheus_instance(self, instance, init_config): """ Set up the gitlab_runner instance so it can be used in OpenMetricsBaseCheck """ # Mapping from Prometheus metrics names to Datadog ones # For now it's a 1:1 mapping allowed_metrics = init_conf...
[ "Set", "up", "the", "gitlab_runner", "instance", "so", "it", "can", "be", "used", "in", "OpenMetricsBaseCheck" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/gitlab_runner/datadog_checks/gitlab_runner/gitlab_runner.py#L62-L87
[ "def", "_create_gitlab_runner_prometheus_instance", "(", "self", ",", "instance", ",", "init_config", ")", ":", "# Mapping from Prometheus metrics names to Datadog ones", "# For now it's a 1:1 mapping", "allowed_metrics", "=", "init_config", ".", "get", "(", "'allowed_metrics'", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
HDFSDataNode._get_jmx_data
Get namenode beans data from JMX endpoint
hdfs_datanode/datadog_checks/hdfs_datanode/hdfs_datanode.py
def _get_jmx_data(self, instance, jmx_address, tags): """ Get namenode beans data from JMX endpoint """ response = self._rest_request_to_json( instance, jmx_address, self.JMX_PATH, {'qry': self.HDFS_DATANODE_BEAN_NAME}, tags=tags ) beans = response.get('beans'...
def _get_jmx_data(self, instance, jmx_address, tags): """ Get namenode beans data from JMX endpoint """ response = self._rest_request_to_json( instance, jmx_address, self.JMX_PATH, {'qry': self.HDFS_DATANODE_BEAN_NAME}, tags=tags ) beans = response.get('beans'...
[ "Get", "namenode", "beans", "data", "from", "JMX", "endpoint" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_datanode/datadog_checks/hdfs_datanode/hdfs_datanode.py#L69-L77
[ "def", "_get_jmx_data", "(", "self", ",", "instance", ",", "jmx_address", ",", "tags", ")", ":", "response", "=", "self", ".", "_rest_request_to_json", "(", "instance", ",", "jmx_address", ",", "self", ".", "JMX_PATH", ",", "{", "'qry'", ":", "self", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
HDFSDataNode._hdfs_datanode_metrics
Process HDFS Datanode metrics from given beans
hdfs_datanode/datadog_checks/hdfs_datanode/hdfs_datanode.py
def _hdfs_datanode_metrics(self, beans, tags): """ Process HDFS Datanode metrics from given beans """ # Only get the first bean bean = next(iter(beans)) bean_name = bean.get('name') self.log.debug("Bean name retrieved: {}".format(bean_name)) for metric, ...
def _hdfs_datanode_metrics(self, beans, tags): """ Process HDFS Datanode metrics from given beans """ # Only get the first bean bean = next(iter(beans)) bean_name = bean.get('name') self.log.debug("Bean name retrieved: {}".format(bean_name)) for metric, ...
[ "Process", "HDFS", "Datanode", "metrics", "from", "given", "beans" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_datanode/datadog_checks/hdfs_datanode/hdfs_datanode.py#L79-L92
[ "def", "_hdfs_datanode_metrics", "(", "self", ",", "beans", ",", "tags", ")", ":", "# Only get the first bean", "bean", "=", "next", "(", "iter", "(", "beans", ")", ")", "bean_name", "=", "bean", ".", "get", "(", "'name'", ")", "self", ".", "log", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
requirements
Write the `requirements-agent-release.txt` file at the root of the repo listing all the Agent-based integrations pinned at the version they currently have in HEAD.
datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/requirements.py
def requirements(ctx): """Write the `requirements-agent-release.txt` file at the root of the repo listing all the Agent-based integrations pinned at the version they currently have in HEAD. """ echo_info('Freezing check releases') checks = get_valid_checks() checks.remove('datadog_checks_dev...
def requirements(ctx): """Write the `requirements-agent-release.txt` file at the root of the repo listing all the Agent-based integrations pinned at the version they currently have in HEAD. """ echo_info('Freezing check releases') checks = get_valid_checks() checks.remove('datadog_checks_dev...
[ "Write", "the", "requirements", "-", "agent", "-", "release", ".", "txt", "file", "at", "the", "root", "of", "the", "repo", "listing", "all", "the", "Agent", "-", "based", "integrations", "pinned", "at", "the", "version", "they", "currently", "have", "in",...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/requirements.py#L20-L46
[ "def", "requirements", "(", "ctx", ")", ":", "echo_info", "(", "'Freezing check releases'", ")", "checks", "=", "get_valid_checks", "(", ")", "checks", ".", "remove", "(", "'datadog_checks_dev'", ")", "entries", "=", "[", "]", "for", "check", "in", "checks", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Nginx._nest_payload
Nest a payload in a dict under the keys contained in `keys`
nginx/datadog_checks/nginx/nginx.py
def _nest_payload(self, keys, payload): """ Nest a payload in a dict under the keys contained in `keys` """ if len(keys) == 0: return payload return {keys[0]: self._nest_payload(keys[1:], payload)}
def _nest_payload(self, keys, payload): """ Nest a payload in a dict under the keys contained in `keys` """ if len(keys) == 0: return payload return {keys[0]: self._nest_payload(keys[1:], payload)}
[ "Nest", "a", "payload", "in", "a", "dict", "under", "the", "keys", "contained", "in", "keys" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/nginx/datadog_checks/nginx/nginx.py#L194-L201
[ "def", "_nest_payload", "(", "self", ",", "keys", ",", "payload", ")", ":", "if", "len", "(", "keys", ")", "==", "0", ":", "return", "payload", "return", "{", "keys", "[", "0", "]", ":", "self", ".", "_nest_payload", "(", "keys", "[", "1", ":", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Nginx._flatten_json
Recursively flattens the nginx json object. Returns the following: [(metric_name, value, tags)]
nginx/datadog_checks/nginx/nginx.py
def _flatten_json(cls, metric_base, val, tags): """ Recursively flattens the nginx json object. Returns the following: [(metric_name, value, tags)] """ output = [] if isinstance(val, dict): # Pull out the server as a tag instead of trying to read as a metric ...
def _flatten_json(cls, metric_base, val, tags): """ Recursively flattens the nginx json object. Returns the following: [(metric_name, value, tags)] """ output = [] if isinstance(val, dict): # Pull out the server as a tag instead of trying to read as a metric ...
[ "Recursively", "flattens", "the", "nginx", "json", "object", ".", "Returns", "the", "following", ":", "[", "(", "metric_name", "value", "tags", ")", "]" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/nginx/datadog_checks/nginx/nginx.py#L275-L320
[ "def", "_flatten_json", "(", "cls", ",", "metric_base", ",", "val", ",", "tags", ")", ":", "output", "=", "[", "]", "if", "isinstance", "(", "val", ",", "dict", ")", ":", "# Pull out the server as a tag instead of trying to read as a metric", "if", "'server'", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_agent_tags
Return a list of tags from integrations-core representing an Agent release, sorted by more recent first.
datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/common.py
def get_agent_tags(since, to): """ Return a list of tags from integrations-core representing an Agent release, sorted by more recent first. """ agent_tags = sorted(parse_version_info(t) for t in git_tag_list(r'^\d+\.\d+\.\d+$')) # default value for `to` is the latest tag if to: to =...
def get_agent_tags(since, to): """ Return a list of tags from integrations-core representing an Agent release, sorted by more recent first. """ agent_tags = sorted(parse_version_info(t) for t in git_tag_list(r'^\d+\.\d+\.\d+$')) # default value for `to` is the latest tag if to: to =...
[ "Return", "a", "list", "of", "tags", "from", "integrations", "-", "core", "representing", "an", "Agent", "release", "sorted", "by", "more", "recent", "first", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/common.py#L9-L28
[ "def", "get_agent_tags", "(", "since", ",", "to", ")", ":", "agent_tags", "=", "sorted", "(", "parse_version_info", "(", "t", ")", "for", "t", "in", "git_tag_list", "(", "r'^\\d+\\.\\d+\\.\\d+$'", ")", ")", "# default value for `to` is the latest tag", "if", "to",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
run
Run commands in the proper repo.
datadog_checks_dev/datadog_checks/dev/tooling/commands/run.py
def run(ctx, args): """Run commands in the proper repo.""" if not args: click.echo(ctx.get_help()) return with chdir(get_root()): result = run_command(args) ctx.exit(result.code)
def run(ctx, args): """Run commands in the proper repo.""" if not args: click.echo(ctx.get_help()) return with chdir(get_root()): result = run_command(args) ctx.exit(result.code)
[ "Run", "commands", "in", "the", "proper", "repo", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/run.py#L15-L24
[ "def", "run", "(", "ctx", ",", "args", ")", ":", "if", "not", "args", ":", "click", ".", "echo", "(", "ctx", ".", "get_help", "(", ")", ")", "return", "with", "chdir", "(", "get_root", "(", ")", ")", ":", "result", "=", "run_command", "(", "args"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
TeamCityCheck._normalize_server_url
Check if the server URL starts with a HTTP or HTTPS scheme, fall back to http if not present
teamcity/datadog_checks/teamcity/teamcity.py
def _normalize_server_url(self, server): """ Check if the server URL starts with a HTTP or HTTPS scheme, fall back to http if not present """ server = server if server.startswith(("http://", "https://")) else "http://{}".format(server) return server
def _normalize_server_url(self, server): """ Check if the server URL starts with a HTTP or HTTPS scheme, fall back to http if not present """ server = server if server.startswith(("http://", "https://")) else "http://{}".format(server) return server
[ "Check", "if", "the", "server", "URL", "starts", "with", "a", "HTTP", "or", "HTTPS", "scheme", "fall", "back", "to", "http", "if", "not", "present" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/teamcity/datadog_checks/teamcity/teamcity.py#L91-L96
[ "def", "_normalize_server_url", "(", "self", ",", "server", ")", ":", "server", "=", "server", "if", "server", ".", "startswith", "(", "(", "\"http://\"", ",", "\"https://\"", ")", ")", "else", "\"http://{}\"", ".", "format", "(", "server", ")", "return", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ESCheck._get_es_version
Get the running version of elasticsearch.
elastic/datadog_checks/elastic/elastic.py
def _get_es_version(self, config): """ Get the running version of elasticsearch. """ try: data = self._get_data(config.url, config, send_sc=False) # pre-release versions of elasticearch are suffixed with -rcX etc.. # peel that off so that the map below...
def _get_es_version(self, config): """ Get the running version of elasticsearch. """ try: data = self._get_data(config.url, config, send_sc=False) # pre-release versions of elasticearch are suffixed with -rcX etc.. # peel that off so that the map below...
[ "Get", "the", "running", "version", "of", "elasticsearch", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/elastic/datadog_checks/elastic/elastic.py#L100-L118
[ "def", "_get_es_version", "(", "self", ",", "config", ")", ":", "try", ":", "data", "=", "self", ".", "_get_data", "(", "config", ".", "url", ",", "config", ",", "send_sc", "=", "False", ")", "# pre-release versions of elasticearch are suffixed with -rcX etc..", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ESCheck._join_url
overrides `urlparse.urljoin` since it removes base url path https://docs.python.org/2/library/urlparse.html#urlparse.urljoin
elastic/datadog_checks/elastic/elastic.py
def _join_url(self, base, url, admin_forwarder=False): """ overrides `urlparse.urljoin` since it removes base url path https://docs.python.org/2/library/urlparse.html#urlparse.urljoin """ if admin_forwarder: return base + url else: return urljoin(b...
def _join_url(self, base, url, admin_forwarder=False): """ overrides `urlparse.urljoin` since it removes base url path https://docs.python.org/2/library/urlparse.html#urlparse.urljoin """ if admin_forwarder: return base + url else: return urljoin(b...
[ "overrides", "urlparse", ".", "urljoin", "since", "it", "removes", "base", "url", "path", "https", ":", "//", "docs", ".", "python", ".", "org", "/", "2", "/", "library", "/", "urlparse", ".", "html#urlparse", ".", "urljoin" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/elastic/datadog_checks/elastic/elastic.py#L120-L128
[ "def", "_join_url", "(", "self", ",", "base", ",", "url", ",", "admin_forwarder", "=", "False", ")", ":", "if", "admin_forwarder", ":", "return", "base", "+", "url", "else", ":", "return", "urljoin", "(", "base", ",", "url", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ESCheck._get_urls
Compute the URLs we need to hit depending on the running ES version
elastic/datadog_checks/elastic/elastic.py
def _get_urls(self, version, cluster_stats): """ Compute the URLs we need to hit depending on the running ES version """ pshard_stats_url = "/_stats" health_url = "/_cluster/health" if version >= [0, 90, 10]: pending_tasks_url = "/_cluster/pending_tasks" ...
def _get_urls(self, version, cluster_stats): """ Compute the URLs we need to hit depending on the running ES version """ pshard_stats_url = "/_stats" health_url = "/_cluster/health" if version >= [0, 90, 10]: pending_tasks_url = "/_cluster/pending_tasks" ...
[ "Compute", "the", "URLs", "we", "need", "to", "hit", "depending", "on", "the", "running", "ES", "version" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/elastic/datadog_checks/elastic/elastic.py#L165-L183
[ "def", "_get_urls", "(", "self", ",", "version", ",", "cluster_stats", ")", ":", "pshard_stats_url", "=", "\"/_stats\"", "health_url", "=", "\"/_cluster/health\"", "if", "version", ">=", "[", "0", ",", "90", ",", "10", "]", ":", "pending_tasks_url", "=", "\"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ESCheck._get_data
Hit a given URL and return the parsed json
elastic/datadog_checks/elastic/elastic.py
def _get_data(self, url, config, send_sc=True): """ Hit a given URL and return the parsed json """ # Load basic authentication configuration, if available. if config.username and config.password: auth = (config.username, config.password) else: auth...
def _get_data(self, url, config, send_sc=True): """ Hit a given URL and return the parsed json """ # Load basic authentication configuration, if available. if config.username and config.password: auth = (config.username, config.password) else: auth...
[ "Hit", "a", "given", "URL", "and", "return", "the", "parsed", "json" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/elastic/datadog_checks/elastic/elastic.py#L185-L233
[ "def", "_get_data", "(", "self", ",", "url", ",", "config", ",", "send_sc", "=", "True", ")", ":", "# Load basic authentication configuration, if available.", "if", "config", ".", "username", "and", "config", ".", "password", ":", "auth", "=", "(", "config", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ESCheck._process_metric
data: dictionary containing all the stats metric: datadog metric path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue xform: a lambda to apply to the numerical value
elastic/datadog_checks/elastic/elastic.py
def _process_metric(self, data, metric, xtype, path, xform=None, tags=None, hostname=None): """ data: dictionary containing all the stats metric: datadog metric path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue xform: a lambda to apply to the numerical valu...
def _process_metric(self, data, metric, xtype, path, xform=None, tags=None, hostname=None): """ data: dictionary containing all the stats metric: datadog metric path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue xform: a lambda to apply to the numerical valu...
[ "data", ":", "dictionary", "containing", "all", "the", "stats", "metric", ":", "datadog", "metric", "path", ":", "corresponding", "path", "in", "data", "flattened", "e", ".", "g", ".", "thread_pool", ".", "bulk", ".", "queue", "xform", ":", "a", "lambda", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/elastic/datadog_checks/elastic/elastic.py#L284-L308
[ "def", "_process_metric", "(", "self", ",", "data", ",", "metric", ",", "xtype", ",", "path", ",", "xform", "=", "None", ",", "tags", "=", "None", ",", "hostname", "=", "None", ")", ":", "value", "=", "data", "# Traverse the nested dictionaries", "for", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Limiter.reset
Resets state and uid set. To be called asap to free memory
datadog_checks_base/datadog_checks/base/utils/limiter.py
def reset(self): """ Resets state and uid set. To be called asap to free memory """ self.reached_limit = False self.count = 0 self.seen.clear()
def reset(self): """ Resets state and uid set. To be called asap to free memory """ self.reached_limit = False self.count = 0 self.seen.clear()
[ "Resets", "state", "and", "uid", "set", ".", "To", "be", "called", "asap", "to", "free", "memory" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/limiter.py#L29-L35
[ "def", "reset", "(", "self", ")", ":", "self", ".", "reached_limit", "=", "False", "self", ".", "count", "=", "0", "self", ".", "seen", ".", "clear", "(", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Limiter.is_reached
is_reached is to be called for every object that counts towards the limit. - When called with no uid, the Limiter assumes this is a new object and unconditionally increments the counter (less CPU and memory usage). - When a given object can be passed multiple times, a uid must be provided to ...
datadog_checks_base/datadog_checks/base/utils/limiter.py
def is_reached(self, uid=None): """ is_reached is to be called for every object that counts towards the limit. - When called with no uid, the Limiter assumes this is a new object and unconditionally increments the counter (less CPU and memory usage). - When a given object can be ...
def is_reached(self, uid=None): """ is_reached is to be called for every object that counts towards the limit. - When called with no uid, the Limiter assumes this is a new object and unconditionally increments the counter (less CPU and memory usage). - When a given object can be ...
[ "is_reached", "is", "to", "be", "called", "for", "every", "object", "that", "counts", "towards", "the", "limit", ".", "-", "When", "called", "with", "no", "uid", "the", "Limiter", "assumes", "this", "is", "a", "new", "object", "and", "unconditionally", "in...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/limiter.py#L37-L68
[ "def", "is_reached", "(", "self", ",", "uid", "=", "None", ")", ":", "if", "self", ".", "reached_limit", ":", "return", "True", "if", "uid", ":", "if", "uid", "in", "self", ".", "seen", ":", "return", "False", "self", ".", "count", "+=", "1", "self...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._get_broker_offsets
Fetch highwater offsets for each topic/partition from Kafka cluster. Do this for all partitions in the cluster because even if it has no consumers, we may want to measure whether producers are successfully producing. No need to limit this for performance because fetching broker offsets ...
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _get_broker_offsets(self, instance, topics): """ Fetch highwater offsets for each topic/partition from Kafka cluster. Do this for all partitions in the cluster because even if it has no consumers, we may want to measure whether producers are successfully producing. No need t...
def _get_broker_offsets(self, instance, topics): """ Fetch highwater offsets for each topic/partition from Kafka cluster. Do this for all partitions in the cluster because even if it has no consumers, we may want to measure whether producers are successfully producing. No need t...
[ "Fetch", "highwater", "offsets", "for", "each", "topic", "/", "partition", "from", "Kafka", "cluster", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L291-L346
[ "def", "_get_broker_offsets", "(", "self", ",", "instance", ",", "topics", ")", ":", "# Connect to Kafka", "highwater_offsets", "=", "{", "}", "topic_partitions_without_a_leader", "=", "[", "]", "topics_to_fetch", "=", "defaultdict", "(", "set", ")", "cli", "=", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._get_zk_path_children
Fetch child nodes for a given Zookeeper path.
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _get_zk_path_children(self, zk_conn, zk_path, name_for_error): """Fetch child nodes for a given Zookeeper path.""" children = [] try: children = zk_conn.get_children(zk_path) except NoNodeError: self.log.info('No zookeeper node at %s', zk_path) except ...
def _get_zk_path_children(self, zk_conn, zk_path, name_for_error): """Fetch child nodes for a given Zookeeper path.""" children = [] try: children = zk_conn.get_children(zk_path) except NoNodeError: self.log.info('No zookeeper node at %s', zk_path) except ...
[ "Fetch", "child", "nodes", "for", "a", "given", "Zookeeper", "path", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L396-L405
[ "def", "_get_zk_path_children", "(", "self", ",", "zk_conn", ",", "zk_path", ",", "name_for_error", ")", ":", "children", "=", "[", "]", "try", ":", "children", "=", "zk_conn", ".", "get_children", "(", "zk_path", ")", "except", "NoNodeError", ":", "self", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._get_zk_consumer_offsets
Fetch Consumer Group offsets from Zookeeper. Also fetch consumer_groups, topics, and partitions if not already specified in consumer_groups. :param dict consumer_groups: The consumer groups, topics, and partitions that you want to fetch offsets for. If consumer_groups is None, will...
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _get_zk_consumer_offsets(self, zk_hosts_ports, consumer_groups=None, zk_prefix=''): """ Fetch Consumer Group offsets from Zookeeper. Also fetch consumer_groups, topics, and partitions if not already specified in consumer_groups. :param dict consumer_groups: The consumer gro...
def _get_zk_consumer_offsets(self, zk_hosts_ports, consumer_groups=None, zk_prefix=''): """ Fetch Consumer Group offsets from Zookeeper. Also fetch consumer_groups, topics, and partitions if not already specified in consumer_groups. :param dict consumer_groups: The consumer gro...
[ "Fetch", "Consumer", "Group", "offsets", "from", "Zookeeper", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L407-L476
[ "def", "_get_zk_consumer_offsets", "(", "self", ",", "zk_hosts_ports", ",", "consumer_groups", "=", "None", ",", "zk_prefix", "=", "''", ")", ":", "zk_consumer_offsets", "=", "{", "}", "# Construct the Zookeeper path pattern", "# /consumers/[groupId]/offsets/[topic]/[partit...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._get_kafka_consumer_offsets
retrieve consumer offsets via the new consumer api. Offsets in this version are stored directly in kafka (__consumer_offsets topic) rather than in zookeeper
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _get_kafka_consumer_offsets(self, instance, consumer_groups): """ retrieve consumer offsets via the new consumer api. Offsets in this version are stored directly in kafka (__consumer_offsets topic) rather than in zookeeper """ consumer_offsets = {} topics = defaultdic...
def _get_kafka_consumer_offsets(self, instance, consumer_groups): """ retrieve consumer offsets via the new consumer api. Offsets in this version are stored directly in kafka (__consumer_offsets topic) rather than in zookeeper """ consumer_offsets = {} topics = defaultdic...
[ "retrieve", "consumer", "offsets", "via", "the", "new", "consumer", "api", ".", "Offsets", "in", "this", "version", "are", "stored", "directly", "in", "kafka", "(", "__consumer_offsets", "topic", ")", "rather", "than", "in", "zookeeper" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L478-L504
[ "def", "_get_kafka_consumer_offsets", "(", "self", ",", "instance", ",", "consumer_groups", ")", ":", "consumer_offsets", "=", "{", "}", "topics", "=", "defaultdict", "(", "set", ")", "cli", "=", "self", ".", "_get_kafka_client", "(", "instance", ")", "for", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._validate_explicit_consumer_groups
Validate any explicitly specified consumer groups. While the check does not require specifying consumer groups, if they are specified this method should be used to validate them. val = {'consumer_group': {'topic': [0, 1]}}
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _validate_explicit_consumer_groups(cls, val): """Validate any explicitly specified consumer groups. While the check does not require specifying consumer groups, if they are specified this method should be used to validate them. val = {'consumer_group': {'topic': [0, 1]}} ""...
def _validate_explicit_consumer_groups(cls, val): """Validate any explicitly specified consumer groups. While the check does not require specifying consumer groups, if they are specified this method should be used to validate them. val = {'consumer_group': {'topic': [0, 1]}} ""...
[ "Validate", "any", "explicitly", "specified", "consumer", "groups", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L548-L568
[ "def", "_validate_explicit_consumer_groups", "(", "cls", ",", "val", ")", ":", "assert", "isinstance", "(", "val", ",", "dict", ")", "for", "consumer_group", ",", "topics", "in", "iteritems", "(", "val", ")", ":", "assert", "isinstance", "(", "consumer_group",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KafkaCheck._send_event
Emit an event to the Datadog Event Stream.
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
def _send_event(self, title, text, tags, event_type, aggregation_key, severity='info'): """Emit an event to the Datadog Event Stream.""" event_dict = { 'timestamp': int(time()), 'source_type_name': self.SOURCE_TYPE_NAME, 'msg_title': title, 'event_type': e...
def _send_event(self, title, text, tags, event_type, aggregation_key, severity='info'): """Emit an event to the Datadog Event Stream.""" event_dict = { 'timestamp': int(time()), 'source_type_name': self.SOURCE_TYPE_NAME, 'msg_title': title, 'event_type': e...
[ "Emit", "an", "event", "to", "the", "Datadog", "Event", "Stream", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L570-L582
[ "def", "_send_event", "(", "self", ",", "title", ",", "text", ",", "tags", ",", "event_type", ",", "aggregation_key", ",", "severity", "=", "'info'", ")", ":", "event_dict", "=", "{", "'timestamp'", ":", "int", "(", "time", "(", ")", ")", ",", "'source...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
display_package_changes
Print packages that've been added, removed or changed
datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py
def display_package_changes(pre_packages, post_packages, indent=''): """ Print packages that've been added, removed or changed """ # use package name to determine what's changed pre_package_names = {p.name: p for p in pre_packages} post_package_names = {p.name: p for p in post_packages} add...
def display_package_changes(pre_packages, post_packages, indent=''): """ Print packages that've been added, removed or changed """ # use package name to determine what's changed pre_package_names = {p.name: p for p in pre_packages} post_package_names = {p.name: p for p in post_packages} add...
[ "Print", "packages", "that", "ve", "been", "added", "removed", "or", "changed" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py#L15-L48
[ "def", "display_package_changes", "(", "pre_packages", ",", "post_packages", ",", "indent", "=", "''", ")", ":", "# use package name to determine what's changed", "pre_package_names", "=", "{", "p", ".", "name", ":", "p", "for", "p", "in", "pre_packages", "}", "po...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
resolve
Resolve transient dependencies for any number of checks. If you want to do this en masse, put `all`.
datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py
def resolve(checks, lazy, quiet): """Resolve transient dependencies for any number of checks. If you want to do this en masse, put `all`. """ root = get_root() if 'all' in checks: checks = os.listdir(root) for check_name in sorted(checks): pinned_reqs_file = os.path.join(root, c...
def resolve(checks, lazy, quiet): """Resolve transient dependencies for any number of checks. If you want to do this en masse, put `all`. """ root = get_root() if 'all' in checks: checks = os.listdir(root) for check_name in sorted(checks): pinned_reqs_file = os.path.join(root, c...
[ "Resolve", "transient", "dependencies", "for", "any", "number", "of", "checks", ".", "If", "you", "want", "to", "do", "this", "en", "masse", "put", "all", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py#L60-L86
[ "def", "resolve", "(", "checks", ",", "lazy", ",", "quiet", ")", ":", "root", "=", "get_root", "(", ")", "if", "'all'", "in", "checks", ":", "checks", "=", "os", ".", "listdir", "(", "root", ")", "for", "check_name", "in", "sorted", "(", "checks", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
pin
Pin a dependency for all checks that require it. This can also resolve transient dependencies. Setting the version to `none` will remove the package. You can specify an unlimited number of additional checks to apply the pin for via arguments.
datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py
def pin(package, version, checks, marker, resolving, lazy, quiet): """Pin a dependency for all checks that require it. This can also resolve transient dependencies. Setting the version to `none` will remove the package. You can specify an unlimited number of additional checks to apply the pin for v...
def pin(package, version, checks, marker, resolving, lazy, quiet): """Pin a dependency for all checks that require it. This can also resolve transient dependencies. Setting the version to `none` will remove the package. You can specify an unlimited number of additional checks to apply the pin for v...
[ "Pin", "a", "dependency", "for", "all", "checks", "that", "require", "it", ".", "This", "can", "also", "resolve", "transient", "dependencies", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py#L97-L144
[ "def", "pin", "(", "package", ",", "version", ",", "checks", ",", "marker", ",", "resolving", ",", "lazy", ",", "quiet", ")", ":", "root", "=", "get_root", "(", ")", "package_name", "=", "package", ".", "lower", "(", ")", "version", "=", "version", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
freeze
Combine all dependencies for the Agent's static environment.
datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py
def freeze(): """Combine all dependencies for the Agent's static environment.""" echo_waiting('Verifying collected packages...') catalog, errors = make_catalog() if errors: for error in errors: echo_failure(error) abort() static_file = get_agent_requirements() echo_...
def freeze(): """Combine all dependencies for the Agent's static environment.""" echo_waiting('Verifying collected packages...') catalog, errors = make_catalog() if errors: for error in errors: echo_failure(error) abort() static_file = get_agent_requirements() echo_...
[ "Combine", "all", "dependencies", "for", "the", "Agent", "s", "static", "environment", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py#L150-L168
[ "def", "freeze", "(", ")", ":", "echo_waiting", "(", "'Verifying collected packages...'", ")", "catalog", ",", "errors", "=", "make_catalog", "(", ")", "if", "errors", ":", "for", "error", "in", "errors", ":", "echo_failure", "(", "error", ")", "abort", "(",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
reload_env
Restart an Agent to detect environment changes.
datadog_checks_dev/datadog_checks/dev/tooling/commands/env/reload.py
def reload_env(check, env): """Restart an Agent to detect environment changes.""" envs = get_configured_envs(check) if not envs: echo_failure('No active environments found for `{}`.'.format(check)) echo_info('See what is available to start via `ddev env ls {}`.'.format(check)) abort(...
def reload_env(check, env): """Restart an Agent to detect environment changes.""" envs = get_configured_envs(check) if not envs: echo_failure('No active environments found for `{}`.'.format(check)) echo_info('See what is available to start via `ddev env ls {}`.'.format(check)) abort(...
[ "Restart", "an", "Agent", "to", "detect", "environment", "changes", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/reload.py#L13-L41
[ "def", "reload_env", "(", "check", ",", "env", ")", ":", "envs", "=", "get_configured_envs", "(", "check", ")", "if", "not", "envs", ":", "echo_failure", "(", "'No active environments found for `{}`.'", ".", "format", "(", "check", ")", ")", "echo_info", "(", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
GitlabCheck._create_gitlab_prometheus_instance
Set up the gitlab instance so it can be used in OpenMetricsBaseCheck
gitlab/datadog_checks/gitlab/gitlab.py
def _create_gitlab_prometheus_instance(self, instance, init_config): """ Set up the gitlab instance so it can be used in OpenMetricsBaseCheck """ # Mapping from Prometheus metrics names to Datadog ones # For now it's a 1:1 mapping allowed_metrics = init_config.get('allowe...
def _create_gitlab_prometheus_instance(self, instance, init_config): """ Set up the gitlab instance so it can be used in OpenMetricsBaseCheck """ # Mapping from Prometheus metrics names to Datadog ones # For now it's a 1:1 mapping allowed_metrics = init_config.get('allowe...
[ "Set", "up", "the", "gitlab", "instance", "so", "it", "can", "be", "used", "in", "OpenMetricsBaseCheck" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/gitlab/datadog_checks/gitlab/gitlab.py#L63-L87
[ "def", "_create_gitlab_prometheus_instance", "(", "self", ",", "instance", ",", "init_config", ")", ":", "# Mapping from Prometheus metrics names to Datadog ones", "# For now it's a 1:1 mapping", "allowed_metrics", "=", "init_config", ".", "get", "(", "'allowed_metrics'", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PrometheusScraper._submit_gauge
Submit a metric as a gauge, additional tags provided will be added to the ones from the label provided via the metrics object. `custom_tags` is an array of 'tag:value' that will be added to the metric when sending the gauge to Datadog.
datadog_checks_base/datadog_checks/base/checks/prometheus/base_check.py
def _submit_gauge(self, metric_name, val, metric, custom_tags=None, hostname=None): """ Submit a metric as a gauge, additional tags provided will be added to the ones from the label provided via the metrics object. `custom_tags` is an array of 'tag:value' that will be added to the ...
def _submit_gauge(self, metric_name, val, metric, custom_tags=None, hostname=None): """ Submit a metric as a gauge, additional tags provided will be added to the ones from the label provided via the metrics object. `custom_tags` is an array of 'tag:value' that will be added to the ...
[ "Submit", "a", "metric", "as", "a", "gauge", "additional", "tags", "provided", "will", "be", "added", "to", "the", "ones", "from", "the", "label", "provided", "via", "the", "metrics", "object", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/base_check.py#L32-L41
[ "def", "_submit_gauge", "(", "self", ",", "metric_name", ",", "val", ",", "metric", ",", "custom_tags", "=", "None", ",", "hostname", "=", "None", ")", ":", "_tags", "=", "self", ".", "_metric_tags", "(", "metric_name", ",", "val", ",", "metric", ",", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_validate_tag_sets
Validate tag sets for a MongoReplicaSetClient.
tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py
def _validate_tag_sets(tag_sets): """Validate tag sets for a MongoReplicaSetClient. """ if tag_sets is None: return tag_sets if not isinstance(tag_sets, list): raise TypeError(( "Tag sets %r invalid, must be a list") % (tag_sets,)) if len(tag_sets) == 0: raise Va...
def _validate_tag_sets(tag_sets): """Validate tag sets for a MongoReplicaSetClient. """ if tag_sets is None: return tag_sets if not isinstance(tag_sets, list): raise TypeError(( "Tag sets %r invalid, must be a list") % (tag_sets,)) if len(tag_sets) == 0: raise Va...
[ "Validate", "tag", "sets", "for", "a", "MongoReplicaSetClient", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py#L42-L63
[ "def", "_validate_tag_sets", "(", "tag_sets", ")", ":", "if", "tag_sets", "is", "None", ":", "return", "tag_sets", "if", "not", "isinstance", "(", "tag_sets", ",", "list", ")", ":", "raise", "TypeError", "(", "(", "\"Tag sets %r invalid, must be a list\"", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_validate_max_staleness
Validate max_staleness.
tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py
def _validate_max_staleness(max_staleness): """Validate max_staleness.""" if max_staleness == -1: return -1 if not isinstance(max_staleness, integer_types): raise TypeError(_invalid_max_staleness_msg(max_staleness)) if max_staleness <= 0: raise ValueError(_invalid_max_staleness...
def _validate_max_staleness(max_staleness): """Validate max_staleness.""" if max_staleness == -1: return -1 if not isinstance(max_staleness, integer_types): raise TypeError(_invalid_max_staleness_msg(max_staleness)) if max_staleness <= 0: raise ValueError(_invalid_max_staleness...
[ "Validate", "max_staleness", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py#L72-L83
[ "def", "_validate_max_staleness", "(", "max_staleness", ")", ":", "if", "max_staleness", "==", "-", "1", ":", "return", "-", "1", "if", "not", "isinstance", "(", "max_staleness", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "_invalid_max_staleness_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_ServerMode.document
Read preference as a document.
tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py
def document(self): """Read preference as a document. """ doc = {'mode': self.__mongos_mode} if self.__tag_sets not in (None, [{}]): doc['tags'] = self.__tag_sets if self.__max_staleness != -1: doc['maxStalenessSeconds'] = self.__max_staleness retu...
def document(self): """Read preference as a document. """ doc = {'mode': self.__mongos_mode} if self.__tag_sets not in (None, [{}]): doc['tags'] = self.__tag_sets if self.__max_staleness != -1: doc['maxStalenessSeconds'] = self.__max_staleness retu...
[ "Read", "preference", "as", "a", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py#L111-L119
[ "def", "document", "(", "self", ")", ":", "doc", "=", "{", "'mode'", ":", "self", ".", "__mongos_mode", "}", "if", "self", ".", "__tag_sets", "not", "in", "(", "None", ",", "[", "{", "}", "]", ")", ":", "doc", "[", "'tags'", "]", "=", "self", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
config
Validate default configuration files.
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/config.py
def config(check): """Validate default configuration files.""" if check: checks = [check] else: checks = sorted(get_valid_checks()) files_failed = {} files_warned = {} num_files = 0 echo_waiting('Validating default configuration files...') for check in checks: c...
def config(check): """Validate default configuration files.""" if check: checks = [check] else: checks = sorted(get_valid_checks()) files_failed = {} files_warned = {} num_files = 0 echo_waiting('Validating default configuration files...') for check in checks: c...
[ "Validate", "default", "configuration", "files", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/config.py#L18-L93
[ "def", "config", "(", "check", ")", ":", "if", "check", ":", "checks", "=", "[", "check", "]", "else", ":", "checks", "=", "sorted", "(", "get_valid_checks", "(", ")", ")", "files_failed", "=", "{", "}", "files_warned", "=", "{", "}", "num_files", "=...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
IbmMqCheck.queue_manager_stats
Get stats from the queue manager
ibm_mq/datadog_checks/ibm_mq/ibm_mq.py
def queue_manager_stats(self, queue_manager, tags): """ Get stats from the queue manager """ for mname, pymqi_value in iteritems(metrics.queue_manager_metrics()): try: m = queue_manager.inquire(pymqi_value) mname = '{}.queue_manager.{}'.format...
def queue_manager_stats(self, queue_manager, tags): """ Get stats from the queue manager """ for mname, pymqi_value in iteritems(metrics.queue_manager_metrics()): try: m = queue_manager.inquire(pymqi_value) mname = '{}.queue_manager.{}'.format...
[ "Get", "stats", "from", "the", "queue", "manager" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ibm_mq/datadog_checks/ibm_mq/ibm_mq.py#L108-L121
[ "def", "queue_manager_stats", "(", "self", ",", "queue_manager", ",", "tags", ")", ":", "for", "mname", ",", "pymqi_value", "in", "iteritems", "(", "metrics", ".", "queue_manager_metrics", "(", ")", ")", ":", "try", ":", "m", "=", "queue_manager", ".", "in...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
IbmMqCheck.queue_stats
Grab stats from queues
ibm_mq/datadog_checks/ibm_mq/ibm_mq.py
def queue_stats(self, queue, tags): """ Grab stats from queues """ for mname, pymqi_value in iteritems(metrics.queue_metrics()): try: mname = '{}.queue.{}'.format(self.METRIC_PREFIX, mname) m = queue.inquire(pymqi_value) self.ga...
def queue_stats(self, queue, tags): """ Grab stats from queues """ for mname, pymqi_value in iteritems(metrics.queue_metrics()): try: mname = '{}.queue.{}'.format(self.METRIC_PREFIX, mname) m = queue.inquire(pymqi_value) self.ga...
[ "Grab", "stats", "from", "queues" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ibm_mq/datadog_checks/ibm_mq/ibm_mq.py#L123-L141
[ "def", "queue_stats", "(", "self", ",", "queue", ",", "tags", ")", ":", "for", "mname", ",", "pymqi_value", "in", "iteritems", "(", "metrics", ".", "queue_metrics", "(", ")", ")", ":", "try", ":", "mname", "=", "'{}.queue.{}'", ".", "format", "(", "sel...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_version_string
Get the version string for the given check.
datadog_checks_dev/datadog_checks/dev/tooling/utils.py
def get_version_string(check_name): """ Get the version string for the given check. """ version = VERSION.search(read_version_file(check_name)) if version: return version.group(1)
def get_version_string(check_name): """ Get the version string for the given check. """ version = VERSION.search(read_version_file(check_name)) if version: return version.group(1)
[ "Get", "the", "version", "string", "for", "the", "given", "check", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/utils.py#L129-L135
[ "def", "get_version_string", "(", "check_name", ")", ":", "version", "=", "VERSION", ".", "search", "(", "read_version_file", "(", "check_name", ")", ")", "if", "version", ":", "return", "version", ".", "group", "(", "1", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
load_manifest
Load the manifest file into a dictionary
datadog_checks_dev/datadog_checks/dev/tooling/utils.py
def load_manifest(check_name): """ Load the manifest file into a dictionary """ manifest_path = os.path.join(get_root(), check_name, 'manifest.json') if file_exists(manifest_path): return json.loads(read_file(manifest_path)) return {}
def load_manifest(check_name): """ Load the manifest file into a dictionary """ manifest_path = os.path.join(get_root(), check_name, 'manifest.json') if file_exists(manifest_path): return json.loads(read_file(manifest_path)) return {}
[ "Load", "the", "manifest", "file", "into", "a", "dictionary" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/utils.py#L138-L145
[ "def", "load_manifest", "(", "check_name", ")", ":", "manifest_path", "=", "os", ".", "path", ".", "join", "(", "get_root", "(", ")", ",", "check_name", ",", "'manifest.json'", ")", "if", "file_exists", "(", "manifest_path", ")", ":", "return", "json", "."...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
parse_agent_req_file
Returns a dictionary mapping {check-package-name --> pinned_version} from the given file contents. We can assume lines are in the form: datadog-active-directory==1.1.1; sys_platform == 'win32'
datadog_checks_dev/datadog_checks/dev/tooling/utils.py
def parse_agent_req_file(contents): """ Returns a dictionary mapping {check-package-name --> pinned_version} from the given file contents. We can assume lines are in the form: datadog-active-directory==1.1.1; sys_platform == 'win32' """ catalog = OrderedDict() for line in contents.spli...
def parse_agent_req_file(contents): """ Returns a dictionary mapping {check-package-name --> pinned_version} from the given file contents. We can assume lines are in the form: datadog-active-directory==1.1.1; sys_platform == 'win32' """ catalog = OrderedDict() for line in contents.spli...
[ "Returns", "a", "dictionary", "mapping", "{", "check", "-", "package", "-", "name", "--", ">", "pinned_version", "}", "from", "the", "given", "file", "contents", ".", "We", "can", "assume", "lines", "are", "in", "the", "form", ":" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/utils.py#L161-L181
[ "def", "parse_agent_req_file", "(", "contents", ")", ":", "catalog", "=", "OrderedDict", "(", ")", "for", "line", "in", "contents", ".", "splitlines", "(", ")", ":", "toks", "=", "line", ".", "split", "(", "'=='", ",", "1", ")", "if", "len", "(", "to...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MySql._collect_dict
Query status and get a dictionary back. Extract each field out of the dictionary and stuff it in the corresponding metric. query: show status... field_metric_map: {"Seconds_behind_master": "mysqlSecondsBehindMaster"}
mysql/datadog_checks/mysql/mysql.py
def _collect_dict(self, metric_type, field_metric_map, query, db, tags): """ Query status and get a dictionary back. Extract each field out of the dictionary and stuff it in the corresponding metric. query: show status... field_metric_map: {"Seconds_behind_master": "mysq...
def _collect_dict(self, metric_type, field_metric_map, query, db, tags): """ Query status and get a dictionary back. Extract each field out of the dictionary and stuff it in the corresponding metric. query: show status... field_metric_map: {"Seconds_behind_master": "mysq...
[ "Query", "status", "and", "get", "a", "dictionary", "back", ".", "Extract", "each", "field", "out", "of", "the", "dictionary", "and", "stuff", "it", "in", "the", "corresponding", "metric", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/mysql/datadog_checks/mysql/mysql.py#L720-L755
[ "def", "_collect_dict", "(", "self", ",", "metric_type", ",", "field_metric_map", ",", "query", ",", "db", ",", "tags", ")", ":", "try", ":", "with", "closing", "(", "db", ".", "cursor", "(", ")", ")", "as", "cursor", ":", "cursor", ".", "execute", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MySql._get_pid_file_variable
Get the `pid_file` variable
mysql/datadog_checks/mysql/mysql.py
def _get_pid_file_variable(self, db): """ Get the `pid_file` variable """ pid_file = None try: with closing(db.cursor()) as cursor: cursor.execute("SHOW VARIABLES LIKE 'pid_file'") pid_file = cursor.fetchone()[1] except Exceptio...
def _get_pid_file_variable(self, db): """ Get the `pid_file` variable """ pid_file = None try: with closing(db.cursor()) as cursor: cursor.execute("SHOW VARIABLES LIKE 'pid_file'") pid_file = cursor.fetchone()[1] except Exceptio...
[ "Get", "the", "pid_file", "variable" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/mysql/datadog_checks/mysql/mysql.py#L784-L796
[ "def", "_get_pid_file_variable", "(", "self", ",", "db", ")", ":", "pid_file", "=", "None", "try", ":", "with", "closing", "(", "db", ".", "cursor", "(", ")", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "\"SHOW VARIABLES LIKE 'pid_file'\"", ")...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd