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
pattern_filter
This filters `items` by a regular expression `whitelist` and/or `blacklist`, with the `blacklist` taking precedence. An optional `key` function can be provided that will be passed each item.
datadog_checks_base/datadog_checks/base/utils/common.py
def pattern_filter(items, whitelist=None, blacklist=None, key=None): """This filters `items` by a regular expression `whitelist` and/or `blacklist`, with the `blacklist` taking precedence. An optional `key` function can be provided that will be passed each item. """ key = key or __return_self if...
def pattern_filter(items, whitelist=None, blacklist=None, key=None): """This filters `items` by a regular expression `whitelist` and/or `blacklist`, with the `blacklist` taking precedence. An optional `key` function can be provided that will be passed each item. """ key = key or __return_self if...
[ "This", "filters", "items", "by", "a", "regular", "expression", "whitelist", "and", "/", "or", "blacklist", "with", "the", "blacklist", "taking", "precedence", ".", "An", "optional", "key", "function", "can", "be", "provided", "that", "will", "be", "passed", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/common.py#L36-L57
[ "def", "pattern_filter", "(", "items", ",", "whitelist", "=", "None", ",", "blacklist", "=", "None", ",", "key", "=", "None", ")", ":", "key", "=", "key", "or", "__return_self", "if", "whitelist", ":", "whitelisted", "=", "_filter", "(", "items", ",", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
updated_topology_description
Return an updated copy of a TopologyDescription. :Parameters: - `topology_description`: the current TopologyDescription - `server_description`: a new ServerDescription that resulted from an ismaster call Called after attempting (successfully or not) to call ismaster on the server at se...
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def updated_topology_description(topology_description, server_description): """Return an updated copy of a TopologyDescription. :Parameters: - `topology_description`: the current TopologyDescription - `server_description`: a new ServerDescription that resulted from an ismaster call Cal...
def updated_topology_description(topology_description, server_description): """Return an updated copy of a TopologyDescription. :Parameters: - `topology_description`: the current TopologyDescription - `server_description`: a new ServerDescription that resulted from an ismaster call Cal...
[ "Return", "an", "updated", "copy", "of", "a", "TopologyDescription", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L252-L353
[ "def", "updated_topology_description", "(", "topology_description", ",", "server_description", ")", ":", "address", "=", "server_description", ".", "address", "# These values will be updated, if necessary, to form the new", "# TopologyDescription.", "topology_type", "=", "topology_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_update_rs_from_primary
Update topology description from a primary's ismaster response. Pass in a dict of ServerDescriptions, current replica set name, the ServerDescription we are processing, and the TopologyDescription's max_set_version and max_election_id if any. Returns (new topology type, new replica_set_name, new max_s...
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def _update_rs_from_primary( sds, replica_set_name, server_description, max_set_version, max_election_id): """Update topology description from a primary's ismaster response. Pass in a dict of ServerDescriptions, current replica set name, the ServerDescription we are ...
def _update_rs_from_primary( sds, replica_set_name, server_description, max_set_version, max_election_id): """Update topology description from a primary's ismaster response. Pass in a dict of ServerDescriptions, current replica set name, the ServerDescription we are ...
[ "Update", "topology", "description", "from", "a", "primary", "s", "ismaster", "response", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L356-L429
[ "def", "_update_rs_from_primary", "(", "sds", ",", "replica_set_name", ",", "server_description", ",", "max_set_version", ",", "max_election_id", ")", ":", "if", "replica_set_name", "is", "None", ":", "replica_set_name", "=", "server_description", ".", "replica_set_name...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_update_rs_with_primary_from_member
RS with known primary. Process a response from a non-primary. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns new topology type.
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def _update_rs_with_primary_from_member( sds, replica_set_name, server_description): """RS with known primary. Process a response from a non-primary. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns new topolog...
def _update_rs_with_primary_from_member( sds, replica_set_name, server_description): """RS with known primary. Process a response from a non-primary. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns new topolog...
[ "RS", "with", "known", "primary", ".", "Process", "a", "response", "from", "a", "non", "-", "primary", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L432-L452
[ "def", "_update_rs_with_primary_from_member", "(", "sds", ",", "replica_set_name", ",", "server_description", ")", ":", "assert", "replica_set_name", "is", "not", "None", "if", "replica_set_name", "!=", "server_description", ".", "replica_set_name", ":", "sds", ".", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_update_rs_no_primary_from_member
RS without known primary. Update from a non-primary's response. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns (new topology type, new replica_set_name).
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def _update_rs_no_primary_from_member( sds, replica_set_name, server_description): """RS without known primary. Update from a non-primary's response. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns (new topolo...
def _update_rs_no_primary_from_member( sds, replica_set_name, server_description): """RS without known primary. Update from a non-primary's response. Pass in a dict of ServerDescriptions, current replica set name, and the ServerDescription we are processing. Returns (new topolo...
[ "RS", "without", "known", "primary", ".", "Update", "from", "a", "non", "-", "primary", "s", "response", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L455-L484
[ "def", "_update_rs_no_primary_from_member", "(", "sds", ",", "replica_set_name", ",", "server_description", ")", ":", "topology_type", "=", "TOPOLOGY_TYPE", ".", "ReplicaSetNoPrimary", "if", "replica_set_name", "is", "None", ":", "replica_set_name", "=", "server_descripti...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_check_has_primary
Current topology type is ReplicaSetWithPrimary. Is primary still known? Pass in a dict of ServerDescriptions. Returns new topology type.
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def _check_has_primary(sds): """Current topology type is ReplicaSetWithPrimary. Is primary still known? Pass in a dict of ServerDescriptions. Returns new topology type. """ for s in sds.values(): if s.server_type == SERVER_TYPE.RSPrimary: return TOPOLOGY_TYPE.ReplicaSetWithPrim...
def _check_has_primary(sds): """Current topology type is ReplicaSetWithPrimary. Is primary still known? Pass in a dict of ServerDescriptions. Returns new topology type. """ for s in sds.values(): if s.server_type == SERVER_TYPE.RSPrimary: return TOPOLOGY_TYPE.ReplicaSetWithPrim...
[ "Current", "topology", "type", "is", "ReplicaSetWithPrimary", ".", "Is", "primary", "still", "known?" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L487-L498
[ "def", "_check_has_primary", "(", "sds", ")", ":", "for", "s", "in", "sds", ".", "values", "(", ")", ":", "if", "s", ".", "server_type", "==", "SERVER_TYPE", ".", "RSPrimary", ":", "return", "TOPOLOGY_TYPE", ".", "ReplicaSetWithPrimary", "else", ":", "retu...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
TopologyDescription.reset
A copy of this description, with all servers marked Unknown.
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def reset(self): """A copy of this description, with all servers marked Unknown.""" if self._topology_type == TOPOLOGY_TYPE.ReplicaSetWithPrimary: topology_type = TOPOLOGY_TYPE.ReplicaSetNoPrimary else: topology_type = self._topology_type # The default ServerDesc...
def reset(self): """A copy of this description, with all servers marked Unknown.""" if self._topology_type == TOPOLOGY_TYPE.ReplicaSetWithPrimary: topology_type = TOPOLOGY_TYPE.ReplicaSetNoPrimary else: topology_type = self._topology_type # The default ServerDesc...
[ "A", "copy", "of", "this", "description", "with", "all", "servers", "marked", "Unknown", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L104-L121
[ "def", "reset", "(", "self", ")", ":", "if", "self", ".", "_topology_type", "==", "TOPOLOGY_TYPE", ".", "ReplicaSetWithPrimary", ":", "topology_type", "=", "TOPOLOGY_TYPE", ".", "ReplicaSetNoPrimary", "else", ":", "topology_type", "=", "self", ".", "_topology_type...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
TopologyDescription.common_wire_version
Minimum of all servers' max wire versions, or None.
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def common_wire_version(self): """Minimum of all servers' max wire versions, or None.""" servers = self.known_servers if servers: return min(s.max_wire_version for s in self.known_servers) return None
def common_wire_version(self): """Minimum of all servers' max wire versions, or None.""" servers = self.known_servers if servers: return min(s.max_wire_version for s in self.known_servers) return None
[ "Minimum", "of", "all", "servers", "max", "wire", "versions", "or", "None", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L163-L169
[ "def", "common_wire_version", "(", "self", ")", ":", "servers", "=", "self", ".", "known_servers", "if", "servers", ":", "return", "min", "(", "s", ".", "max_wire_version", "for", "s", "in", "self", ".", "known_servers", ")", "return", "None" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
TopologyDescription.has_readable_server
Does this topology have any readable servers available matching the given read preference? :Parameters: - `read_preference`: an instance of a read preference from :mod:`~pymongo.read_preferences`. Defaults to :attr:`~pymongo.read_preferences.ReadPreference.PRIMARY`. ...
tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py
def has_readable_server(self, read_preference=ReadPreference.PRIMARY): """Does this topology have any readable servers available matching the given read preference? :Parameters: - `read_preference`: an instance of a read preference from :mod:`~pymongo.read_preferences`. De...
def has_readable_server(self, read_preference=ReadPreference.PRIMARY): """Does this topology have any readable servers available matching the given read preference? :Parameters: - `read_preference`: an instance of a read preference from :mod:`~pymongo.read_preferences`. De...
[ "Does", "this", "topology", "have", "any", "readable", "servers", "available", "matching", "the", "given", "read", "preference?" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology_description.py#L213-L228
[ "def", "has_readable_server", "(", "self", ",", "read_preference", "=", "ReadPreference", ".", "PRIMARY", ")", ":", "common", ".", "validate_read_preference", "(", "\"read_preference\"", ",", "read_preference", ")", "return", "any", "(", "self", ".", "apply_selector...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_os
Human-friendly OS name
datadog_checks_base/datadog_checks/base/utils/platform.py
def get_os(): """ Human-friendly OS name """ if sys.platform == 'darwin': return 'mac' elif sys.platform.find('freebsd') != -1: return 'freebsd' elif sys.platform.find('linux') != -1: return 'linux' elif sys.platform.find('win32') != -1: return 'windows' e...
def get_os(): """ Human-friendly OS name """ if sys.platform == 'darwin': return 'mac' elif sys.platform.find('freebsd') != -1: return 'freebsd' elif sys.platform.find('linux') != -1: return 'linux' elif sys.platform.find('win32') != -1: return 'windows' e...
[ "Human", "-", "friendly", "OS", "name" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/platform.py#L11-L26
[ "def", "get_os", "(", ")", ":", "if", "sys", ".", "platform", "==", "'darwin'", ":", "return", "'mac'", "elif", "sys", ".", "platform", ".", "find", "(", "'freebsd'", ")", "!=", "-", "1", ":", "return", "'freebsd'", "elif", "sys", ".", "platform", "....
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Platform.is_bsd
Return true if this is a BSD like operating system.
datadog_checks_base/datadog_checks/base/utils/platform.py
def is_bsd(name=None): """ Return true if this is a BSD like operating system. """ name = name or sys.platform return Platform.is_darwin(name) or Platform.is_freebsd(name)
def is_bsd(name=None): """ Return true if this is a BSD like operating system. """ name = name or sys.platform return Platform.is_darwin(name) or Platform.is_freebsd(name)
[ "Return", "true", "if", "this", "is", "a", "BSD", "like", "operating", "system", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/platform.py#L54-L57
[ "def", "is_bsd", "(", "name", "=", "None", ")", ":", "name", "=", "name", "or", "sys", ".", "platform", "return", "Platform", ".", "is_darwin", "(", "name", ")", "or", "Platform", ".", "is_freebsd", "(", "name", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Platform.is_unix
Return true if the platform is a unix, False otherwise.
datadog_checks_base/datadog_checks/base/utils/platform.py
def is_unix(name=None): """ Return true if the platform is a unix, False otherwise. """ name = name or sys.platform return Platform.is_darwin(name) or Platform.is_linux(name) or Platform.is_freebsd(name)
def is_unix(name=None): """ Return true if the platform is a unix, False otherwise. """ name = name or sys.platform return Platform.is_darwin(name) or Platform.is_linux(name) or Platform.is_freebsd(name)
[ "Return", "true", "if", "the", "platform", "is", "a", "unix", "False", "otherwise", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/platform.py#L65-L68
[ "def", "is_unix", "(", "name", "=", "None", ")", ":", "name", "=", "name", "or", "sys", ".", "platform", "return", "Platform", ".", "is_darwin", "(", "name", ")", "or", "Platform", ".", "is_linux", "(", "name", ")", "or", "Platform", ".", "is_freebsd",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
get_subprocess_output
Run the given subprocess command and return its output. Raise an Exception if an error occurs. :param command: The command to run. Using a list of strings is recommended. The command will be run in a subprocess without using a shell, as such shell features like shell pip...
datadog_checks_base/datadog_checks/base/utils/subprocess_output.py
def get_subprocess_output(command, log, raise_on_empty_output=True, log_debug=True): """ Run the given subprocess command and return its output. Raise an Exception if an error occurs. :param command: The command to run. Using a list of strings is recommended. The command will be run...
def get_subprocess_output(command, log, raise_on_empty_output=True, log_debug=True): """ Run the given subprocess command and return its output. Raise an Exception if an error occurs. :param command: The command to run. Using a list of strings is recommended. The command will be run...
[ "Run", "the", "given", "subprocess", "command", "and", "return", "its", "output", ".", "Raise", "an", "Exception", "if", "an", "error", "occurs", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/subprocess_output.py#L28-L69
[ "def", "get_subprocess_output", "(", "command", ",", "log", ",", "raise_on_empty_output", "=", "True", ",", "log_debug", "=", "True", ")", ":", "cmd_args", "=", "[", "]", "if", "isinstance", "(", "command", ",", "string_types", ")", ":", "for", "arg", "in"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
changes
Show changes since a specific date.
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/changes.py
def changes(since, out_file, eager): """Show changes since a specific date.""" root = get_root() history_data = defaultdict(lambda: {'lines': deque(), 'releasers': set()}) with chdir(root): result = run_command( ( 'git log "--pretty=format:%H %s" --date-order --date=...
def changes(since, out_file, eager): """Show changes since a specific date.""" root = get_root() history_data = defaultdict(lambda: {'lines': deque(), 'releasers': set()}) with chdir(root): result = run_command( ( 'git log "--pretty=format:%H %s" --date-order --date=...
[ "Show", "changes", "since", "a", "specific", "date", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/changes.py#L31-L132
[ "def", "changes", "(", "since", ",", "out_file", ",", "eager", ")", ":", "root", "=", "get_root", "(", ")", "history_data", "=", "defaultdict", "(", "lambda", ":", "{", "'lines'", ":", "deque", "(", ")", ",", "'releasers'", ":", "set", "(", ")", "}",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
changelog
Generates a markdown file containing the list of checks that changed for a given Agent release. Agent version numbers are derived inspecting tags on `integrations-core` so running this tool might provide unexpected results if the repo is not up to date with the Agent release process. If neither `--sinc...
datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/changelog.py
def changelog(since, to, write, force): """ Generates a markdown file containing the list of checks that changed for a given Agent release. Agent version numbers are derived inspecting tags on `integrations-core` so running this tool might provide unexpected results if the repo is not up to date wit...
def changelog(since, to, write, force): """ Generates a markdown file containing the list of checks that changed for a given Agent release. Agent version numbers are derived inspecting tags on `integrations-core` so running this tool might provide unexpected results if the repo is not up to date wit...
[ "Generates", "a", "markdown", "file", "containing", "the", "list", "of", "checks", "that", "changed", "for", "a", "given", "Agent", "release", ".", "Agent", "version", "numbers", "are", "derived", "inspecting", "tags", "on", "integrations", "-", "core", "so", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/changelog.py#L30-L123
[ "def", "changelog", "(", "since", ",", "to", ",", "write", ",", "force", ")", ":", "agent_tags", "=", "get_agent_tags", "(", "since", ",", "to", ")", "# store the changes in a mapping {agent_version --> {check_name --> current_version}}", "changes_per_agent", "=", "Orde...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MetadataCache.init_instance
Create an empty instance if it doesn't exist. If the instance already exists, this is a noop.
vsphere/datadog_checks/vsphere/metadata_cache.py
def init_instance(self, key): """ Create an empty instance if it doesn't exist. If the instance already exists, this is a noop. """ with self._lock: if key not in self._metadata: self._metadata[key] = {} self._metric_ids[key] = []
def init_instance(self, key): """ Create an empty instance if it doesn't exist. If the instance already exists, this is a noop. """ with self._lock: if key not in self._metadata: self._metadata[key] = {} self._metric_ids[key] = []
[ "Create", "an", "empty", "instance", "if", "it", "doesn", "t", "exist", ".", "If", "the", "instance", "already", "exists", "this", "is", "a", "noop", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/metadata_cache.py#L22-L30
[ "def", "init_instance", "(", "self", ",", "key", ")", ":", "with", "self", ".", "_lock", ":", "if", "key", "not", "in", "self", ".", "_metadata", ":", "self", ".", "_metadata", "[", "key", "]", "=", "{", "}", "self", ".", "_metric_ids", "[", "key",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MetadataCache.contains
Return whether a counter_id is present for a given instance key. If the key is not in the cache, raises a KeyError.
vsphere/datadog_checks/vsphere/metadata_cache.py
def contains(self, key, counter_id): """ Return whether a counter_id is present for a given instance key. If the key is not in the cache, raises a KeyError. """ with self._lock: return counter_id in self._metadata[key]
def contains(self, key, counter_id): """ Return whether a counter_id is present for a given instance key. If the key is not in the cache, raises a KeyError. """ with self._lock: return counter_id in self._metadata[key]
[ "Return", "whether", "a", "counter_id", "is", "present", "for", "a", "given", "instance", "key", ".", "If", "the", "key", "is", "not", "in", "the", "cache", "raises", "a", "KeyError", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/metadata_cache.py#L32-L38
[ "def", "contains", "(", "self", ",", "key", ",", "counter_id", ")", ":", "with", "self", ".", "_lock", ":", "return", "counter_id", "in", "self", ".", "_metadata", "[", "key", "]" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MetadataCache.set_metadata
Store the metadata for the given instance key.
vsphere/datadog_checks/vsphere/metadata_cache.py
def set_metadata(self, key, metadata): """ Store the metadata for the given instance key. """ with self._lock: self._metadata[key] = metadata
def set_metadata(self, key, metadata): """ Store the metadata for the given instance key. """ with self._lock: self._metadata[key] = metadata
[ "Store", "the", "metadata", "for", "the", "given", "instance", "key", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/metadata_cache.py#L40-L45
[ "def", "set_metadata", "(", "self", ",", "key", ",", "metadata", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_metadata", "[", "key", "]", "=", "metadata" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MetadataCache.set_metric_ids
Store the list of metric IDs we will want to collect for the given instance key
vsphere/datadog_checks/vsphere/metadata_cache.py
def set_metric_ids(self, key, metric_ids): """ Store the list of metric IDs we will want to collect for the given instance key """ with self._lock: self._metric_ids[key] = metric_ids
def set_metric_ids(self, key, metric_ids): """ Store the list of metric IDs we will want to collect for the given instance key """ with self._lock: self._metric_ids[key] = metric_ids
[ "Store", "the", "list", "of", "metric", "IDs", "we", "will", "want", "to", "collect", "for", "the", "given", "instance", "key" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/metadata_cache.py#L47-L52
[ "def", "set_metric_ids", "(", "self", ",", "key", ",", "metric_ids", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_metric_ids", "[", "key", "]", "=", "metric_ids" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
MetadataCache.get_metadata
Return the metadata for the metric identified by `counter_id` for the given instance key. If the key is not in the cache, raises a KeyError. If there's no metric with the given counter_id, raises a MetadataNotFoundError.
vsphere/datadog_checks/vsphere/metadata_cache.py
def get_metadata(self, key, counter_id): """ Return the metadata for the metric identified by `counter_id` for the given instance key. If the key is not in the cache, raises a KeyError. If there's no metric with the given counter_id, raises a MetadataNotFoundError. """ wi...
def get_metadata(self, key, counter_id): """ Return the metadata for the metric identified by `counter_id` for the given instance key. If the key is not in the cache, raises a KeyError. If there's no metric with the given counter_id, raises a MetadataNotFoundError. """ wi...
[ "Return", "the", "metadata", "for", "the", "metric", "identified", "by", "counter_id", "for", "the", "given", "instance", "key", ".", "If", "the", "key", "is", "not", "in", "the", "cache", "raises", "a", "KeyError", ".", "If", "there", "s", "no", "metric...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/metadata_cache.py#L62-L73
[ "def", "get_metadata", "(", "self", ",", "key", ",", "counter_id", ")", ":", "with", "self", ".", "_lock", ":", "metadata", "=", "self", ".", "_metadata", "[", "key", "]", "try", ":", "return", "metadata", "[", "counter_id", "]", "except", "KeyError", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
manifest
Validate `manifest.json` files.
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/manifest.py
def manifest(fix, include_extras): """Validate `manifest.json` files.""" all_guids = {} root = get_root() root_name = basepath(get_root()) ok_checks = 0 failed_checks = 0 fixed_checks = 0 echo_info("Validating all manifest.json files...") for check_name in sorted(os.listdir(root)):...
def manifest(fix, include_extras): """Validate `manifest.json` files.""" all_guids = {} root = get_root() root_name = basepath(get_root()) ok_checks = 0 failed_checks = 0 fixed_checks = 0 echo_info("Validating all manifest.json files...") for check_name in sorted(os.listdir(root)):...
[ "Validate", "manifest", ".", "json", "files", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/manifest.py#L55-L373
[ "def", "manifest", "(", "fix", ",", "include_extras", ")", ":", "all_guids", "=", "{", "}", "root", "=", "get_root", "(", ")", "root_name", "=", "basepath", "(", "get_root", "(", ")", ")", "ok_checks", "=", "0", "failed_checks", "=", "0", "fixed_checks",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_get_py_loglevel
Map log levels to strings
datadog_checks_base/datadog_checks/base/log.py
def _get_py_loglevel(lvl): """ Map log levels to strings """ if not lvl: lvl = 'INFO' return LOG_LEVEL_MAP.get(lvl.upper(), logging.DEBUG)
def _get_py_loglevel(lvl): """ Map log levels to strings """ if not lvl: lvl = 'INFO' return LOG_LEVEL_MAP.get(lvl.upper(), logging.DEBUG)
[ "Map", "log", "levels", "to", "strings" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/log.py#L52-L59
[ "def", "_get_py_loglevel", "(", "lvl", ")", ":", "if", "not", "lvl", ":", "lvl", "=", "'INFO'", "return", "LOG_LEVEL_MAP", ".", "get", "(", "lvl", ".", "upper", "(", ")", ",", "logging", ".", "DEBUG", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
init_logging
Initialize logging (set up forwarding to Go backend and sane defaults)
datadog_checks_base/datadog_checks/base/log.py
def init_logging(): """ Initialize logging (set up forwarding to Go backend and sane defaults) """ # Forward to Go backend logging.addLevelName(TRACE_LEVEL, 'TRACE') logging.setLoggerClass(AgentLogger) rootLogger = logging.getLogger() rootLogger.addHandler(AgentLogHandler()) rootLogg...
def init_logging(): """ Initialize logging (set up forwarding to Go backend and sane defaults) """ # Forward to Go backend logging.addLevelName(TRACE_LEVEL, 'TRACE') logging.setLoggerClass(AgentLogger) rootLogger = logging.getLogger() rootLogger.addHandler(AgentLogHandler()) rootLogg...
[ "Initialize", "logging", "(", "set", "up", "forwarding", "to", "Go", "backend", "and", "sane", "defaults", ")" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/log.py#L62-L77
[ "def", "init_logging", "(", ")", ":", "# Forward to Go backend", "logging", ".", "addLevelName", "(", "TRACE_LEVEL", ",", "'TRACE'", ")", "logging", ".", "setLoggerClass", "(", "AgentLogger", ")", "rootLogger", "=", "logging", ".", "getLogger", "(", ")", "rootLo...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
TailFile.tail
Read line-by-line and run callback on each line. line_by_line: yield each time a callback has returned True move_end: start from the last line of the log
datadog_checks_base/datadog_checks/base/utils/tailfile.py
def tail(self, line_by_line=True, move_end=True): """Read line-by-line and run callback on each line. line_by_line: yield each time a callback has returned True move_end: start from the last line of the log""" try: self._open_file(move_end=move_end) while True: ...
def tail(self, line_by_line=True, move_end=True): """Read line-by-line and run callback on each line. line_by_line: yield each time a callback has returned True move_end: start from the last line of the log""" try: self._open_file(move_end=move_end) while True: ...
[ "Read", "line", "-", "by", "-", "line", "and", "run", "callback", "on", "each", "line", ".", "line_by_line", ":", "yield", "each", "time", "a", "callback", "has", "returned", "True", "move_end", ":", "start", "from", "the", "last", "line", "of", "the", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/tailfile.py#L78-L107
[ "def", "tail", "(", "self", ",", "line_by_line", "=", "True", ",", "move_end", "=", "True", ")", ":", "try", ":", "self", ".", "_open_file", "(", "move_end", "=", "move_end", ")", "while", "True", ":", "pos", "=", "self", ".", "_f", ".", "tell", "(...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
environment_run
This utility provides a convenient way to safely set up and tear down arbitrary types of environments. :param up: A custom setup callable. :type up: ``callable`` :param down: A custom tear down callable. :type down: ``callable`` :param sleep: Number of seconds to wait before yielding. :type sle...
datadog_checks_dev/datadog_checks/dev/env.py
def environment_run(up, down, sleep=None, endpoints=None, conditions=None, env_vars=None, wrapper=None): """This utility provides a convenient way to safely set up and tear down arbitrary types of environments. :param up: A custom setup callable. :type up: ``callable`` :param down: A custom tear down c...
def environment_run(up, down, sleep=None, endpoints=None, conditions=None, env_vars=None, wrapper=None): """This utility provides a convenient way to safely set up and tear down arbitrary types of environments. :param up: A custom setup callable. :type up: ``callable`` :param down: A custom tear down c...
[ "This", "utility", "provides", "a", "convenient", "way", "to", "safely", "set", "up", "and", "tear", "down", "arbitrary", "types", "of", "environments", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/env.py#L14-L60
[ "def", "environment_run", "(", "up", ",", "down", ",", "sleep", "=", "None", ",", "endpoints", "=", "None", ",", "conditions", "=", "None", ",", "env_vars", "=", "None", ",", "wrapper", "=", "None", ")", ":", "if", "not", "callable", "(", "up", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
config_proxy_skip
Returns an amended copy of the proxies dictionary - used by `requests`, it will disable the proxy if the uri provided is to be reached directly. :param proxies A dict with existing proxies: `https`, `http`, and `no` are potential keys. :param uri URI to determine if a proxy is necessary or not. :param s...
datadog_checks_base/datadog_checks/base/utils/proxy.py
def config_proxy_skip(proxies, uri, skip_proxy=False): """ Returns an amended copy of the proxies dictionary - used by `requests`, it will disable the proxy if the uri provided is to be reached directly. :param proxies A dict with existing proxies: `https`, `http`, and `no` are potential keys. :para...
def config_proxy_skip(proxies, uri, skip_proxy=False): """ Returns an amended copy of the proxies dictionary - used by `requests`, it will disable the proxy if the uri provided is to be reached directly. :param proxies A dict with existing proxies: `https`, `http`, and `no` are potential keys. :para...
[ "Returns", "an", "amended", "copy", "of", "the", "proxies", "dictionary", "-", "used", "by", "requests", "it", "will", "disable", "the", "proxy", "if", "the", "uri", "provided", "is", "to", "be", "reached", "directly", ".", ":", "param", "proxies", "A", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/proxy.py#L8-L35
[ "def", "config_proxy_skip", "(", "proxies", ",", "uri", ",", "skip_proxy", "=", "False", ")", ":", "parsed_uri", "=", "urlparse", "(", "uri", ")", "# disable proxy if necessary", "if", "skip_proxy", ":", "proxies", "[", "'http'", "]", "=", "''", "proxies", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Server.close
Clear the connection pool and stop the monitor. Reconnect with open().
tokumx/datadog_checks/tokumx/vendor/pymongo/server.py
def close(self): """Clear the connection pool and stop the monitor. Reconnect with open(). """ if self._publish: self._events.put((self._listener.publish_server_closed, (self._description.address, self._topology_id))) self._monitor.close...
def close(self): """Clear the connection pool and stop the monitor. Reconnect with open(). """ if self._publish: self._events.put((self._listener.publish_server_closed, (self._description.address, self._topology_id))) self._monitor.close...
[ "Clear", "the", "connection", "pool", "and", "stop", "the", "monitor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server.py#L52-L61
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_publish", ":", "self", ".", "_events", ".", "put", "(", "(", "self", ".", "_listener", ".", "publish_server_closed", ",", "(", "self", ".", "_description", ".", "address", ",", "self", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Server.send_message
Send an unacknowledged message to MongoDB. Can raise ConnectionFailure. :Parameters: - `message`: (request_id, data). - `all_credentials`: dict, maps auth source to MongoCredential.
tokumx/datadog_checks/tokumx/vendor/pymongo/server.py
def send_message(self, message, all_credentials): """Send an unacknowledged message to MongoDB. Can raise ConnectionFailure. :Parameters: - `message`: (request_id, data). - `all_credentials`: dict, maps auth source to MongoCredential. """ _, data, max_doc_si...
def send_message(self, message, all_credentials): """Send an unacknowledged message to MongoDB. Can raise ConnectionFailure. :Parameters: - `message`: (request_id, data). - `all_credentials`: dict, maps auth source to MongoCredential. """ _, data, max_doc_si...
[ "Send", "an", "unacknowledged", "message", "to", "MongoDB", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server.py#L67-L78
[ "def", "send_message", "(", "self", ",", "message", ",", "all_credentials", ")", ":", "_", ",", "data", ",", "max_doc_size", "=", "self", ".", "_split_message", "(", "message", ")", "with", "self", ".", "get_socket", "(", "all_credentials", ")", "as", "soc...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Server.send_message_with_response
Send a message to MongoDB and return a Response object. Can raise ConnectionFailure. :Parameters: - `operation`: A _Query or _GetMore object. - `set_slave_okay`: Pass to operation.get_message. - `all_credentials`: dict, maps auth source to MongoCredential. - `li...
tokumx/datadog_checks/tokumx/vendor/pymongo/server.py
def send_message_with_response( self, operation, set_slave_okay, all_credentials, listeners, exhaust=False): """Send a message to MongoDB and return a Response object. Can raise ConnectionFailure. :Parameters: - ...
def send_message_with_response( self, operation, set_slave_okay, all_credentials, listeners, exhaust=False): """Send a message to MongoDB and return a Response object. Can raise ConnectionFailure. :Parameters: - ...
[ "Send", "a", "message", "to", "MongoDB", "and", "return", "a", "Response", "object", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server.py#L80-L164
[ "def", "send_message_with_response", "(", "self", ",", "operation", ",", "set_slave_okay", ",", "all_credentials", ",", "listeners", ",", "exhaust", "=", "False", ")", ":", "with", "self", ".", "get_socket", "(", "all_credentials", ",", "exhaust", ")", "as", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Server._split_message
Return request_id, data, max_doc_size. :Parameters: - `message`: (request_id, data, max_doc_size) or (request_id, data)
tokumx/datadog_checks/tokumx/vendor/pymongo/server.py
def _split_message(self, message): """Return request_id, data, max_doc_size. :Parameters: - `message`: (request_id, data, max_doc_size) or (request_id, data) """ if len(message) == 3: return message else: # get_more and kill_cursors messages don...
def _split_message(self, message): """Return request_id, data, max_doc_size. :Parameters: - `message`: (request_id, data, max_doc_size) or (request_id, data) """ if len(message) == 3: return message else: # get_more and kill_cursors messages don...
[ "Return", "request_id", "data", "max_doc_size", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server.py#L184-L195
[ "def", "_split_message", "(", "self", ",", "message", ")", ":", "if", "len", "(", "message", ")", "==", "3", ":", "return", "message", "else", ":", "# get_more and kill_cursors messages don't include BSON documents.", "request_id", ",", "data", "=", "message", "re...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkWriteResult.upserted_ids
A map of operation index to the _id of the upserted document.
tokumx/datadog_checks/tokumx/vendor/pymongo/results.py
def upserted_ids(self): """A map of operation index to the _id of the upserted document.""" self._raise_if_unacknowledged("upserted_ids") if self.__bulk_api_result: return dict((upsert["index"], upsert["_id"]) for upsert in self.bulk_api_result["upserted"])
def upserted_ids(self): """A map of operation index to the _id of the upserted document.""" self._raise_if_unacknowledged("upserted_ids") if self.__bulk_api_result: return dict((upsert["index"], upsert["_id"]) for upsert in self.bulk_api_result["upserted"])
[ "A", "map", "of", "operation", "index", "to", "the", "_id", "of", "the", "upserted", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/results.py#L221-L226
[ "def", "upserted_ids", "(", "self", ")", ":", "self", ".", "_raise_if_unacknowledged", "(", "\"upserted_ids\"", ")", "if", "self", ".", "__bulk_api_result", ":", "return", "dict", "(", "(", "upsert", "[", "\"index\"", "]", ",", "upsert", "[", "\"_id\"", "]",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
show
Show the contents of the config file.
datadog_checks_dev/datadog_checks/dev/tooling/commands/config.py
def show(all_keys): """Show the contents of the config file.""" if not config_file_exists(): echo_info('No config file found! Please try `ddev config restore`.') else: if all_keys: echo_info(read_config_file().rstrip()) else: echo_info(read_config_file_scrubbe...
def show(all_keys): """Show the contents of the config file.""" if not config_file_exists(): echo_info('No config file found! Please try `ddev config restore`.') else: if all_keys: echo_info(read_config_file().rstrip()) else: echo_info(read_config_file_scrubbe...
[ "Show", "the", "contents", "of", "the", "config", "file", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/config.py#L40-L48
[ "def", "show", "(", "all_keys", ")", ":", "if", "not", "config_file_exists", "(", ")", ":", "echo_info", "(", "'No config file found! Please try `ddev config restore`.'", ")", "else", ":", "if", "all_keys", ":", "echo_info", "(", "read_config_file", "(", ")", ".",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
set_value
Assigns values to config file entries. If the value is omitted, you will be prompted, with the input hidden if it is sensitive. \b $ ddev config set github.user foo New setting: [github] user = "foo"
datadog_checks_dev/datadog_checks/dev/tooling/commands/config.py
def set_value(ctx, key, value): """Assigns values to config file entries. If the value is omitted, you will be prompted, with the input hidden if it is sensitive. \b $ ddev config set github.user foo New setting: [github] user = "foo" """ scrubbing = False if value is None: ...
def set_value(ctx, key, value): """Assigns values to config file entries. If the value is omitted, you will be prompted, with the input hidden if it is sensitive. \b $ ddev config set github.user foo New setting: [github] user = "foo" """ scrubbing = False if value is None: ...
[ "Assigns", "values", "to", "config", "file", "entries", ".", "If", "the", "value", "is", "omitted", "you", "will", "be", "prompted", "with", "the", "input", "hidden", "if", "it", "is", "sensitive", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/config.py#L69-L121
[ "def", "set_value", "(", "ctx", ",", "key", ",", "value", ")", ":", "scrubbing", "=", "False", "if", "value", "is", "None", ":", "scrubbing", "=", "key", "in", "SECRET_KEYS", "value", "=", "click", ".", "prompt", "(", "'Value for `{}`'", ".", "format", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_SocketManager.close
Return this instance's socket to the connection pool.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def close(self): """Return this instance's socket to the connection pool. """ if not self.__closed: self.__closed = True self.pool.return_socket(self.sock) self.sock, self.pool = None, None
def close(self): """Return this instance's socket to the connection pool. """ if not self.__closed: self.__closed = True self.pool.return_socket(self.sock) self.sock, self.pool = None, None
[ "Return", "this", "instance", "s", "socket", "to", "the", "connection", "pool", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L92-L98
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "__closed", ":", "self", ".", "__closed", "=", "True", "self", ".", "pool", ".", "return_socket", "(", "self", ".", "sock", ")", "self", ".", "sock", ",", "self", ".", "pool", "=", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.rewind
Rewind this cursor to its unevaluated state. Reset this cursor if it has been partially or completely evaluated. Any options that are present on the cursor will remain in effect. Future iterating performed on this cursor will cause new queries to be sent to the server, even if the resul...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def rewind(self): """Rewind this cursor to its unevaluated state. Reset this cursor if it has been partially or completely evaluated. Any options that are present on the cursor will remain in effect. Future iterating performed on this cursor will cause new queries to be sent to ...
def rewind(self): """Rewind this cursor to its unevaluated state. Reset this cursor if it has been partially or completely evaluated. Any options that are present on the cursor will remain in effect. Future iterating performed on this cursor will cause new queries to be sent to ...
[ "Rewind", "this", "cursor", "to", "its", "unevaluated", "state", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L227-L242
[ "def", "rewind", "(", "self", ")", ":", "self", ".", "__data", "=", "deque", "(", ")", "self", ".", "__id", "=", "None", "self", ".", "__address", "=", "None", "self", ".", "__retrieved", "=", "0", "self", ".", "__killed", "=", "False", "return", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor._clone
Internal clone helper.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def _clone(self, deepcopy=True): """Internal clone helper.""" clone = self._clone_base() values_to_clone = ("spec", "projection", "skip", "limit", "max_time_ms", "max_await_time_ms", "comment", "max", "min", "ordering", "explain", "hint", ...
def _clone(self, deepcopy=True): """Internal clone helper.""" clone = self._clone_base() values_to_clone = ("spec", "projection", "skip", "limit", "max_time_ms", "max_await_time_ms", "comment", "max", "min", "ordering", "explain", "hint", ...
[ "Internal", "clone", "helper", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L254-L267
[ "def", "_clone", "(", "self", ",", "deepcopy", "=", "True", ")", ":", "clone", "=", "self", ".", "_clone_base", "(", ")", "values_to_clone", "=", "(", "\"spec\"", ",", "\"projection\"", ",", "\"skip\"", ",", "\"limit\"", ",", "\"max_time_ms\"", ",", "\"max...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.__die
Closes this cursor.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def __die(self, synchronous=False): """Closes this cursor. """ if self.__id and not self.__killed: if self.__exhaust and self.__exhaust_mgr: # If this is an exhaust cursor and we haven't completely # exhausted the result set we *must* close the socket ...
def __die(self, synchronous=False): """Closes this cursor. """ if self.__id and not self.__killed: if self.__exhaust and self.__exhaust_mgr: # If this is an exhaust cursor and we haven't completely # exhausted the result set we *must* close the socket ...
[ "Closes", "this", "cursor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L274-L294
[ "def", "__die", "(", "self", ",", "synchronous", "=", "False", ")", ":", "if", "self", ".", "__id", "and", "not", "self", ".", "__killed", ":", "if", "self", ".", "__exhaust", "and", "self", ".", "__exhaust_mgr", ":", "# If this is an exhaust cursor and we h...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.__query_spec
Get the spec to use for a query.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def __query_spec(self): """Get the spec to use for a query. """ operators = self.__modifiers.copy() if self.__ordering: operators["$orderby"] = self.__ordering if self.__explain: operators["$explain"] = True if self.__hint: operators["$...
def __query_spec(self): """Get the spec to use for a query. """ operators = self.__modifiers.copy() if self.__ordering: operators["$orderby"] = self.__ordering if self.__explain: operators["$explain"] = True if self.__hint: operators["$...
[ "Get", "the", "spec", "to", "use", "for", "a", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L301-L355
[ "def", "__query_spec", "(", "self", ")", ":", "operators", "=", "self", ".", "__modifiers", ".", "copy", "(", ")", "if", "self", ".", "__ordering", ":", "operators", "[", "\"$orderby\"", "]", "=", "self", ".", "__ordering", "if", "self", ".", "__explain"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.add_option
Set arbitrary query flags using a bitmask. To set the tailable flag: cursor.add_option(2)
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def add_option(self, mask): """Set arbitrary query flags using a bitmask. To set the tailable flag: cursor.add_option(2) """ if not isinstance(mask, int): raise TypeError("mask must be an int") self.__check_okay_to_chain() if mask & _QUERY_OPTIONS["e...
def add_option(self, mask): """Set arbitrary query flags using a bitmask. To set the tailable flag: cursor.add_option(2) """ if not isinstance(mask, int): raise TypeError("mask must be an int") self.__check_okay_to_chain() if mask & _QUERY_OPTIONS["e...
[ "Set", "arbitrary", "query", "flags", "using", "a", "bitmask", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L363-L382
[ "def", "add_option", "(", "self", ",", "mask", ")", ":", "if", "not", "isinstance", "(", "mask", ",", "int", ")", ":", "raise", "TypeError", "(", "\"mask must be an int\"", ")", "self", ".", "__check_okay_to_chain", "(", ")", "if", "mask", "&", "_QUERY_OPT...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.remove_option
Unset arbitrary query flags using a bitmask. To unset the tailable flag: cursor.remove_option(2)
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def remove_option(self, mask): """Unset arbitrary query flags using a bitmask. To unset the tailable flag: cursor.remove_option(2) """ if not isinstance(mask, int): raise TypeError("mask must be an int") self.__check_okay_to_chain() if mask & _QUERY_...
def remove_option(self, mask): """Unset arbitrary query flags using a bitmask. To unset the tailable flag: cursor.remove_option(2) """ if not isinstance(mask, int): raise TypeError("mask must be an int") self.__check_okay_to_chain() if mask & _QUERY_...
[ "Unset", "arbitrary", "query", "flags", "using", "a", "bitmask", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L384-L398
[ "def", "remove_option", "(", "self", ",", "mask", ")", ":", "if", "not", "isinstance", "(", "mask", ",", "int", ")", ":", "raise", "TypeError", "(", "\"mask must be an int\"", ")", "self", ".", "__check_okay_to_chain", "(", ")", "if", "mask", "&", "_QUERY_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.limit
Limits the number of results to be returned by this cursor. Raises :exc:`TypeError` if `limit` is not an integer. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The last `limit` applied to this cursor takes precedence. A limit of ``0`` is e...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def limit(self, limit): """Limits the number of results to be returned by this cursor. Raises :exc:`TypeError` if `limit` is not an integer. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The last `limit` applied to this cursor take...
def limit(self, limit): """Limits the number of results to be returned by this cursor. Raises :exc:`TypeError` if `limit` is not an integer. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The last `limit` applied to this cursor take...
[ "Limits", "the", "number", "of", "results", "to", "be", "returned", "by", "this", "cursor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L400-L421
[ "def", "limit", "(", "self", ",", "limit", ")", ":", "if", "not", "isinstance", "(", "limit", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"limit must be an integer\"", ")", "if", "self", ".", "__exhaust", ":", "raise", "InvalidOperation", "(...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.skip
Skips the first `skip` results of this cursor. Raises :exc:`TypeError` if `skip` is not an integer. Raises :exc:`ValueError` if `skip` is less than ``0``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The last `skip` applied to this cursor...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def skip(self, skip): """Skips the first `skip` results of this cursor. Raises :exc:`TypeError` if `skip` is not an integer. Raises :exc:`ValueError` if `skip` is less than ``0``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The l...
def skip(self, skip): """Skips the first `skip` results of this cursor. Raises :exc:`TypeError` if `skip` is not an integer. Raises :exc:`ValueError` if `skip` is less than ``0``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor` has already been used. The l...
[ "Skips", "the", "first", "skip", "results", "of", "this", "cursor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L451-L470
[ "def", "skip", "(", "self", ",", "skip", ")", ":", "if", "not", "isinstance", "(", "skip", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"skip must be an integer\"", ")", "if", "skip", "<", "0", ":", "raise", "ValueError", "(", "\"skip must ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.max_time_ms
Specifies a time limit for a query operation. If the specified time is exceeded, the operation will be aborted and :exc:`~pymongo.errors.ExecutionTimeout` is raised. If `max_time_ms` is ``None`` no limit is applied. Raises :exc:`TypeError` if `max_time_ms` is not an integer or ``None``....
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def max_time_ms(self, max_time_ms): """Specifies a time limit for a query operation. If the specified time is exceeded, the operation will be aborted and :exc:`~pymongo.errors.ExecutionTimeout` is raised. If `max_time_ms` is ``None`` no limit is applied. Raises :exc:`TypeError` ...
def max_time_ms(self, max_time_ms): """Specifies a time limit for a query operation. If the specified time is exceeded, the operation will be aborted and :exc:`~pymongo.errors.ExecutionTimeout` is raised. If `max_time_ms` is ``None`` no limit is applied. Raises :exc:`TypeError` ...
[ "Specifies", "a", "time", "limit", "for", "a", "query", "operation", ".", "If", "the", "specified", "time", "is", "exceeded", "the", "operation", "will", "be", "aborted", "and", ":", "exc", ":", "~pymongo", ".", "errors", ".", "ExecutionTimeout", "is", "ra...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L472-L491
[ "def", "max_time_ms", "(", "self", ",", "max_time_ms", ")", ":", "if", "(", "not", "isinstance", "(", "max_time_ms", ",", "integer_types", ")", "and", "max_time_ms", "is", "not", "None", ")", ":", "raise", "TypeError", "(", "\"max_time_ms must be an integer or N...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.max_await_time_ms
Specifies a time limit for a getMore operation on a :attr:`~pymongo.cursor.CursorType.TAILABLE_AWAIT` cursor. For all other types of cursor max_await_time_ms is ignored. Raises :exc:`TypeError` if `max_await_time_ms` is not an integer or ``None``. Raises :exc:`~pymongo.errors.InvalidOpe...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def max_await_time_ms(self, max_await_time_ms): """Specifies a time limit for a getMore operation on a :attr:`~pymongo.cursor.CursorType.TAILABLE_AWAIT` cursor. For all other types of cursor max_await_time_ms is ignored. Raises :exc:`TypeError` if `max_await_time_ms` is not an integer o...
def max_await_time_ms(self, max_await_time_ms): """Specifies a time limit for a getMore operation on a :attr:`~pymongo.cursor.CursorType.TAILABLE_AWAIT` cursor. For all other types of cursor max_await_time_ms is ignored. Raises :exc:`TypeError` if `max_await_time_ms` is not an integer o...
[ "Specifies", "a", "time", "limit", "for", "a", "getMore", "operation", "on", "a", ":", "attr", ":", "~pymongo", ".", "cursor", ".", "CursorType", ".", "TAILABLE_AWAIT", "cursor", ".", "For", "all", "other", "types", "of", "cursor", "max_await_time_ms", "is",...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L493-L519
[ "def", "max_await_time_ms", "(", "self", ",", "max_await_time_ms", ")", ":", "if", "(", "not", "isinstance", "(", "max_await_time_ms", ",", "integer_types", ")", "and", "max_await_time_ms", "is", "not", "None", ")", ":", "raise", "TypeError", "(", "\"max_await_t...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.max
Adds `max` operator that specifies upper bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the exclusive upper bound for all keys of a specific index in order. .. versionadded:: 2.7
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def max(self, spec): """Adds `max` operator that specifies upper bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the exclusive upper bound for all keys of a specific index in order. .. versionadded:: 2.7 """ if not ...
def max(self, spec): """Adds `max` operator that specifies upper bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the exclusive upper bound for all keys of a specific index in order. .. versionadded:: 2.7 """ if not ...
[ "Adds", "max", "operator", "that", "specifies", "upper", "bound", "for", "specific", "index", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L604-L618
[ "def", "max", "(", "self", ",", "spec", ")", ":", "if", "not", "isinstance", "(", "spec", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"spec must be an instance of list or tuple\"", ")", "self", ".", "__check_okay_to_chain", "(...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.min
Adds `min` operator that specifies lower bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the inclusive lower bound for all keys of a specific index in order. .. versionadded:: 2.7
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def min(self, spec): """Adds `min` operator that specifies lower bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the inclusive lower bound for all keys of a specific index in order. .. versionadded:: 2.7 """ if not ...
def min(self, spec): """Adds `min` operator that specifies lower bound for specific index. :Parameters: - `spec`: a list of field, limit pairs specifying the inclusive lower bound for all keys of a specific index in order. .. versionadded:: 2.7 """ if not ...
[ "Adds", "min", "operator", "that", "specifies", "lower", "bound", "for", "specific", "index", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L620-L634
[ "def", "min", "(", "self", ",", "spec", ")", ":", "if", "not", "isinstance", "(", "spec", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"spec must be an instance of list or tuple\"", ")", "self", ".", "__check_okay_to_chain", "(...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.sort
Sorts this cursor's results. Pass a field name and a direction, either :data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`:: for doc in collection.find().sort('field', pymongo.ASCENDING): print(doc) To sort by multiple fields, pass a list of (key, direction) ...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def sort(self, key_or_list, direction=None): """Sorts this cursor's results. Pass a field name and a direction, either :data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`:: for doc in collection.find().sort('field', pymongo.ASCENDING): print(doc) To s...
def sort(self, key_or_list, direction=None): """Sorts this cursor's results. Pass a field name and a direction, either :data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`:: for doc in collection.find().sort('field', pymongo.ASCENDING): print(doc) To s...
[ "Sorts", "this", "cursor", "s", "results", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L636-L678
[ "def", "sort", "(", "self", ",", "key_or_list", ",", "direction", "=", "None", ")", ":", "self", ".", "__check_okay_to_chain", "(", ")", "keys", "=", "helpers", ".", "_index_list", "(", "key_or_list", ",", "direction", ")", "self", ".", "__ordering", "=", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.count
Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the desired behavior. Raises :class:`~pymongo.errors...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def count(self, with_limit_and_skip=False): """Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the d...
def count(self, with_limit_and_skip=False): """Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the d...
[ "Get", "the", "size", "of", "the", "results", "set", "for", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L680-L727
[ "def", "count", "(", "self", ",", "with_limit_and_skip", "=", "False", ")", ":", "validate_boolean", "(", "\"with_limit_and_skip\"", ",", "with_limit_and_skip", ")", "cmd", "=", "SON", "(", "[", "(", "\"count\"", ",", "self", ".", "__collection", ".", "name", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.distinct
Get a list of distinct values for `key` among all documents in the result set of this query. Raises :class:`TypeError` if `key` is not an instance of :class:`basestring` (:class:`str` in python 3). The :meth:`distinct` method obeys the :attr:`~pymongo.collection.Collection.read...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def distinct(self, key): """Get a list of distinct values for `key` among all documents in the result set of this query. Raises :class:`TypeError` if `key` is not an instance of :class:`basestring` (:class:`str` in python 3). The :meth:`distinct` method obeys the :attr:...
def distinct(self, key): """Get a list of distinct values for `key` among all documents in the result set of this query. Raises :class:`TypeError` if `key` is not an instance of :class:`basestring` (:class:`str` in python 3). The :meth:`distinct` method obeys the :attr:...
[ "Get", "a", "list", "of", "distinct", "values", "for", "key", "among", "all", "documents", "in", "the", "result", "set", "of", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L729-L756
[ "def", "distinct", "(", "self", ",", "key", ")", ":", "options", "=", "{", "}", "if", "self", ".", "__spec", ":", "options", "[", "\"query\"", "]", "=", "self", ".", "__spec", "if", "self", ".", "__max_time_ms", "is", "not", "None", ":", "options", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.explain
Returns an explain plan record for this cursor. .. mongodoc:: explain
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def explain(self): """Returns an explain plan record for this cursor. .. mongodoc:: explain """ c = self.clone() c.__explain = True # always use a hard limit for explains if c.__limit: c.__limit = -abs(c.__limit) return next(c)
def explain(self): """Returns an explain plan record for this cursor. .. mongodoc:: explain """ c = self.clone() c.__explain = True # always use a hard limit for explains if c.__limit: c.__limit = -abs(c.__limit) return next(c)
[ "Returns", "an", "explain", "plan", "record", "for", "this", "cursor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L758-L769
[ "def", "explain", "(", "self", ")", ":", "c", "=", "self", ".", "clone", "(", ")", "c", ".", "__explain", "=", "True", "# always use a hard limit for explains", "if", "c", ".", "__limit", ":", "c", ".", "__limit", "=", "-", "abs", "(", "c", ".", "__l...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.where
Adds a $where clause to this query. The `code` argument must be an instance of :class:`basestring` (:class:`str` in python 3) or :class:`~bson.code.Code` containing a JavaScript expression. This expression will be evaluated for each document scanned. Only those documents for whi...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def where(self, code): """Adds a $where clause to this query. The `code` argument must be an instance of :class:`basestring` (:class:`str` in python 3) or :class:`~bson.code.Code` containing a JavaScript expression. This expression will be evaluated for each document scanned. On...
def where(self, code): """Adds a $where clause to this query. The `code` argument must be an instance of :class:`basestring` (:class:`str` in python 3) or :class:`~bson.code.Code` containing a JavaScript expression. This expression will be evaluated for each document scanned. On...
[ "Adds", "a", "$where", "clause", "to", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L823-L848
[ "def", "where", "(", "self", ",", "code", ")", ":", "self", ".", "__check_okay_to_chain", "(", ")", "if", "not", "isinstance", "(", "code", ",", "Code", ")", ":", "code", "=", "Code", "(", "code", ")", "self", ".", "__spec", "[", "\"$where\"", "]", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.collation
Adds a :class:`~pymongo.collation.Collation` to this query. This option is only supported on MongoDB 3.4 and above. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :...
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def collation(self, collation): """Adds a :class:`~pymongo.collation.Collation` to this query. This option is only supported on MongoDB 3.4 and above. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`...
def collation(self, collation): """Adds a :class:`~pymongo.collation.Collation` to this query. This option is only supported on MongoDB 3.4 and above. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`...
[ "Adds", "a", ":", "class", ":", "~pymongo", ".", "collation", ".", "Collation", "to", "this", "query", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L850-L866
[ "def", "collation", "(", "self", ",", "collation", ")", ":", "self", ".", "__check_okay_to_chain", "(", ")", "self", ".", "__collation", "=", "validate_collation_or_none", "(", "collation", ")", "return", "self" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.__send_message
Send a query or getmore operation and handles the response. If operation is ``None`` this is an exhaust cursor, which reads the next result batch off the exhaust socket instead of sending getMore messages to the server. Can raise ConnectionFailure.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def __send_message(self, operation): """Send a query or getmore operation and handles the response. If operation is ``None`` this is an exhaust cursor, which reads the next result batch off the exhaust socket instead of sending getMore messages to the server. Can raise Connecti...
def __send_message(self, operation): """Send a query or getmore operation and handles the response. If operation is ``None`` this is an exhaust cursor, which reads the next result batch off the exhaust socket instead of sending getMore messages to the server. Can raise Connecti...
[ "Send", "a", "query", "or", "getmore", "operation", "and", "handles", "the", "response", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L868-L1031
[ "def", "__send_message", "(", "self", ",", "operation", ")", ":", "client", "=", "self", ".", "__collection", ".", "database", ".", "client", "listeners", "=", "client", ".", "_event_listeners", "publish", "=", "listeners", ".", "enabled_for_commands", "from_com...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor._refresh
Refreshes the cursor with more data from Mongo. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an error on the query.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def _refresh(self): """Refreshes the cursor with more data from Mongo. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an error on the query. """ if l...
def _refresh(self): """Refreshes the cursor with more data from Mongo. Returns the length of self.__data after refresh. Will exit early if self.__data is already non-empty. Raises OperationFailure when the cursor cannot be refreshed due to an error on the query. """ if l...
[ "Refreshes", "the", "cursor", "with", "more", "data", "from", "Mongo", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L1033-L1080
[ "def", "_refresh", "(", "self", ")", ":", "if", "len", "(", "self", ".", "__data", ")", "or", "self", ".", "__killed", ":", "return", "len", "(", "self", ".", "__data", ")", "if", "self", ".", "__id", "is", "None", ":", "# Query", "self", ".", "_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor.next
Advance the cursor.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def next(self): """Advance the cursor.""" if self.__empty: raise StopIteration if len(self.__data) or self._refresh(): if self.__manipulate: _db = self.__collection.database return _db._fix_outgoing(self.__data.popleft(), ...
def next(self): """Advance the cursor.""" if self.__empty: raise StopIteration if len(self.__data) or self._refresh(): if self.__manipulate: _db = self.__collection.database return _db._fix_outgoing(self.__data.popleft(), ...
[ "Advance", "the", "cursor", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L1128-L1140
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "__empty", ":", "raise", "StopIteration", "if", "len", "(", "self", ".", "__data", ")", "or", "self", ".", "_refresh", "(", ")", ":", "if", "self", ".", "__manipulate", ":", "_db", "=", "self...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cursor._deepcopy
Deepcopy helper for the data dictionary or list. Regular expressions cannot be deep copied but as they are immutable we don't have to copy them when cloning.
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
def _deepcopy(self, x, memo=None): """Deepcopy helper for the data dictionary or list. Regular expressions cannot be deep copied but as they are immutable we don't have to copy them when cloning. """ if not hasattr(x, 'items'): y, is_list, iterator = [], True, enumer...
def _deepcopy(self, x, memo=None): """Deepcopy helper for the data dictionary or list. Regular expressions cannot be deep copied but as they are immutable we don't have to copy them when cloning. """ if not hasattr(x, 'items'): y, is_list, iterator = [], True, enumer...
[ "Deepcopy", "helper", "for", "the", "data", "dictionary", "or", "list", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L1164-L1194
[ "def", "_deepcopy", "(", "self", ",", "x", ",", "memo", "=", "None", ")", ":", "if", "not", "hasattr", "(", "x", ",", "'items'", ")", ":", "y", ",", "is_list", ",", "iterator", "=", "[", "]", ",", "True", ",", "enumerate", "(", "x", ")", "else"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
trace_method
Decorator to catch and print the exceptions that happen within async tasks. Note: this should be applied to methods of VSphereCheck only!
vsphere/datadog_checks/vsphere/vsphere.py
def trace_method(method): """ Decorator to catch and print the exceptions that happen within async tasks. Note: this should be applied to methods of VSphereCheck only! """ def wrapper(*args, **kwargs): try: method(*args, **kwargs) except Exception: args[0].pr...
def trace_method(method): """ Decorator to catch and print the exceptions that happen within async tasks. Note: this should be applied to methods of VSphereCheck only! """ def wrapper(*args, **kwargs): try: method(*args, **kwargs) except Exception: args[0].pr...
[ "Decorator", "to", "catch", "and", "print", "the", "exceptions", "that", "happen", "within", "async", "tasks", ".", "Note", ":", "this", "should", "be", "applied", "to", "methods", "of", "VSphereCheck", "only!" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L68-L80
[ "def", "trace_method", "(", "method", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "method", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Exception", ":", "args", "[", "0", "]", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck.print_exception
Print exceptions happening in separate threads Prevent from logging a ton of them if a potentially big number of them fail the same way
vsphere/datadog_checks/vsphere/vsphere.py
def print_exception(self, msg): """ Print exceptions happening in separate threads Prevent from logging a ton of them if a potentially big number of them fail the same way """ if self.exception_printed < 10: self.log.error(msg) self.exception_printed += 1
def print_exception(self, msg): """ Print exceptions happening in separate threads Prevent from logging a ton of them if a potentially big number of them fail the same way """ if self.exception_printed < 10: self.log.error(msg) self.exception_printed += 1
[ "Print", "exceptions", "happening", "in", "separate", "threads", "Prevent", "from", "logging", "a", "ton", "of", "them", "if", "a", "potentially", "big", "number", "of", "them", "fail", "the", "same", "way" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L143-L149
[ "def", "print_exception", "(", "self", ",", "msg", ")", ":", "if", "self", ".", "exception_printed", "<", "10", ":", "self", ".", "log", ".", "error", "(", "msg", ")", "self", ".", "exception_printed", "+=", "1" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._compute_needed_metrics
Compare the available metrics for one MOR we have computed and intersect them with the set of metrics we want to report
vsphere/datadog_checks/vsphere/vsphere.py
def _compute_needed_metrics(self, instance, available_metrics): """ Compare the available metrics for one MOR we have computed and intersect them with the set of metrics we want to report """ i_key = self._instance_key(instance) if self.in_compatibility_mode(instance): ...
def _compute_needed_metrics(self, instance, available_metrics): """ Compare the available metrics for one MOR we have computed and intersect them with the set of metrics we want to report """ i_key = self._instance_key(instance) if self.in_compatibility_mode(instance): ...
[ "Compare", "the", "available", "metrics", "for", "one", "MOR", "we", "have", "computed", "and", "intersect", "them", "with", "the", "set", "of", "metrics", "we", "want", "to", "report" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L288-L317
[ "def", "_compute_needed_metrics", "(", "self", ",", "instance", ",", "available_metrics", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "if", "self", ".", "in_compatibility_mode", "(", "instance", ")", ":", "if", "instance", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck.get_external_host_tags
Returns a list of tags for every host that is detected by the vSphere integration. Returns a list of pairs (hostname, {'SOURCE_TYPE: list_of_tags},)
vsphere/datadog_checks/vsphere/vsphere.py
def get_external_host_tags(self): """ Returns a list of tags for every host that is detected by the vSphere integration. Returns a list of pairs (hostname, {'SOURCE_TYPE: list_of_tags},) """ self.log.debug("Sending external_host_tags now") external_host_tags = []...
def get_external_host_tags(self): """ Returns a list of tags for every host that is detected by the vSphere integration. Returns a list of pairs (hostname, {'SOURCE_TYPE: list_of_tags},) """ self.log.debug("Sending external_host_tags now") external_host_tags = []...
[ "Returns", "a", "list", "of", "tags", "for", "every", "host", "that", "is", "detected", "by", "the", "vSphere", "integration", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L319-L340
[ "def", "get_external_host_tags", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Sending external_host_tags now\"", ")", "external_host_tags", "=", "[", "]", "for", "instance", "in", "self", ".", "instances", ":", "i_key", "=", "self", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._get_all_objs
Explore vCenter infrastructure to discover hosts, virtual machines, etc. and compute their associated tags. Start at the vCenter `rootFolder`, so as to collect every objet. Example topology: ``` rootFolder - datacenter1 - compute_resou...
vsphere/datadog_checks/vsphere/vsphere.py
def _get_all_objs( self, server_instance, regexes=None, include_only_marked=False, tags=None, use_guest_hostname=False ): """ Explore vCenter infrastructure to discover hosts, virtual machines, etc. and compute their associated tags. Start at the vCenter `rootFolder`, so as t...
def _get_all_objs( self, server_instance, regexes=None, include_only_marked=False, tags=None, use_guest_hostname=False ): """ Explore vCenter infrastructure to discover hosts, virtual machines, etc. and compute their associated tags. Start at the vCenter `rootFolder`, so as t...
[ "Explore", "vCenter", "infrastructure", "to", "discover", "hosts", "virtual", "machines", "etc", ".", "and", "compute", "their", "associated", "tags", ".", "Start", "at", "the", "vCenter", "rootFolder", "so", "as", "to", "collect", "every", "objet", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L436-L535
[ "def", "_get_all_objs", "(", "self", ",", "server_instance", ",", "regexes", "=", "None", ",", "include_only_marked", "=", "False", ",", "tags", "=", "None", ",", "use_guest_hostname", "=", "False", ")", ":", "start", "=", "time", ".", "time", "(", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._is_excluded
Return `True` if the given host or virtual machine is excluded by the user configuration, i.e. violates any of the following rules: * Do not match the corresponding `*_include_only` regular expressions * Is "non-labeled" while `include_only_marked` is enabled (virtual machine only)
vsphere/datadog_checks/vsphere/vsphere.py
def _is_excluded(obj, properties, regexes, include_only_marked): """ Return `True` if the given host or virtual machine is excluded by the user configuration, i.e. violates any of the following rules: * Do not match the corresponding `*_include_only` regular expressions * Is "non...
def _is_excluded(obj, properties, regexes, include_only_marked): """ Return `True` if the given host or virtual machine is excluded by the user configuration, i.e. violates any of the following rules: * Do not match the corresponding `*_include_only` regular expressions * Is "non...
[ "Return", "True", "if", "the", "given", "host", "or", "virtual", "machine", "is", "excluded", "by", "the", "user", "configuration", "i", ".", "e", ".", "violates", "any", "of", "the", "following", "rules", ":", "*", "Do", "not", "match", "the", "correspo...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L538-L571
[ "def", "_is_excluded", "(", "obj", ",", "properties", ",", "regexes", ",", "include_only_marked", ")", ":", "# Host", "if", "isinstance", "(", "obj", ",", "vim", ".", "HostSystem", ")", ":", "# Based on `host_include_only_regex`", "if", "regexes", "and", "regexe...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._cache_morlist_raw
Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery.
vsphere/datadog_checks/vsphere/vsphere.py
def _cache_morlist_raw(self, instance): """ Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery. """ i_key = self._instance_key(instance) self.log.debug("Caching...
def _cache_morlist_raw(self, instance): """ Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery. """ i_key = self._instance_key(instance) self.log.debug("Caching...
[ "Fill", "the", "Mor", "objects", "queue", "that", "will", "be", "asynchronously", "processed", "later", ".", "Resolve", "the", "vCenter", "rootFolder", "and", "initiate", "hosts", "and", "virtual", "machines", "discovery", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L573-L608
[ "def", "_cache_morlist_raw", "(", "self", ",", "instance", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "self", ".", "log", ".", "debug", "(", "\"Caching the morlist for vcenter instance {}\"", ".", "format", "(", "i_key", ")", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._process_mor_objects_queue_async
Process a batch of items popped from the objects queue by querying the available metrics for these MORs and then putting them in the Mor cache
vsphere/datadog_checks/vsphere/vsphere.py
def _process_mor_objects_queue_async(self, instance, mors): """ Process a batch of items popped from the objects queue by querying the available metrics for these MORs and then putting them in the Mor cache """ t = time.time() i_key = self._instance_key(instance) ...
def _process_mor_objects_queue_async(self, instance, mors): """ Process a batch of items popped from the objects queue by querying the available metrics for these MORs and then putting them in the Mor cache """ t = time.time() i_key = self._instance_key(instance) ...
[ "Process", "a", "batch", "of", "items", "popped", "from", "the", "objects", "queue", "by", "querying", "the", "available", "metrics", "for", "these", "MORs", "and", "then", "putting", "them", "in", "the", "Mor", "cache" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L611-L636
[ "def", "_process_mor_objects_queue_async", "(", "self", ",", "instance", ",", "mors", ")", ":", "t", "=", "time", ".", "time", "(", ")", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "server_instance", "=", "self", ".", "_get_server_insta...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._process_mor_objects_queue
Pops `batch_morlist_size` items from the mor objects queue and run asynchronously the _process_mor_objects_queue_async method to fill the Mor cache.
vsphere/datadog_checks/vsphere/vsphere.py
def _process_mor_objects_queue(self, instance): """ Pops `batch_morlist_size` items from the mor objects queue and run asynchronously the _process_mor_objects_queue_async method to fill the Mor cache. """ i_key = self._instance_key(instance) self.mor_cache.init_instance(i...
def _process_mor_objects_queue(self, instance): """ Pops `batch_morlist_size` items from the mor objects queue and run asynchronously the _process_mor_objects_queue_async method to fill the Mor cache. """ i_key = self._instance_key(instance) self.mor_cache.init_instance(i...
[ "Pops", "batch_morlist_size", "items", "from", "the", "mor", "objects", "queue", "and", "run", "asynchronously", "the", "_process_mor_objects_queue_async", "method", "to", "fill", "the", "Mor", "cache", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L638-L678
[ "def", "_process_mor_objects_queue", "(", "self", ",", "instance", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "self", ".", "mor_cache", ".", "init_instance", "(", "i_key", ")", "if", "not", "self", ".", "mor_objects_queue", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._cache_metrics_metadata
Get all the performance counters metadata meaning name/group/description... from the server instance, attached with the corresponding ID
vsphere/datadog_checks/vsphere/vsphere.py
def _cache_metrics_metadata(self, instance): """ Get all the performance counters metadata meaning name/group/description... from the server instance, attached with the corresponding ID """ # ## <TEST-INSTRUMENTATION> t = Timer() # ## </TEST-INSTRUMENTATION> ...
def _cache_metrics_metadata(self, instance): """ Get all the performance counters metadata meaning name/group/description... from the server instance, attached with the corresponding ID """ # ## <TEST-INSTRUMENTATION> t = Timer() # ## </TEST-INSTRUMENTATION> ...
[ "Get", "all", "the", "performance", "counters", "metadata", "meaning", "name", "/", "group", "/", "description", "...", "from", "the", "server", "instance", "attached", "with", "the", "corresponding", "ID" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L680-L721
[ "def", "_cache_metrics_metadata", "(", "self", ",", "instance", ")", ":", "# ## <TEST-INSTRUMENTATION>", "t", "=", "Timer", "(", ")", "# ## </TEST-INSTRUMENTATION>", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "self", ".", "metadata_cache", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._transform_value
Given the counter_id, look up for the metrics metadata to check the vsphere type of the counter and apply pre-reporting transformation if needed.
vsphere/datadog_checks/vsphere/vsphere.py
def _transform_value(self, instance, counter_id, value): """ Given the counter_id, look up for the metrics metadata to check the vsphere type of the counter and apply pre-reporting transformation if needed. """ i_key = self._instance_key(instance) try: metadata = self...
def _transform_value(self, instance, counter_id, value): """ Given the counter_id, look up for the metrics metadata to check the vsphere type of the counter and apply pre-reporting transformation if needed. """ i_key = self._instance_key(instance) try: metadata = self...
[ "Given", "the", "counter_id", "look", "up", "for", "the", "metrics", "metadata", "to", "check", "the", "vsphere", "type", "of", "the", "counter", "and", "apply", "pre", "-", "reporting", "transformation", "if", "needed", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L753-L766
[ "def", "_transform_value", "(", "self", ",", "instance", ",", "counter_id", ",", "value", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "try", ":", "metadata", "=", "self", ".", "metadata_cache", ".", "get_metadata", "(", "i_k...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck._collect_metrics_async
Task that collects the metrics listed in the morlist for one MOR
vsphere/datadog_checks/vsphere/vsphere.py
def _collect_metrics_async(self, instance, query_specs): """ Task that collects the metrics listed in the morlist for one MOR """ # ## <TEST-INSTRUMENTATION> t = Timer() # ## </TEST-INSTRUMENTATION> i_key = self._instance_key(instance) server_instance = self._get_...
def _collect_metrics_async(self, instance, query_specs): """ Task that collects the metrics listed in the morlist for one MOR """ # ## <TEST-INSTRUMENTATION> t = Timer() # ## </TEST-INSTRUMENTATION> i_key = self._instance_key(instance) server_instance = self._get_...
[ "Task", "that", "collects", "the", "metrics", "listed", "in", "the", "morlist", "for", "one", "MOR" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L769-L834
[ "def", "_collect_metrics_async", "(", "self", ",", "instance", ",", "query_specs", ")", ":", "# ## <TEST-INSTRUMENTATION>", "t", "=", "Timer", "(", ")", "# ## </TEST-INSTRUMENTATION>", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "server_instanc...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
VSphereCheck.collect_metrics
Calls asynchronously _collect_metrics_async on all MORs, as the job queue is processed the Aggregator will receive the metrics.
vsphere/datadog_checks/vsphere/vsphere.py
def collect_metrics(self, instance): """ Calls asynchronously _collect_metrics_async on all MORs, as the job queue is processed the Aggregator will receive the metrics. """ i_key = self._instance_key(instance) if not self.mor_cache.contains(i_key): self.log.de...
def collect_metrics(self, instance): """ Calls asynchronously _collect_metrics_async on all MORs, as the job queue is processed the Aggregator will receive the metrics. """ i_key = self._instance_key(instance) if not self.mor_cache.contains(i_key): self.log.de...
[ "Calls", "asynchronously", "_collect_metrics_async", "on", "all", "MORs", "as", "the", "job", "queue", "is", "processed", "the", "Aggregator", "will", "receive", "the", "metrics", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/vsphere.py#L837-L883
[ "def", "collect_metrics", "(", "self", ",", "instance", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "if", "not", "self", ".", "mor_cache", ".", "contains", "(", "i_key", ")", ":", "self", ".", "log", ".", "debug", "(", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._check_db_exists
Check if the database we're targeting actually exists If not then we won't do any checks This allows the same config to be installed on many servers but fail gracefully
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _check_db_exists(self, instance): """ Check if the database we're targeting actually exists If not then we won't do any checks This allows the same config to be installed on many servers but fail gracefully """ dsn, host, username, password, database, driver = self._...
def _check_db_exists(self, instance): """ Check if the database we're targeting actually exists If not then we won't do any checks This allows the same config to be installed on many servers but fail gracefully """ dsn, host, username, password, database, driver = self._...
[ "Check", "if", "the", "database", "we", "re", "targeting", "actually", "exists", "If", "not", "then", "we", "won", "t", "do", "any", "checks", "This", "allows", "the", "same", "config", "to", "be", "installed", "on", "many", "servers", "but", "fail", "gr...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L178-L202
[ "def", "_check_db_exists", "(", "self", ",", "instance", ")", ":", "dsn", ",", "host", ",", "username", ",", "password", ",", "database", ",", "driver", "=", "self", ".", "_get_access_info", "(", "instance", ",", "self", ".", "DEFAULT_DB_KEY", ")", "contex...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._make_metric_list_to_collect
Store the list of metrics to collect by instance_key. Will also create and cache cursors to query the db.
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _make_metric_list_to_collect(self, instance, custom_metrics): """ Store the list of metrics to collect by instance_key. Will also create and cache cursors to query the db. """ metrics_to_collect = [] for name, counter_name, instance_name in self.METRICS: t...
def _make_metric_list_to_collect(self, instance, custom_metrics): """ Store the list of metrics to collect by instance_key. Will also create and cache cursors to query the db. """ metrics_to_collect = [] for name, counter_name, instance_name in self.METRICS: t...
[ "Store", "the", "list", "of", "metrics", "to", "collect", "by", "instance_key", ".", "Will", "also", "create", "and", "cache", "cursors", "to", "query", "the", "db", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L204-L286
[ "def", "_make_metric_list_to_collect", "(", "self", ",", "instance", ",", "custom_metrics", ")", ":", "metrics_to_collect", "=", "[", "]", "for", "name", ",", "counter_name", ",", "instance_name", "in", "self", ".", "METRICS", ":", "try", ":", "sql_type", ",",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.typed_metric
Create the appropriate SqlServerMetric object, each implementing its method to fetch the metrics properly. If a `type` was specified in the config, it is used to report the value directly fetched from SQLServer. Otherwise, it is decided based on the sql_type, according to microsoft's doc...
sqlserver/datadog_checks/sqlserver/sqlserver.py
def typed_metric(self, instance, cfg_inst, table, base_name, user_type, sql_type, column): ''' Create the appropriate SqlServerMetric object, each implementing its method to fetch the metrics properly. If a `type` was specified in the config, it is used to report the value direct...
def typed_metric(self, instance, cfg_inst, table, base_name, user_type, sql_type, column): ''' Create the appropriate SqlServerMetric object, each implementing its method to fetch the metrics properly. If a `type` was specified in the config, it is used to report the value direct...
[ "Create", "the", "appropriate", "SqlServerMetric", "object", "each", "implementing", "its", "method", "to", "fetch", "the", "metrics", "properly", ".", "If", "a", "type", "was", "specified", "in", "the", "config", "it", "is", "used", "to", "report", "the", "...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L288-L319
[ "def", "typed_metric", "(", "self", ",", "instance", ",", "cfg_inst", ",", "table", ",", "base_name", ",", "user_type", ",", "sql_type", ",", "column", ")", ":", "if", "table", "==", "DEFAULT_PERFORMANCE_TABLE", ":", "metric_type_mapping", "=", "{", "PERF_COUN...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._get_access_info
Convenience method to extract info from instance
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _get_access_info(self, instance, db_key, db_name=None): ''' Convenience method to extract info from instance ''' dsn = instance.get('dsn') host = instance.get('host') username = instance.get('username') password = instance.get('password') database = instance.g...
def _get_access_info(self, instance, db_key, db_name=None): ''' Convenience method to extract info from instance ''' dsn = instance.get('dsn') host = instance.get('host') username = instance.get('username') password = instance.get('password') database = instance.g...
[ "Convenience", "method", "to", "extract", "info", "from", "instance" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L341-L357
[ "def", "_get_access_info", "(", "self", ",", "instance", ",", "db_key", ",", "db_name", "=", "None", ")", ":", "dsn", "=", "instance", ".", "get", "(", "'dsn'", ")", "host", "=", "instance", ".", "get", "(", "'host'", ")", "username", "=", "instance", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._conn_key
Return a key to use for the connection cache
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _conn_key(self, instance, db_key, db_name=None): ''' Return a key to use for the connection cache ''' dsn, host, username, password, database, driver = self._get_access_info(instance, db_key, db_name) return '{}:{}:{}:{}:{}:{}'.format(dsn, host, username, password, database, driver)
def _conn_key(self, instance, db_key, db_name=None): ''' Return a key to use for the connection cache ''' dsn, host, username, password, database, driver = self._get_access_info(instance, db_key, db_name) return '{}:{}:{}:{}:{}:{}'.format(dsn, host, username, password, database, driver)
[ "Return", "a", "key", "to", "use", "for", "the", "connection", "cache" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L359-L363
[ "def", "_conn_key", "(", "self", ",", "instance", ",", "db_key", ",", "db_name", "=", "None", ")", ":", "dsn", ",", "host", ",", "username", ",", "password", ",", "database", ",", "driver", "=", "self", ".", "_get_access_info", "(", "instance", ",", "d...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._conn_string_odbc
Return a connection string to use with odbc
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _conn_string_odbc(self, db_key, instance=None, conn_key=None, db_name=None): ''' Return a connection string to use with odbc ''' if instance: dsn, host, username, password, database, driver = self._get_access_info(instance, db_key, db_name) elif conn_key: dsn,...
def _conn_string_odbc(self, db_key, instance=None, conn_key=None, db_name=None): ''' Return a connection string to use with odbc ''' if instance: dsn, host, username, password, database, driver = self._get_access_info(instance, db_key, db_name) elif conn_key: dsn,...
[ "Return", "a", "connection", "string", "to", "use", "with", "odbc" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L365-L389
[ "def", "_conn_string_odbc", "(", "self", ",", "db_key", ",", "instance", "=", "None", ",", "conn_key", "=", "None", ",", "db_name", "=", "None", ")", ":", "if", "instance", ":", "dsn", ",", "host", ",", "username", ",", "password", ",", "database", ","...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer._conn_string_adodbapi
Return a connection string to use with adodbapi
sqlserver/datadog_checks/sqlserver/sqlserver.py
def _conn_string_adodbapi(self, db_key, instance=None, conn_key=None, db_name=None): ''' Return a connection string to use with adodbapi ''' if instance: _, host, username, password, database, _ = self._get_access_info(instance, db_key, db_name) elif conn_key: _, ...
def _conn_string_adodbapi(self, db_key, instance=None, conn_key=None, db_name=None): ''' Return a connection string to use with adodbapi ''' if instance: _, host, username, password, database, _ = self._get_access_info(instance, db_key, db_name) elif conn_key: _, ...
[ "Return", "a", "connection", "string", "to", "use", "with", "adodbapi" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L391-L408
[ "def", "_conn_string_adodbapi", "(", "self", ",", "db_key", ",", "instance", "=", "None", ",", "conn_key", "=", "None", ",", "db_name", "=", "None", ")", ":", "if", "instance", ":", "_", ",", "host", ",", "username", ",", "password", ",", "database", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.get_cursor
Return a cursor to execute query against the db Cursor are cached in the self.connections dict
sqlserver/datadog_checks/sqlserver/sqlserver.py
def get_cursor(self, instance, db_key, db_name=None): ''' Return a cursor to execute query against the db Cursor are cached in the self.connections dict ''' conn_key = self._conn_key(instance, db_key, db_name) try: conn = self.connections[conn_key]['conn'] ...
def get_cursor(self, instance, db_key, db_name=None): ''' Return a cursor to execute query against the db Cursor are cached in the self.connections dict ''' conn_key = self._conn_key(instance, db_key, db_name) try: conn = self.connections[conn_key]['conn'] ...
[ "Return", "a", "cursor", "to", "execute", "query", "against", "the", "db", "Cursor", "are", "cached", "in", "the", "self", ".", "connections", "dict" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L417-L430
[ "def", "get_cursor", "(", "self", ",", "instance", ",", "db_key", ",", "db_name", "=", "None", ")", ":", "conn_key", "=", "self", ".", "_conn_key", "(", "instance", ",", "db_key", ",", "db_name", ")", "try", ":", "conn", "=", "self", ".", "connections"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.get_sql_type
Return the type of the performance counter so that we can report it to Datadog correctly If the sql_type is one that needs a base (PERF_RAW_LARGE_FRACTION and PERF_AVERAGE_BULK), the name of the base counter will also be returned
sqlserver/datadog_checks/sqlserver/sqlserver.py
def get_sql_type(self, instance, counter_name): ''' Return the type of the performance counter so that we can report it to Datadog correctly If the sql_type is one that needs a base (PERF_RAW_LARGE_FRACTION and PERF_AVERAGE_BULK), the name of the base counter will also be returne...
def get_sql_type(self, instance, counter_name): ''' Return the type of the performance counter so that we can report it to Datadog correctly If the sql_type is one that needs a base (PERF_RAW_LARGE_FRACTION and PERF_AVERAGE_BULK), the name of the base counter will also be returne...
[ "Return", "the", "type", "of", "the", "performance", "counter", "so", "that", "we", "can", "report", "it", "to", "Datadog", "correctly", "If", "the", "sql_type", "is", "one", "that", "needs", "a", "base", "(", "PERF_RAW_LARGE_FRACTION", "and", "PERF_AVERAGE_BU...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L432-L462
[ "def", "get_sql_type", "(", "self", ",", "instance", ",", "counter_name", ")", ":", "with", "self", ".", "get_managed_cursor", "(", "instance", ",", "self", ".", "DEFAULT_DB_KEY", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "COUNTER_TYPE_QUERY", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.do_perf_counter_check
Fetch the metrics from the sys.dm_os_performance_counters table
sqlserver/datadog_checks/sqlserver/sqlserver.py
def do_perf_counter_check(self, instance): """ Fetch the metrics from the sys.dm_os_performance_counters table """ custom_tags = instance.get('tags', []) if custom_tags is None: custom_tags = [] instance_key = self._conn_key(instance, self.DEFAULT_DB_KEY) ...
def do_perf_counter_check(self, instance): """ Fetch the metrics from the sys.dm_os_performance_counters table """ custom_tags = instance.get('tags', []) if custom_tags is None: custom_tags = [] instance_key = self._conn_key(instance, self.DEFAULT_DB_KEY) ...
[ "Fetch", "the", "metrics", "from", "the", "sys", ".", "dm_os_performance_counters", "table" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L474-L518
[ "def", "do_perf_counter_check", "(", "self", ",", "instance", ")", ":", "custom_tags", "=", "instance", ".", "get", "(", "'tags'", ",", "[", "]", ")", "if", "custom_tags", "is", "None", ":", "custom_tags", "=", "[", "]", "instance_key", "=", "self", ".",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.do_stored_procedure_check
Fetch the metrics from the stored proc
sqlserver/datadog_checks/sqlserver/sqlserver.py
def do_stored_procedure_check(self, instance, proc): """ Fetch the metrics from the stored proc """ guardSql = instance.get('proc_only_if') custom_tags = instance.get("tags", []) if (guardSql and self.proc_check_guard(instance, guardSql)) or not guardSql: se...
def do_stored_procedure_check(self, instance, proc): """ Fetch the metrics from the stored proc """ guardSql = instance.get('proc_only_if') custom_tags = instance.get("tags", []) if (guardSql and self.proc_check_guard(instance, guardSql)) or not guardSql: se...
[ "Fetch", "the", "metrics", "from", "the", "stored", "proc" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L520-L564
[ "def", "do_stored_procedure_check", "(", "self", ",", "instance", ",", "proc", ")", ":", "guardSql", "=", "instance", ".", "get", "(", "'proc_only_if'", ")", "custom_tags", "=", "instance", ".", "get", "(", "\"tags\"", ",", "[", "]", ")", "if", "(", "gua...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.proc_check_guard
check to see if the guard SQL returns a single column containing 0 or 1 We return true if 1, else False
sqlserver/datadog_checks/sqlserver/sqlserver.py
def proc_check_guard(self, instance, sql): """ check to see if the guard SQL returns a single column containing 0 or 1 We return true if 1, else False """ self.open_db_connections(instance, self.PROC_GUARD_DB_KEY) cursor = self.get_cursor(instance, self.PROC_GUARD_DB_KEY)...
def proc_check_guard(self, instance, sql): """ check to see if the guard SQL returns a single column containing 0 or 1 We return true if 1, else False """ self.open_db_connections(instance, self.PROC_GUARD_DB_KEY) cursor = self.get_cursor(instance, self.PROC_GUARD_DB_KEY)...
[ "check", "to", "see", "if", "the", "guard", "SQL", "returns", "a", "single", "column", "containing", "0", "or", "1", "We", "return", "true", "if", "1", "else", "False" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L566-L584
[ "def", "proc_check_guard", "(", "self", ",", "instance", ",", "sql", ")", ":", "self", ".", "open_db_connections", "(", "instance", ",", "self", ".", "PROC_GUARD_DB_KEY", ")", "cursor", "=", "self", ".", "get_cursor", "(", "instance", ",", "self", ".", "PR...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.close_cursor
We close the cursor explicitly b/c we had proven memory leaks We handle any exception from closing, although according to the doc: "in adodbapi, it is NOT an error to re-close a closed cursor"
sqlserver/datadog_checks/sqlserver/sqlserver.py
def close_cursor(self, cursor): """ We close the cursor explicitly b/c we had proven memory leaks We handle any exception from closing, although according to the doc: "in adodbapi, it is NOT an error to re-close a closed cursor" """ try: cursor.close() ...
def close_cursor(self, cursor): """ We close the cursor explicitly b/c we had proven memory leaks We handle any exception from closing, although according to the doc: "in adodbapi, it is NOT an error to re-close a closed cursor" """ try: cursor.close() ...
[ "We", "close", "the", "cursor", "explicitly", "b", "/", "c", "we", "had", "proven", "memory", "leaks", "We", "handle", "any", "exception", "from", "closing", "although", "according", "to", "the", "doc", ":", "in", "adodbapi", "it", "is", "NOT", "an", "er...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L586-L595
[ "def", "close_cursor", "(", "self", ",", "cursor", ")", ":", "try", ":", "cursor", ".", "close", "(", ")", "except", "Exception", "as", "e", ":", "self", ".", "log", ".", "warning", "(", "\"Could not close adodbapi cursor\\n{}\"", ".", "format", "(", "e", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.close_db_connections
We close the db connections explicitly b/c when we don't they keep locks on the db. This presents as issues such as the SQL Server Agent being unable to stop.
sqlserver/datadog_checks/sqlserver/sqlserver.py
def close_db_connections(self, instance, db_key, db_name=None): """ We close the db connections explicitly b/c when we don't they keep locks on the db. This presents as issues such as the SQL Server Agent being unable to stop. """ conn_key = self._conn_key(instance, db_ke...
def close_db_connections(self, instance, db_key, db_name=None): """ We close the db connections explicitly b/c when we don't they keep locks on the db. This presents as issues such as the SQL Server Agent being unable to stop. """ conn_key = self._conn_key(instance, db_ke...
[ "We", "close", "the", "db", "connections", "explicitly", "b", "/", "c", "when", "we", "don", "t", "they", "keep", "locks", "on", "the", "db", ".", "This", "presents", "as", "issues", "such", "as", "the", "SQL", "Server", "Agent", "being", "unable", "to...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L597-L611
[ "def", "close_db_connections", "(", "self", ",", "instance", ",", "db_key", ",", "db_name", "=", "None", ")", ":", "conn_key", "=", "self", ".", "_conn_key", "(", "instance", ",", "db_key", ",", "db_name", ")", "if", "conn_key", "not", "in", "self", ".",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SQLServer.open_db_connections
We open the db connections explicitly, so we can ensure they are open before we use them, and are closable, once we are finished. Open db connections keep locks on the db, presenting issues such as the SQL Server Agent being unable to stop.
sqlserver/datadog_checks/sqlserver/sqlserver.py
def open_db_connections(self, instance, db_key, db_name=None): """ We open the db connections explicitly, so we can ensure they are open before we use them, and are closable, once we are finished. Open db connections keep locks on the db, presenting issues such as the SQL Server ...
def open_db_connections(self, instance, db_key, db_name=None): """ We open the db connections explicitly, so we can ensure they are open before we use them, and are closable, once we are finished. Open db connections keep locks on the db, presenting issues such as the SQL Server ...
[ "We", "open", "the", "db", "connections", "explicitly", "so", "we", "can", "ensure", "they", "are", "open", "before", "we", "use", "them", "and", "are", "closable", "once", "we", "are", "finished", ".", "Open", "db", "connections", "keep", "locks", "on", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L620-L673
[ "def", "open_db_connections", "(", "self", ",", "instance", ",", "db_key", ",", "db_name", "=", "None", ")", ":", "conn_key", "=", "self", ".", "_conn_key", "(", "instance", ",", "db_key", ",", "db_name", ")", "timeout", "=", "int", "(", "instance", ".",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SqlFractionMetric.fetch_metric
Because we need to query the metrics by matching pairs, we can't query all of them together without having to perform some matching based on the name afterwards so instead we query instance by instance. We cache the list of instance so that we don't have to look it up every time
sqlserver/datadog_checks/sqlserver/sqlserver.py
def fetch_metric(self, cursor, results, tags): ''' Because we need to query the metrics by matching pairs, we can't query all of them together without having to perform some matching based on the name afterwards so instead we query instance by instance. We cache the list of insta...
def fetch_metric(self, cursor, results, tags): ''' Because we need to query the metrics by matching pairs, we can't query all of them together without having to perform some matching based on the name afterwards so instead we query instance by instance. We cache the list of insta...
[ "Because", "we", "need", "to", "query", "the", "metrics", "by", "matching", "pairs", "we", "can", "t", "query", "all", "of", "them", "together", "without", "having", "to", "perform", "some", "matching", "based", "on", "the", "name", "afterwards", "so", "in...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L766-L818
[ "def", "fetch_metric", "(", "self", ",", "cursor", ",", "results", ",", "tags", ")", ":", "if", "self", ".", "sql_name", "not", "in", "results", ":", "self", ".", "log", ".", "warning", "(", "\"Couldn't find {} in results\"", ".", "format", "(", "self", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KubeDNSCheck.create_generic_instances
Transform each Kube DNS instance into a OpenMetricsBaseCheck instance
kube_dns/datadog_checks/kube_dns/kube_dns.py
def create_generic_instances(self, instances): """ Transform each Kube DNS instance into a OpenMetricsBaseCheck instance """ generic_instances = [] for instance in instances: transformed_instance = self._create_kube_dns_instance(instance) generic_instances...
def create_generic_instances(self, instances): """ Transform each Kube DNS instance into a OpenMetricsBaseCheck instance """ generic_instances = [] for instance in instances: transformed_instance = self._create_kube_dns_instance(instance) generic_instances...
[ "Transform", "each", "Kube", "DNS", "instance", "into", "a", "OpenMetricsBaseCheck", "instance" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kube_dns/datadog_checks/kube_dns/kube_dns.py#L45-L54
[ "def", "create_generic_instances", "(", "self", ",", "instances", ")", ":", "generic_instances", "=", "[", "]", "for", "instance", "in", "instances", ":", "transformed_instance", "=", "self", ".", "_create_kube_dns_instance", "(", "instance", ")", "generic_instances...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KubeDNSCheck._create_kube_dns_instance
Set up kube_dns instance so it can be used in OpenMetricsBaseCheck
kube_dns/datadog_checks/kube_dns/kube_dns.py
def _create_kube_dns_instance(self, instance): """ Set up kube_dns instance so it can be used in OpenMetricsBaseCheck """ kube_dns_instance = deepcopy(instance) # kube_dns uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key kube_dns_instance...
def _create_kube_dns_instance(self, instance): """ Set up kube_dns instance so it can be used in OpenMetricsBaseCheck """ kube_dns_instance = deepcopy(instance) # kube_dns uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key kube_dns_instance...
[ "Set", "up", "kube_dns", "instance", "so", "it", "can", "be", "used", "in", "OpenMetricsBaseCheck" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kube_dns/datadog_checks/kube_dns/kube_dns.py#L56-L86
[ "def", "_create_kube_dns_instance", "(", "self", ",", "instance", ")", ":", "kube_dns_instance", "=", "deepcopy", "(", "instance", ")", "# kube_dns uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key", "kube_dns_instance", "[", "'prometheus_url'", "]...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
KubeDNSCheck.submit_as_gauge_and_monotonic_count
submit a kube_dns metric both as a gauge (for compatibility) and as a monotonic_count
kube_dns/datadog_checks/kube_dns/kube_dns.py
def submit_as_gauge_and_monotonic_count(self, metric_suffix, metric, scraper_config): """ submit a kube_dns metric both as a gauge (for compatibility) and as a monotonic_count """ metric_name = scraper_config['namespace'] + metric_suffix for sample in metric.samples: ...
def submit_as_gauge_and_monotonic_count(self, metric_suffix, metric, scraper_config): """ submit a kube_dns metric both as a gauge (for compatibility) and as a monotonic_count """ metric_name = scraper_config['namespace'] + metric_suffix for sample in metric.samples: ...
[ "submit", "a", "kube_dns", "metric", "both", "as", "a", "gauge", "(", "for", "compatibility", ")", "and", "as", "a", "monotonic_count" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kube_dns/datadog_checks/kube_dns/kube_dns.py#L88-L102
[ "def", "submit_as_gauge_and_monotonic_count", "(", "self", ",", "metric_suffix", ",", "metric", ",", "scraper_config", ")", ":", "metric_name", "=", "scraper_config", "[", "'namespace'", "]", "+", "metric_suffix", "for", "sample", "in", "metric", ".", "samples", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection._command
Internal command helper. :Parameters: - `sock_info` - A SocketInfo instance. - `command` - The command itself, as a SON instance. - `slave_ok`: whether to set the SlaveOkay wire protocol bit. - `codec_options` (optional) - An instance of :class:`~bson.codec_o...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def _command(self, sock_info, command, slave_ok=False, read_preference=None, codec_options=None, check=True, allowable_errors=None, read_concern=DEFAULT_READ_CONCERN, write_concern=None, parse_write_concern_error=False, ...
def _command(self, sock_info, command, slave_ok=False, read_preference=None, codec_options=None, check=True, allowable_errors=None, read_concern=DEFAULT_READ_CONCERN, write_concern=None, parse_write_concern_error=False, ...
[ "Internal", "command", "helper", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L188-L232
[ "def", "_command", "(", "self", ",", "sock_info", ",", "command", ",", "slave_ok", "=", "False", ",", "read_preference", "=", "None", ",", "codec_options", "=", "None", ",", "check", "=", "True", ",", "allowable_errors", "=", "None", ",", "read_concern", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.with_options
Get a clone of this collection changing the specified settings. >>> coll1.read_preference Primary() >>> from pymongo import ReadPreference >>> coll2 = coll1.with_options(read_preference=ReadPreference.SECONDARY) >>> coll1.read_preference Primary() >...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def with_options( self, codec_options=None, read_preference=None, write_concern=None, read_concern=None): """Get a clone of this collection changing the specified settings. >>> coll1.read_preference Primary() >>> from pymongo import ReadPreference ...
def with_options( self, codec_options=None, read_preference=None, write_concern=None, read_concern=None): """Get a clone of this collection changing the specified settings. >>> coll1.read_preference Primary() >>> from pymongo import ReadPreference ...
[ "Get", "a", "clone", "of", "this", "collection", "changing", "the", "specified", "settings", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L300-L338
[ "def", "with_options", "(", "self", ",", "codec_options", "=", "None", ",", "read_preference", "=", "None", ",", "write_concern", "=", "None", ",", "read_concern", "=", "None", ")", ":", "return", "Collection", "(", "self", ".", "__database", ",", "self", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.initialize_unordered_bulk_op
**DEPRECATED** - Initialize an unordered batch of write operations. Operations will be performed on the server in arbitrary order, possibly in parallel. All operations will be attempted. :Parameters: - `bypass_document_validation`: (optional) If ``True``, allows the write...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def initialize_unordered_bulk_op(self, bypass_document_validation=False): """**DEPRECATED** - Initialize an unordered batch of write operations. Operations will be performed on the server in arbitrary order, possibly in parallel. All operations will be attempted. :Parameters: ...
def initialize_unordered_bulk_op(self, bypass_document_validation=False): """**DEPRECATED** - Initialize an unordered batch of write operations. Operations will be performed on the server in arbitrary order, possibly in parallel. All operations will be attempted. :Parameters: ...
[ "**", "DEPRECATED", "**", "-", "Initialize", "an", "unordered", "batch", "of", "write", "operations", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L340-L369
[ "def", "initialize_unordered_bulk_op", "(", "self", ",", "bypass_document_validation", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"initialize_unordered_bulk_op is deprecated\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "return", "BulkOpe...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.initialize_ordered_bulk_op
**DEPRECATED** - Initialize an ordered batch of write operations. Operations will be performed on the server serially, in the order provided. If an error occurs all remaining operations are aborted. :Parameters: - `bypass_document_validation`: (optional) If ``True``, allows t...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def initialize_ordered_bulk_op(self, bypass_document_validation=False): """**DEPRECATED** - Initialize an ordered batch of write operations. Operations will be performed on the server serially, in the order provided. If an error occurs all remaining operations are aborted. :Par...
def initialize_ordered_bulk_op(self, bypass_document_validation=False): """**DEPRECATED** - Initialize an ordered batch of write operations. Operations will be performed on the server serially, in the order provided. If an error occurs all remaining operations are aborted. :Par...
[ "**", "DEPRECATED", "**", "-", "Initialize", "an", "ordered", "batch", "of", "write", "operations", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L371-L401
[ "def", "initialize_ordered_bulk_op", "(", "self", ",", "bypass_document_validation", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"initialize_ordered_bulk_op is deprecated\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "return", "BulkOperati...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.bulk_write
Send a batch of write operations to the server. Requests are passed as a list of write operation instances ( :class:`~pymongo.operations.InsertOne`, :class:`~pymongo.operations.UpdateOne`, :class:`~pymongo.operations.UpdateMany`, :class:`~pymongo.operations.ReplaceOne`, ...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def bulk_write(self, requests, ordered=True, bypass_document_validation=False): """Send a batch of write operations to the server. Requests are passed as a list of write operation instances ( :class:`~pymongo.operations.InsertOne`, :class:`~pymongo.operations.UpdateOn...
def bulk_write(self, requests, ordered=True, bypass_document_validation=False): """Send a batch of write operations to the server. Requests are passed as a list of write operation instances ( :class:`~pymongo.operations.InsertOne`, :class:`~pymongo.operations.UpdateOn...
[ "Send", "a", "batch", "of", "write", "operations", "to", "the", "server", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L403-L478
[ "def", "bulk_write", "(", "self", ",", "requests", ",", "ordered", "=", "True", ",", "bypass_document_validation", "=", "False", ")", ":", "if", "not", "isinstance", "(", "requests", ",", "list", ")", ":", "raise", "TypeError", "(", "\"requests must be a list\...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection._insert
Internal insert helper.
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def _insert(self, sock_info, docs, ordered=True, check_keys=True, manipulate=False, write_concern=None, op_id=None, bypass_doc_val=False): """Internal insert helper.""" if isinstance(docs, collections.Mapping): return self._insert_one( sock_inf...
def _insert(self, sock_info, docs, ordered=True, check_keys=True, manipulate=False, write_concern=None, op_id=None, bypass_doc_val=False): """Internal insert helper.""" if isinstance(docs, collections.Mapping): return self._insert_one( sock_inf...
[ "Internal", "insert", "helper", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L568-L630
[ "def", "_insert", "(", "self", ",", "sock_info", ",", "docs", ",", "ordered", "=", "True", ",", "check_keys", "=", "True", ",", "manipulate", "=", "False", ",", "write_concern", "=", "None", ",", "op_id", "=", "None", ",", "bypass_doc_val", "=", "False",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.insert_one
Insert a single document. >>> db.test.count({'x': 1}) 0 >>> result = db.test.insert_one({'x': 1}) >>> result.inserted_id ObjectId('54f112defba522406c9cc208') >>> db.test.find_one({'x': 1}) {u'x': 1, u'_id': ObjectId('54f112defba522406c9cc208')} ...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def insert_one(self, document, bypass_document_validation=False): """Insert a single document. >>> db.test.count({'x': 1}) 0 >>> result = db.test.insert_one({'x': 1}) >>> result.inserted_id ObjectId('54f112defba522406c9cc208') >>> db.test.find_one({'x...
def insert_one(self, document, bypass_document_validation=False): """Insert a single document. >>> db.test.count({'x': 1}) 0 >>> result = db.test.insert_one({'x': 1}) >>> result.inserted_id ObjectId('54f112defba522406c9cc208') >>> db.test.find_one({'x...
[ "Insert", "a", "single", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L632-L671
[ "def", "insert_one", "(", "self", ",", "document", ",", "bypass_document_validation", "=", "False", ")", ":", "common", ".", "validate_is_document_type", "(", "\"document\"", ",", "document", ")", "if", "not", "(", "isinstance", "(", "document", ",", "RawBSONDoc...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.insert_many
Insert an iterable of documents. >>> db.test.count() 0 >>> result = db.test.insert_many([{'x': i} for i in range(2)]) >>> result.inserted_ids [ObjectId('54f113fffba522406c9cc20e'), ObjectId('54f113fffba522406c9cc20f')] >>> db.test.count() 2 ...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def insert_many(self, documents, ordered=True, bypass_document_validation=False): """Insert an iterable of documents. >>> db.test.count() 0 >>> result = db.test.insert_many([{'x': i} for i in range(2)]) >>> result.inserted_ids [ObjectId('54f...
def insert_many(self, documents, ordered=True, bypass_document_validation=False): """Insert an iterable of documents. >>> db.test.count() 0 >>> result = db.test.insert_many([{'x': i} for i in range(2)]) >>> result.inserted_ids [ObjectId('54f...
[ "Insert", "an", "iterable", "of", "documents", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L673-L725
[ "def", "insert_many", "(", "self", ",", "documents", ",", "ordered", "=", "True", ",", "bypass_document_validation", "=", "False", ")", ":", "if", "not", "isinstance", "(", "documents", ",", "collections", ".", "Iterable", ")", "or", "not", "documents", ":",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.replace_one
Replace a single document matching the filter. >>> for doc in db.test.find({}): ... print(doc) ... {u'x': 1, u'_id': ObjectId('54f4c5befba5220aa4d6dee7')} >>> result = db.test.replace_one({'x': 1}, {'y': 1}) >>> result.matched_count 1 ...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def replace_one(self, filter, replacement, upsert=False, bypass_document_validation=False, collation=None): """Replace a single document matching the filter. >>> for doc in db.test.find({}): ... print(doc) ... {u'x': 1, u'_id': ObjectId('54f4c5bef...
def replace_one(self, filter, replacement, upsert=False, bypass_document_validation=False, collation=None): """Replace a single document matching the filter. >>> for doc in db.test.find({}): ... print(doc) ... {u'x': 1, u'_id': ObjectId('54f4c5bef...
[ "Replace", "a", "single", "document", "matching", "the", "filter", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L787-L850
[ "def", "replace_one", "(", "self", ",", "filter", ",", "replacement", ",", "upsert", "=", "False", ",", "bypass_document_validation", "=", "False", ",", "collation", "=", "None", ")", ":", "common", ".", "validate_is_mapping", "(", "\"filter\"", ",", "filter",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.update_one
Update a single document matching the filter. >>> for doc in db.test.find(): ... print(doc) ... {u'x': 1, u'_id': 0} {u'x': 1, u'_id': 1} {u'x': 1, u'_id': 2} >>> result = db.test.update_one({'x': 1}, {'$inc': {'x': 3}}) >>> result.mat...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def update_one(self, filter, update, upsert=False, bypass_document_validation=False, collation=None): """Update a single document matching the filter. >>> for doc in db.test.find(): ... print(doc) ... {u'x': 1, u'_id': 0} ...
def update_one(self, filter, update, upsert=False, bypass_document_validation=False, collation=None): """Update a single document matching the filter. >>> for doc in db.test.find(): ... print(doc) ... {u'x': 1, u'_id': 0} ...
[ "Update", "a", "single", "document", "matching", "the", "filter", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L852-L908
[ "def", "update_one", "(", "self", ",", "filter", ",", "update", ",", "upsert", "=", "False", ",", "bypass_document_validation", "=", "False", ",", "collation", "=", "None", ")", ":", "common", ".", "validate_is_mapping", "(", "\"filter\"", ",", "filter", ")"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.delete_one
Delete a single document matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_one({'x': 1}) >>> result.deleted_count 1 >>> db.test.count({'x': 1}) 2 :Parameters: - `filter`: A query that matches the docum...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def delete_one(self, filter, collation=None): """Delete a single document matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_one({'x': 1}) >>> result.deleted_count 1 >>> db.test.count({'x': 1}) 2 :Paramet...
def delete_one(self, filter, collation=None): """Delete a single document matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_one({'x': 1}) >>> result.deleted_count 1 >>> db.test.count({'x': 1}) 2 :Paramet...
[ "Delete", "a", "single", "document", "matching", "the", "filter", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1019-L1047
[ "def", "delete_one", "(", "self", ",", "filter", ",", "collation", "=", "None", ")", ":", "with", "self", ".", "_socket_for_writes", "(", ")", "as", "sock_info", ":", "return", "DeleteResult", "(", "self", ".", "_delete", "(", "sock_info", ",", "filter", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Collection.delete_many
Delete one or more documents matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_many({'x': 1}) >>> result.deleted_count 3 >>> db.test.count({'x': 1}) 0 :Parameters: - `filter`: A query that matches the ...
tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py
def delete_many(self, filter, collation=None): """Delete one or more documents matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_many({'x': 1}) >>> result.deleted_count 3 >>> db.test.count({'x': 1}) 0 :P...
def delete_many(self, filter, collation=None): """Delete one or more documents matching the filter. >>> db.test.count({'x': 1}) 3 >>> result = db.test.delete_many({'x': 1}) >>> result.deleted_count 3 >>> db.test.count({'x': 1}) 0 :P...
[ "Delete", "one", "or", "more", "documents", "matching", "the", "filter", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1049-L1077
[ "def", "delete_many", "(", "self", ",", "filter", ",", "collation", "=", "None", ")", ":", "with", "self", ".", "_socket_for_writes", "(", ")", "as", "sock_info", ":", "return", "DeleteResult", "(", "self", ".", "_delete", "(", "sock_info", ",", "filter", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd