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
DockerDaemon.check
Run the Docker check for one instance.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def check(self, instance): """Run the Docker check for one instance.""" if not self.init_success: # Initialization can fail if cgroups are not ready or docker daemon is down. So we retry if needed # https://github.com/DataDog/dd-agent/issues/1896 self.init() ...
def check(self, instance): """Run the Docker check for one instance.""" if not self.init_success: # Initialization can fail if cgroups are not ready or docker daemon is down. So we retry if needed # https://github.com/DataDog/dd-agent/issues/1896 self.init() ...
[ "Run", "the", "Docker", "check", "for", "one", "instance", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L287-L357
[ "def", "check", "(", "self", ",", "instance", ")", ":", "if", "not", "self", ".", "init_success", ":", "# Initialization can fail if cgroups are not ready or docker daemon is down. So we retry if needed", "# https://github.com/DataDog/dd-agent/issues/1896", "self", ".", "init", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._get_and_count_containers
List all the containers from the API, filter and count them.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _get_and_count_containers(self, custom_cgroups=False, healthchecks=False): """List all the containers from the API, filter and count them.""" # Querying the size of containers is slow, we don't do it at each run must_query_size = self.collect_container_size and self._latest_size_query == 0 ...
def _get_and_count_containers(self, custom_cgroups=False, healthchecks=False): """List all the containers from the API, filter and count them.""" # Querying the size of containers is slow, we don't do it at each run must_query_size = self.collect_container_size and self._latest_size_query == 0 ...
[ "List", "all", "the", "containers", "from", "the", "API", "filter", "and", "count", "them", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L375-L442
[ "def", "_get_and_count_containers", "(", "self", ",", "custom_cgroups", "=", "False", ",", "healthchecks", "=", "False", ")", ":", "# Querying the size of containers is slow, we don't do it at each run", "must_query_size", "=", "self", ".", "collect_container_size", "and", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._get_tags
Generate the tags for a given entity (container or image) according to a list of tag names.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _get_tags(self, entity=None, tag_type=None): """Generate the tags for a given entity (container or image) according to a list of tag names.""" # Start with custom tags tags = list(self.custom_tags) # Collect pod names as tags on kubernetes if Platform.is_k8s() and KubeUtil.P...
def _get_tags(self, entity=None, tag_type=None): """Generate the tags for a given entity (container or image) according to a list of tag names.""" # Start with custom tags tags = list(self.custom_tags) # Collect pod names as tags on kubernetes if Platform.is_k8s() and KubeUtil.P...
[ "Generate", "the", "tags", "for", "a", "given", "entity", "(", "container", "or", "image", ")", "according", "to", "a", "list", "of", "tag", "names", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L452-L539
[ "def", "_get_tags", "(", "self", ",", "entity", "=", "None", ",", "tag_type", "=", "None", ")", ":", "# Start with custom tags", "tags", "=", "list", "(", "self", ".", "custom_tags", ")", "# Collect pod names as tags on kubernetes", "if", "Platform", ".", "is_k8...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._extract_tag_value
Extra tag information from the API result (containers or images). Cache extracted tags inside the entity object.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _extract_tag_value(self, entity, tag_name): """Extra tag information from the API result (containers or images). Cache extracted tags inside the entity object. """ if tag_name not in TAG_EXTRACTORS: self.warning("{0} isn't a supported tag".format(tag_name)) re...
def _extract_tag_value(self, entity, tag_name): """Extra tag information from the API result (containers or images). Cache extracted tags inside the entity object. """ if tag_name not in TAG_EXTRACTORS: self.warning("{0} isn't a supported tag".format(tag_name)) re...
[ "Extra", "tag", "information", "from", "the", "API", "result", "(", "containers", "or", "images", ")", ".", "Cache", "extracted", "tags", "inside", "the", "entity", "object", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L541-L556
[ "def", "_extract_tag_value", "(", "self", ",", "entity", ",", "tag_name", ")", ":", "if", "tag_name", "not", "in", "TAG_EXTRACTORS", ":", "self", ".", "warning", "(", "\"{0} isn't a supported tag\"", ".", "format", "(", "tag_name", ")", ")", "return", "# Check...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._is_container_excluded
Check if a container is excluded according to the filter rules. Requires _filter_containers to run first.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _is_container_excluded(self, container): """Check if a container is excluded according to the filter rules. Requires _filter_containers to run first. """ container_name = DockerUtil.container_name_extractor(container)[0] return container_name in self._filtered_containers
def _is_container_excluded(self, container): """Check if a container is excluded according to the filter rules. Requires _filter_containers to run first. """ container_name = DockerUtil.container_name_extractor(container)[0] return container_name in self._filtered_containers
[ "Check", "if", "a", "container", "is", "excluded", "according", "to", "the", "filter", "rules", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L571-L577
[ "def", "_is_container_excluded", "(", "self", ",", "container", ")", ":", "container_name", "=", "DockerUtil", ".", "container_name_extractor", "(", "container", ")", "[", "0", "]", "return", "container_name", "in", "self", ".", "_filtered_containers" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._send_container_healthcheck_sc
Send health service checks for containers.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _send_container_healthcheck_sc(self, containers_by_id): """Send health service checks for containers.""" for container in containers_by_id.itervalues(): healthcheck_tags = self._get_tags(container, HEALTHCHECK) match = False for tag in healthcheck_tags: ...
def _send_container_healthcheck_sc(self, containers_by_id): """Send health service checks for containers.""" for container in containers_by_id.itervalues(): healthcheck_tags = self._get_tags(container, HEALTHCHECK) match = False for tag in healthcheck_tags: ...
[ "Send", "health", "service", "checks", "for", "containers", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L594-L608
[ "def", "_send_container_healthcheck_sc", "(", "self", ",", "containers_by_id", ")", ":", "for", "container", "in", "containers_by_id", ".", "itervalues", "(", ")", ":", "healthcheck_tags", "=", "self", ".", "_get_tags", "(", "container", ",", "HEALTHCHECK", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._report_container_count
Report container count per state
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _report_container_count(self, containers_by_id): """Report container count per state""" m_func = FUNC_MAP[GAUGE][self.use_histogram] per_state_count = defaultdict(int) filterlambda = lambda ctr: not self._is_container_excluded(ctr) containers = list(filter(filterlambda, con...
def _report_container_count(self, containers_by_id): """Report container count per state""" m_func = FUNC_MAP[GAUGE][self.use_histogram] per_state_count = defaultdict(int) filterlambda = lambda ctr: not self._is_container_excluded(ctr) containers = list(filter(filterlambda, con...
[ "Report", "container", "count", "per", "state" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L623-L637
[ "def", "_report_container_count", "(", "self", ",", "containers_by_id", ")", ":", "m_func", "=", "FUNC_MAP", "[", "GAUGE", "]", "[", "self", ".", "use_histogram", "]", "per_state_count", "=", "defaultdict", "(", "int", ")", "filterlambda", "=", "lambda", "ctr"...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._report_volume_count
Report volume count per state (dangling or not)
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _report_volume_count(self): """Report volume count per state (dangling or not)""" m_func = FUNC_MAP[GAUGE][self.use_histogram] attached_volumes = self.docker_util.client.volumes(filters={'dangling': False}) dangling_volumes = self.docker_util.client.volumes(filters={'dangling': True...
def _report_volume_count(self): """Report volume count per state (dangling or not)""" m_func = FUNC_MAP[GAUGE][self.use_histogram] attached_volumes = self.docker_util.client.volumes(filters={'dangling': False}) dangling_volumes = self.docker_util.client.volumes(filters={'dangling': True...
[ "Report", "volume", "count", "per", "state", "(", "dangling", "or", "not", ")" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L639-L648
[ "def", "_report_volume_count", "(", "self", ")", ":", "m_func", "=", "FUNC_MAP", "[", "GAUGE", "]", "[", "self", ".", "use_histogram", "]", "attached_volumes", "=", "self", ".", "docker_util", ".", "client", ".", "volumes", "(", "filters", "=", "{", "'dang...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._report_net_metrics
Find container network metrics by looking at /proc/$PID/net/dev of the container process.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _report_net_metrics(self, container, tags): """Find container network metrics by looking at /proc/$PID/net/dev of the container process.""" if self._disable_net_metrics: self.log.debug("Network metrics are disabled. Skipping") return proc_net_file = os.path.join(cont...
def _report_net_metrics(self, container, tags): """Find container network metrics by looking at /proc/$PID/net/dev of the container process.""" if self._disable_net_metrics: self.log.debug("Network metrics are disabled. Skipping") return proc_net_file = os.path.join(cont...
[ "Find", "container", "network", "metrics", "by", "looking", "at", "/", "proc", "/", "$PID", "/", "net", "/", "dev", "of", "the", "container", "process", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L722-L764
[ "def", "_report_net_metrics", "(", "self", ",", "container", ",", "tags", ")", ":", "if", "self", ".", "_disable_net_metrics", ":", "self", ".", "log", ".", "debug", "(", "\"Network metrics are disabled. Skipping\"", ")", "return", "proc_net_file", "=", "os", "....
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._get_events
Get the list of events.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _get_events(self): """Get the list of events.""" events, changed_container_ids = self.docker_util.get_events() if not self._disable_net_metrics: self._invalidate_network_mapping_cache(events) if changed_container_ids and self._service_discovery: get_sd_backend...
def _get_events(self): """Get the list of events.""" events, changed_container_ids = self.docker_util.get_events() if not self._disable_net_metrics: self._invalidate_network_mapping_cache(events) if changed_container_ids and self._service_discovery: get_sd_backend...
[ "Get", "the", "list", "of", "events", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L799-L808
[ "def", "_get_events", "(", "self", ")", ":", "events", ",", "changed_container_ids", "=", "self", ".", "docker_util", ".", "get_events", "(", ")", "if", "not", "self", ".", "_disable_net_metrics", ":", "self", ".", "_invalidate_network_mapping_cache", "(", "even...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._create_dd_event
Create the actual event to submit from a list of similar docker events
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _create_dd_event(self, events, image, c_tags, priority='Normal'): """Create the actual event to submit from a list of similar docker events""" if not events: return max_timestamp = 0 status = defaultdict(int) status_change = [] for ev, c_name in events: ...
def _create_dd_event(self, events, image, c_tags, priority='Normal'): """Create the actual event to submit from a list of similar docker events""" if not events: return max_timestamp = 0 status = defaultdict(int) status_change = [] for ev, c_name in events: ...
[ "Create", "the", "actual", "event", "to", "submit", "from", "a", "list", "of", "similar", "docker", "events" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L883-L928
[ "def", "_create_dd_event", "(", "self", ",", "events", ",", "image", ",", "c_tags", ",", "priority", "=", "'Normal'", ")", ":", "if", "not", "events", ":", "return", "max_timestamp", "=", "0", "status", "=", "defaultdict", "(", "int", ")", "status_change",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._report_disk_stats
Report metrics about the volume space usage
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _report_disk_stats(self): """Report metrics about the volume space usage""" stats = { 'docker.data.used': None, 'docker.data.total': None, 'docker.data.free': None, 'docker.metadata.used': None, 'docker.metadata.total': None, 'd...
def _report_disk_stats(self): """Report metrics about the volume space usage""" stats = { 'docker.data.used': None, 'docker.data.total': None, 'docker.data.free': None, 'docker.metadata.used': None, 'docker.metadata.total': None, 'd...
[ "Report", "metrics", "about", "the", "volume", "space", "usage" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L930-L968
[ "def", "_report_disk_stats", "(", "self", ")", ":", "stats", "=", "{", "'docker.data.used'", ":", "None", ",", "'docker.data.total'", ":", "None", ",", "'docker.data.free'", ":", "None", ",", "'docker.metadata.used'", ":", "None", ",", "'docker.metadata.total'", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._format_disk_metrics
Cast the disk stats to float and convert them to bytes
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _format_disk_metrics(self, metrics): """Cast the disk stats to float and convert them to bytes""" for name, raw_val in metrics.iteritems(): if raw_val: match = DISK_STATS_RE.search(raw_val) if match is None or len(match.groups()) != 2: ...
def _format_disk_metrics(self, metrics): """Cast the disk stats to float and convert them to bytes""" for name, raw_val in metrics.iteritems(): if raw_val: match = DISK_STATS_RE.search(raw_val) if match is None or len(match.groups()) != 2: ...
[ "Cast", "the", "disk", "stats", "to", "float", "and", "convert", "them", "to", "bytes" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L970-L987
[ "def", "_format_disk_metrics", "(", "self", ",", "metrics", ")", ":", "for", "name", ",", "raw_val", "in", "metrics", ".", "iteritems", "(", ")", ":", "if", "raw_val", ":", "match", "=", "DISK_STATS_RE", ".", "search", "(", "raw_val", ")", "if", "match",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._calc_percent_disk_stats
Calculate a percentage of used disk space for data and metadata
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _calc_percent_disk_stats(self, stats): """Calculate a percentage of used disk space for data and metadata""" mtypes = ['data', 'metadata'] percs = {} for mtype in mtypes: used = stats.get('docker.{0}.used'.format(mtype)) total = stats.get('docker.{0}.total'.fo...
def _calc_percent_disk_stats(self, stats): """Calculate a percentage of used disk space for data and metadata""" mtypes = ['data', 'metadata'] percs = {} for mtype in mtypes: used = stats.get('docker.{0}.used'.format(mtype)) total = stats.get('docker.{0}.total'.fo...
[ "Calculate", "a", "percentage", "of", "used", "disk", "space", "for", "data", "and", "metadata" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L989-L1010
[ "def", "_calc_percent_disk_stats", "(", "self", ",", "stats", ")", ":", "mtypes", "=", "[", "'data'", ",", "'metadata'", "]", "percs", "=", "{", "}", "for", "mtype", "in", "mtypes", ":", "used", "=", "stats", ".", "get", "(", "'docker.{0}.used'", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._get_cgroup_from_proc
Find a specific cgroup file, containing metrics to extract.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _get_cgroup_from_proc(self, cgroup, pid, filename): """Find a specific cgroup file, containing metrics to extract.""" params = { "file": filename, } return DockerUtil.find_cgroup_from_proc(self._mountpoints, pid, cgroup, self.docker_util._docker_root) % (params)
def _get_cgroup_from_proc(self, cgroup, pid, filename): """Find a specific cgroup file, containing metrics to extract.""" params = { "file": filename, } return DockerUtil.find_cgroup_from_proc(self._mountpoints, pid, cgroup, self.docker_util._docker_root) % (params)
[ "Find", "a", "specific", "cgroup", "file", "containing", "metrics", "to", "extract", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L1013-L1018
[ "def", "_get_cgroup_from_proc", "(", "self", ",", "cgroup", ",", "pid", ",", "filename", ")", ":", "params", "=", "{", "\"file\"", ":", "filename", ",", "}", "return", "DockerUtil", ".", "find_cgroup_from_proc", "(", "self", ".", "_mountpoints", ",", "pid", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._parse_cgroup_file
Parse a cgroup pseudo file for key/values.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _parse_cgroup_file(self, stat_file): """Parse a cgroup pseudo file for key/values.""" self.log.debug("Opening cgroup file: %s" % stat_file) try: with open(stat_file, 'r') as fp: if 'blkio' in stat_file: return self._parse_blkio_metrics(fp.read(...
def _parse_cgroup_file(self, stat_file): """Parse a cgroup pseudo file for key/values.""" self.log.debug("Opening cgroup file: %s" % stat_file) try: with open(stat_file, 'r') as fp: if 'blkio' in stat_file: return self._parse_blkio_metrics(fp.read(...
[ "Parse", "a", "cgroup", "pseudo", "file", "for", "key", "/", "values", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L1020-L1044
[ "def", "_parse_cgroup_file", "(", "self", ",", "stat_file", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Opening cgroup file: %s\"", "%", "stat_file", ")", "try", ":", "with", "open", "(", "stat_file", ",", "'r'", ")", "as", "fp", ":", "if", "'blk...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._parse_blkio_metrics
Parse the blkio metrics.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _parse_blkio_metrics(self, stats): """Parse the blkio metrics.""" metrics = { 'io_read': 0, 'io_write': 0, } for line in stats: if 'Read' in line: metrics['io_read'] += int(line.split()[2]) if 'Write' in line: ...
def _parse_blkio_metrics(self, stats): """Parse the blkio metrics.""" metrics = { 'io_read': 0, 'io_write': 0, } for line in stats: if 'Read' in line: metrics['io_read'] += int(line.split()[2]) if 'Write' in line: ...
[ "Parse", "the", "blkio", "metrics", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L1046-L1057
[ "def", "_parse_blkio_metrics", "(", "self", ",", "stats", ")", ":", "metrics", "=", "{", "'io_read'", ":", "0", ",", "'io_write'", ":", "0", ",", "}", "for", "line", "in", "stats", ":", "if", "'Read'", "in", "line", ":", "metrics", "[", "'io_read'", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DockerDaemon._crawl_container_pids
Crawl `/proc` to find container PIDs and add them to `containers_by_id`.
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
def _crawl_container_pids(self, container_dict, custom_cgroups=False): """Crawl `/proc` to find container PIDs and add them to `containers_by_id`.""" proc_path = os.path.join(self.docker_util._docker_root, 'proc') pid_dirs = [_dir for _dir in os.listdir(proc_path) if _dir.isdigit()] if ...
def _crawl_container_pids(self, container_dict, custom_cgroups=False): """Crawl `/proc` to find container PIDs and add them to `containers_by_id`.""" proc_path = os.path.join(self.docker_util._docker_root, 'proc') pid_dirs = [_dir for _dir in os.listdir(proc_path) if _dir.isdigit()] if ...
[ "Crawl", "/", "proc", "to", "find", "container", "PIDs", "and", "add", "them", "to", "containers_by_id", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L1073-L1134
[ "def", "_crawl_container_pids", "(", "self", ",", "container_dict", ",", "custom_cgroups", "=", "False", ")", ":", "proc_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "docker_util", ".", "_docker_root", ",", "'proc'", ")", "pid_dirs", "=", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
start
Start an environment.
datadog_checks_dev/datadog_checks/dev/tooling/commands/env/start.py
def start(ctx, check, env, agent, dev, base, env_vars): """Start an environment.""" if not file_exists(get_tox_file(check)): abort('`{}` is not a testable check.'.format(check)) base_package = None if base: core_dir = os.path.expanduser(ctx.obj.get('core', '')) if not dir_exists...
def start(ctx, check, env, agent, dev, base, env_vars): """Start an environment.""" if not file_exists(get_tox_file(check)): abort('`{}` is not a testable check.'.format(check)) base_package = None if base: core_dir = os.path.expanduser(ctx.obj.get('core', '')) if not dir_exists...
[ "Start", "an", "environment", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/start.py#L42-L208
[ "def", "start", "(", "ctx", ",", "check", ",", "env", ",", "agent", ",", "dev", ",", "base", ",", "env_vars", ")", ":", "if", "not", "file_exists", "(", "get_tox_file", "(", "check", ")", ")", ":", "abort", "(", "'`{}` is not a testable check.'", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SimpleApi._make_request
Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes
openstack_controller/datadog_checks/openstack_controller/api.py
def _make_request(self, url, headers, params=None): """ Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes """ self.logger.debug("Request URL, Headers and Params: %s, %s, %s", url, headers, params) # Chec...
def _make_request(self, url, headers, params=None): """ Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes """ self.logger.debug("Request URL, Headers and Params: %s, %s, %s", url, headers, params) # Chec...
[ "Generic", "request", "handler", "for", "OpenStack", "API", "requests", "Raises", "specialized", "Exceptions", "for", "commonly", "encountered", "error", "codes" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L296-L331
[ "def", "_make_request", "(", "self", ",", "url", ",", "headers", ",", "params", "=", "None", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Request URL, Headers and Params: %s, %s, %s\"", ",", "url", ",", "headers", ",", "params", ")", "# Checking if r...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SimpleApi.get_projects
Returns all projects in the domain
openstack_controller/datadog_checks/openstack_controller/api.py
def get_projects(self): """ Returns all projects in the domain """ url = urljoin(self.keystone_endpoint, "{}/{}".format(DEFAULT_KEYSTONE_API_VERSION, "projects")) try: r = self._make_request(url, self.headers) return r.get('projects', []) except E...
def get_projects(self): """ Returns all projects in the domain """ url = urljoin(self.keystone_endpoint, "{}/{}".format(DEFAULT_KEYSTONE_API_VERSION, "projects")) try: r = self._make_request(url, self.headers) return r.get('projects', []) except E...
[ "Returns", "all", "projects", "in", "the", "domain" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L422-L433
[ "def", "get_projects", "(", "self", ")", ":", "url", "=", "urljoin", "(", "self", ".", "keystone_endpoint", ",", "\"{}/{}\"", ".", "format", "(", "DEFAULT_KEYSTONE_API_VERSION", ",", "\"projects\"", ")", ")", "try", ":", "r", "=", "self", ".", "_make_request...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Authenticator._get_user_identity
Parse user identity out of init_config To guarantee a uniquely identifiable user, expects {"user": {"name": "my_username", "password": "my_password", "domain": {"id": "my_domain_id"} } }
openstack_controller/datadog_checks/openstack_controller/api.py
def _get_user_identity(user): """ Parse user identity out of init_config To guarantee a uniquely identifiable user, expects {"user": {"name": "my_username", "password": "my_password", "domain": {"id": "my_domain_id"} } } """ if...
def _get_user_identity(user): """ Parse user identity out of init_config To guarantee a uniquely identifiable user, expects {"user": {"name": "my_username", "password": "my_password", "domain": {"id": "my_domain_id"} } } """ if...
[ "Parse", "user", "identity", "out", "of", "init_config" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L556-L572
[ "def", "_get_user_identity", "(", "user", ")", ":", "if", "not", "(", "user", "and", "user", ".", "get", "(", "'name'", ")", "and", "user", ".", "get", "(", "'password'", ")", "and", "user", ".", "get", "(", "\"domain\"", ")", "and", "user", ".", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Authenticator._get_neutron_endpoint
Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog
openstack_controller/datadog_checks/openstack_controller/api.py
def _get_neutron_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog """ valid_endpoint = cls._get_valid_endpoint(json_resp, ...
def _get_neutron_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Neutron service Sends a CRITICAL service check when none are found registered in the Catalog """ valid_endpoint = cls._get_valid_endpoint(json_resp, ...
[ "Parse", "the", "service", "catalog", "returned", "by", "the", "Identity", "API", "for", "an", "endpoint", "matching", "the", "Neutron", "service", "Sends", "a", "CRITICAL", "service", "check", "when", "none", "are", "found", "registered", "in", "the", "Catalo...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L575-L583
[ "def", "_get_neutron_endpoint", "(", "cls", ",", "json_resp", ")", ":", "valid_endpoint", "=", "cls", ".", "_get_valid_endpoint", "(", "json_resp", ",", "'neutron'", ",", "'network'", ")", "if", "valid_endpoint", ":", "return", "valid_endpoint", "raise", "MissingN...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Authenticator._get_nova_endpoint
Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog
openstack_controller/datadog_checks/openstack_controller/api.py
def _get_nova_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog """ valid_endpoint = c...
def _get_nova_endpoint(cls, json_resp): """ Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog """ valid_endpoint = c...
[ "Parse", "the", "service", "catalog", "returned", "by", "the", "Identity", "API", "for", "an", "endpoint", "matching", "the", "Nova", "service", "with", "the", "requested", "version", "Sends", "a", "CRITICAL", "service", "check", "when", "no", "viable", "candi...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L586-L595
[ "def", "_get_nova_endpoint", "(", "cls", ",", "json_resp", ")", ":", "valid_endpoint", "=", "cls", ".", "_get_valid_endpoint", "(", "json_resp", ",", "'nova'", ",", "'compute'", ")", "if", "valid_endpoint", ":", "return", "valid_endpoint", "raise", "MissingNovaEnd...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Authenticator._get_valid_endpoint
Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog
openstack_controller/datadog_checks/openstack_controller/api.py
def _get_valid_endpoint(resp, name, entry_type): """ Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog """ catalog =...
def _get_valid_endpoint(resp, name, entry_type): """ Parse the service catalog returned by the Identity API for an endpoint matching the Nova service with the requested version Sends a CRITICAL service check when no viable candidates are found in the Catalog """ catalog =...
[ "Parse", "the", "service", "catalog", "returned", "by", "the", "Identity", "API", "for", "an", "endpoint", "matching", "the", "Nova", "service", "with", "the", "requested", "version", "Sends", "a", "CRITICAL", "service", "check", "when", "no", "viable", "candi...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L598-L623
[ "def", "_get_valid_endpoint", "(", "resp", ",", "name", ",", "entry_type", ")", ":", "catalog", "=", "resp", ".", "get", "(", "'token'", ",", "{", "}", ")", ".", "get", "(", "'catalog'", ",", "[", "]", ")", "for", "entry", "in", "catalog", ":", "if...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
dep
This command will: * Verify the uniqueness of dependency versions across all checks. * Verify all the dependencies are pinned. * Verify the embedded Python environment defined in the base check and requirements listed in every integration are compatible.
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/dep.py
def dep(): """ This command will: * Verify the uniqueness of dependency versions across all checks. * Verify all the dependencies are pinned. * Verify the embedded Python environment defined in the base check and requirements listed in every integration are compatible. """ failed = Fa...
def dep(): """ This command will: * Verify the uniqueness of dependency versions across all checks. * Verify all the dependencies are pinned. * Verify the embedded Python environment defined in the base check and requirements listed in every integration are compatible. """ failed = Fa...
[ "This", "command", "will", ":" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/dep.py#L31-L96
[ "def", "dep", "(", ")", ":", "failed", "=", "False", "catalog", ",", "errors", "=", "make_catalog", "(", ")", "# Check unpinned", "if", "errors", ":", "for", "error", "in", "errors", ":", "echo_failure", "(", "error", ")", "failed", "=", "True", "# Check...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
info
Show metric info from a Prometheus endpoint. \b Example: $ ddev meta prom info :8080/_status/vars
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/prometheus.py
def info(endpoint): """Show metric info from a Prometheus endpoint. \b Example: $ ddev meta prom info :8080/_status/vars """ endpoint = sanitize_endpoint(endpoint) metrics = parse_metrics(endpoint) num_metrics = len(metrics) num_gauge = 0 num_counter = 0 num_histogram = 0 ...
def info(endpoint): """Show metric info from a Prometheus endpoint. \b Example: $ ddev meta prom info :8080/_status/vars """ endpoint = sanitize_endpoint(endpoint) metrics = parse_metrics(endpoint) num_metrics = len(metrics) num_gauge = 0 num_counter = 0 num_histogram = 0 ...
[ "Show", "metric", "info", "from", "a", "Prometheus", "endpoint", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/prometheus.py#L66-L104
[ "def", "info", "(", "endpoint", ")", ":", "endpoint", "=", "sanitize_endpoint", "(", "endpoint", ")", "metrics", "=", "parse_metrics", "(", "endpoint", ")", "num_metrics", "=", "len", "(", "metrics", ")", "num_gauge", "=", "0", "num_counter", "=", "0", "nu...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
parse
Interactively parse metric info from a Prometheus endpoint.
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/prometheus.py
def parse(ctx, endpoint, check, here): """Interactively parse metric info from a Prometheus endpoint.""" if here: output_dir = os.getcwd() else: output_dir = path_join(get_root(), check) if not dir_exists(output_dir): abort( 'Check `{check}` does not exist...
def parse(ctx, endpoint, check, here): """Interactively parse metric info from a Prometheus endpoint.""" if here: output_dir = os.getcwd() else: output_dir = path_join(get_root(), check) if not dir_exists(output_dir): abort( 'Check `{check}` does not exist...
[ "Interactively", "parse", "metric", "info", "from", "a", "Prometheus", "endpoint", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/prometheus.py#L114-L251
[ "def", "parse", "(", "ctx", ",", "endpoint", ",", "check", ",", "here", ")", ":", "if", "here", ":", "output_dir", "=", "os", ".", "getcwd", "(", ")", "else", ":", "output_dir", "=", "path_join", "(", "get_root", "(", ")", ",", "check", ")", "if", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
DeleteMany._add_to_bulk
Add this operation to the _Bulk instance `bulkobj`.
tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_delete(self._filter, 0, collation=self._collation)
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_delete(self._filter, 0, collation=self._collation)
[ "Add", "this", "operation", "to", "the", "_Bulk", "instance", "bulkobj", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py#L119-L121
[ "def", "_add_to_bulk", "(", "self", ",", "bulkobj", ")", ":", "bulkobj", ".", "add_delete", "(", "self", ".", "_filter", ",", "0", ",", "collation", "=", "self", ".", "_collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ReplaceOne._add_to_bulk
Add this operation to the _Bulk instance `bulkobj`.
tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_replace(self._filter, self._doc, self._upsert, collation=self._collation)
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_replace(self._filter, self._doc, self._upsert, collation=self._collation)
[ "Add", "this", "operation", "to", "the", "_Bulk", "instance", "bulkobj", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py#L192-L195
[ "def", "_add_to_bulk", "(", "self", ",", "bulkobj", ")", ":", "bulkobj", ".", "add_replace", "(", "self", ".", "_filter", ",", "self", ".", "_doc", ",", "self", ".", "_upsert", ",", "collation", "=", "self", ".", "_collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
UpdateOne._add_to_bulk
Add this operation to the _Bulk instance `bulkobj`.
tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_update(self._filter, self._doc, False, self._upsert, collation=self._collation)
def _add_to_bulk(self, bulkobj): """Add this operation to the _Bulk instance `bulkobj`.""" bulkobj.add_update(self._filter, self._doc, False, self._upsert, collation=self._collation)
[ "Add", "this", "operation", "to", "the", "_Bulk", "instance", "bulkobj", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/operations.py#L222-L225
[ "def", "_add_to_bulk", "(", "self", ",", "bulkobj", ")", ":", "bulkobj", ".", "add_update", "(", "self", ".", "_filter", ",", "self", ".", "_doc", ",", "False", ",", "self", ".", "_upsert", ",", "collation", "=", "self", ".", "_collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SSLContext.load_cert_chain
Load a private key and the corresponding certificate. The certfile string must be the path to a single file in PEM format containing the certificate as well as any number of CA certificates needed to establish the certificate's authenticity. The keyfile string, if present, must point to ...
tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_context.py
def load_cert_chain(self, certfile, keyfile=None): """Load a private key and the corresponding certificate. The certfile string must be the path to a single file in PEM format containing the certificate as well as any number of CA certificates needed to establish the certificate's authen...
def load_cert_chain(self, certfile, keyfile=None): """Load a private key and the corresponding certificate. The certfile string must be the path to a single file in PEM format containing the certificate as well as any number of CA certificates needed to establish the certificate's authen...
[ "Load", "a", "private", "key", "and", "the", "corresponding", "certificate", ".", "The", "certfile", "string", "must", "be", "the", "path", "to", "a", "single", "file", "in", "PEM", "format", "containing", "the", "certificate", "as", "well", "as", "any", "...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_context.py#L65-L74
[ "def", "load_cert_chain", "(", "self", ",", "certfile", ",", "keyfile", "=", "None", ")", ":", "self", ".", "_certfile", "=", "certfile", "self", ".", "_keyfile", "=", "keyfile" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
SSLContext.wrap_socket
Wrap an existing Python socket sock and return an ssl.SSLSocket object.
tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_context.py
def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, dummy=None): """Wrap an existing Python socket sock and return an ssl.SSLSocket object. """ return ssl.wrap_socket(sock, keyfile=self._keyfile, ...
def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, dummy=None): """Wrap an existing Python socket sock and return an ssl.SSLSocket object. """ return ssl.wrap_socket(sock, keyfile=self._keyfile, ...
[ "Wrap", "an", "existing", "Python", "socket", "sock", "and", "return", "an", "ssl", ".", "SSLSocket", "object", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_context.py#L83-L96
[ "def", "wrap_socket", "(", "self", ",", "sock", ",", "server_side", "=", "False", ",", "do_handshake_on_connect", "=", "True", ",", "suppress_ragged_eofs", "=", "True", ",", "dummy", "=", "None", ")", ":", "return", "ssl", ".", "wrap_socket", "(", "sock", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
parse_metric_family
Parse the binary buffer in input, searching for Prometheus messages of type MetricFamily [0] delimited by a varint32 [1]. [0] https://github.com/prometheus/client_model/blob/086fe7ca28bde6cec2acd5223423c1475a362858/metrics.proto#L76-%20%20L81 # noqa: E501 [1] https://developers.google.com/protocol-buffers...
datadog_checks_base/datadog_checks/base/utils/prometheus/functions.py
def parse_metric_family(buf): """ Parse the binary buffer in input, searching for Prometheus messages of type MetricFamily [0] delimited by a varint32 [1]. [0] https://github.com/prometheus/client_model/blob/086fe7ca28bde6cec2acd5223423c1475a362858/metrics.proto#L76-%20%20L81 # noqa: E501 [1] http...
def parse_metric_family(buf): """ Parse the binary buffer in input, searching for Prometheus messages of type MetricFamily [0] delimited by a varint32 [1]. [0] https://github.com/prometheus/client_model/blob/086fe7ca28bde6cec2acd5223423c1475a362858/metrics.proto#L76-%20%20L81 # noqa: E501 [1] http...
[ "Parse", "the", "binary", "buffer", "in", "input", "searching", "for", "Prometheus", "messages", "of", "type", "MetricFamily", "[", "0", "]", "delimited", "by", "a", "varint32", "[", "1", "]", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/prometheus/functions.py#L11-L28
[ "def", "parse_metric_family", "(", "buf", ")", ":", "n", "=", "0", "while", "n", "<", "len", "(", "buf", ")", ":", "msg_len", ",", "new_pos", "=", "_DecodeVarint32", "(", "buf", ",", "n", ")", "n", "=", "new_pos", "msg_buf", "=", "buf", "[", "n", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
multidict
Convert duplicate keys values to lists.
riakcs/datadog_checks/riakcs/riakcs.py
def multidict(ordered_pairs): """Convert duplicate keys values to lists.""" # read all values into lists d = defaultdict(list) for k, v in ordered_pairs: d[k].append(v) # unpack lists that have only 1 item dict_copy = deepcopy(d) for k, v in iteritems(dict_copy): if len(v) ==...
def multidict(ordered_pairs): """Convert duplicate keys values to lists.""" # read all values into lists d = defaultdict(list) for k, v in ordered_pairs: d[k].append(v) # unpack lists that have only 1 item dict_copy = deepcopy(d) for k, v in iteritems(dict_copy): if len(v) ==...
[ "Convert", "duplicate", "keys", "values", "to", "lists", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/riakcs/datadog_checks/riakcs/riakcs.py#L16-L27
[ "def", "multidict", "(", "ordered_pairs", ")", ":", "# read all values into lists", "d", "=", "defaultdict", "(", "list", ")", "for", "k", ",", "v", "in", "ordered_pairs", ":", "d", "[", "k", "]", ".", "append", "(", "v", ")", "# unpack lists that have only ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
read_packages
Generator yielding one Package instance for every corresponing line in a requirements file
datadog_checks_dev/datadog_checks/dev/tooling/requirements.py
def read_packages(reqs_file): """ Generator yielding one Package instance for every corresponing line in a requirements file """ for line in stream_file_lines(reqs_file): line = line.strip() if not line.startswith(('#', '--hash')): match = DEP_PATTERN.match(line) ...
def read_packages(reqs_file): """ Generator yielding one Package instance for every corresponing line in a requirements file """ for line in stream_file_lines(reqs_file): line = line.strip() if not line.startswith(('#', '--hash')): match = DEP_PATTERN.match(line) ...
[ "Generator", "yielding", "one", "Package", "instance", "for", "every", "corresponing", "line", "in", "a", "requirements", "file" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/requirements.py#L163-L174
[ "def", "read_packages", "(", "reqs_file", ")", ":", "for", "line", "in", "stream_file_lines", "(", "reqs_file", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "not", "line", ".", "startswith", "(", "(", "'#'", ",", "'--hash'", ")", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PackageCatalog.write_packages
Dump the packages in the catalog in a requirements file
datadog_checks_dev/datadog_checks/dev/tooling/requirements.py
def write_packages(self, reqs_file): """ Dump the packages in the catalog in a requirements file """ write_file_lines(reqs_file, ('{}\n'.format(package) for package in self.packages))
def write_packages(self, reqs_file): """ Dump the packages in the catalog in a requirements file """ write_file_lines(reqs_file, ('{}\n'.format(package) for package in self.packages))
[ "Dump", "the", "packages", "in", "the", "catalog", "in", "a", "requirements", "file" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/requirements.py#L119-L123
[ "def", "write_packages", "(", "self", ",", "reqs_file", ")", ":", "write_file_lines", "(", "reqs_file", ",", "(", "'{}\\n'", ".", "format", "(", "package", ")", "for", "package", "in", "self", ".", "packages", ")", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PackageCatalog.add_package
Add a Package to the catalog for the given check
datadog_checks_dev/datadog_checks/dev/tooling/requirements.py
def add_package(self, check_name, package): """ Add a Package to the catalog for the given check """ self._package_set.add(package) package_data = self._packages[package.name] self._checks_deps[check_name].append(package) # Versions if package.version: ...
def add_package(self, check_name, package): """ Add a Package to the catalog for the given check """ self._package_set.add(package) package_data = self._packages[package.name] self._checks_deps[check_name].append(package) # Versions if package.version: ...
[ "Add", "a", "Package", "to", "the", "catalog", "for", "the", "given", "check" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/requirements.py#L125-L141
[ "def", "add_package", "(", "self", ",", "check_name", ",", "package", ")", ":", "self", ".", "_package_set", ".", "add", "(", "package", ")", "package_data", "=", "self", ".", "_packages", "[", "package", ".", "name", "]", "self", ".", "_checks_deps", "[...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Kubernetes._update_container_metrics
Publish metrics for a subcontainer and handle filtering on tags
kubernetes/datadog_checks/kubernetes/kubernetes.py
def _update_container_metrics(self, instance, subcontainer, kube_labels): """Publish metrics for a subcontainer and handle filtering on tags""" tags = list(instance.get('tags', [])) # add support for custom tags if len(subcontainer.get('aliases', [])) >= 1: # The first alias seems ...
def _update_container_metrics(self, instance, subcontainer, kube_labels): """Publish metrics for a subcontainer and handle filtering on tags""" tags = list(instance.get('tags', [])) # add support for custom tags if len(subcontainer.get('aliases', [])) >= 1: # The first alias seems ...
[ "Publish", "metrics", "for", "a", "subcontainer", "and", "handle", "filtering", "on", "tags" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes/datadog_checks/kubernetes/kubernetes.py#L321-L391
[ "def", "_update_container_metrics", "(", "self", ",", "instance", ",", "subcontainer", ",", "kube_labels", ")", ":", "tags", "=", "list", "(", "instance", ".", "get", "(", "'tags'", ",", "[", "]", ")", ")", "# add support for custom tags", "if", "len", "(", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Kubernetes._update_pods_metrics
Reports the number of running pods on this node, tagged by service and creator We go though all the pods, extract tags then count them by tag list, sorted and serialized in a pipe-separated string (it is an illegar character for tags)
kubernetes/datadog_checks/kubernetes/kubernetes.py
def _update_pods_metrics(self, instance, pods): """ Reports the number of running pods on this node, tagged by service and creator We go though all the pods, extract tags then count them by tag list, sorted and serialized in a pipe-separated string (it is an illegar character for tags) ...
def _update_pods_metrics(self, instance, pods): """ Reports the number of running pods on this node, tagged by service and creator We go though all the pods, extract tags then count them by tag list, sorted and serialized in a pipe-separated string (it is an illegar character for tags) ...
[ "Reports", "the", "number", "of", "running", "pods", "on", "this", "node", "tagged", "by", "service", "and", "creator" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes/datadog_checks/kubernetes/kubernetes.py#L488-L512
[ "def", "_update_pods_metrics", "(", "self", ",", "instance", ",", "pods", ")", ":", "tags_map", "=", "defaultdict", "(", "int", ")", "for", "pod", "in", "pods", "[", "'items'", "]", ":", "pod_meta", "=", "pod", ".", "get", "(", "'metadata'", ",", "{", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Kubernetes._update_kube_events
Process kube events and send ddog events The namespace filtering is done here instead of KubeEventRetriever to avoid interfering with service discovery
kubernetes/datadog_checks/kubernetes/kubernetes.py
def _update_kube_events(self, instance, pods_list, event_items): """ Process kube events and send ddog events The namespace filtering is done here instead of KubeEventRetriever to avoid interfering with service discovery """ node_ip, node_name = self.kubeutil.get_node_inf...
def _update_kube_events(self, instance, pods_list, event_items): """ Process kube events and send ddog events The namespace filtering is done here instead of KubeEventRetriever to avoid interfering with service discovery """ node_ip, node_name = self.kubeutil.get_node_inf...
[ "Process", "kube", "events", "and", "send", "ddog", "events", "The", "namespace", "filtering", "is", "done", "here", "instead", "of", "KubeEventRetriever", "to", "avoid", "interfering", "with", "service", "discovery" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes/datadog_checks/kubernetes/kubernetes.py#L514-L577
[ "def", "_update_kube_events", "(", "self", ",", "instance", ",", "pods_list", ",", "event_items", ")", ":", "node_ip", ",", "node_name", "=", "self", ".", "kubeutil", ".", "get_node_info", "(", ")", "self", ".", "log", ".", "debug", "(", "'Processing events ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Kubernetes.refresh_leader_status
calls kubeutil.refresh_leader and compares the resulting leader status with the previous one. If it changed, update the event collection logic
kubernetes/datadog_checks/kubernetes/kubernetes.py
def refresh_leader_status(self, instance): """ calls kubeutil.refresh_leader and compares the resulting leader status with the previous one. If it changed, update the event collection logic """ if not self.leader_candidate: return leader_status = self...
def refresh_leader_status(self, instance): """ calls kubeutil.refresh_leader and compares the resulting leader status with the previous one. If it changed, update the event collection logic """ if not self.leader_candidate: return leader_status = self...
[ "calls", "kubeutil", ".", "refresh_leader", "and", "compares", "the", "resulting", "leader", "status", "with", "the", "previous", "one", ".", "If", "it", "changed", "update", "the", "event", "collection", "logic" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes/datadog_checks/kubernetes/kubernetes.py#L579-L597
[ "def", "refresh_leader_status", "(", "self", ",", "instance", ")", ":", "if", "not", "self", ".", "leader_candidate", ":", "return", "leader_status", "=", "self", ".", "kubeutil", ".", "is_leader", "self", ".", "kubeutil", ".", "refresh_leader", "(", ")", "#...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cacti._read_rrd
Main metric fetching method
cacti/datadog_checks/cacti/cacti.py
def _read_rrd(self, rrd_path, hostname, device_name, tags): ''' Main metric fetching method ''' metric_count = 0 try: info = self._get_rrd_info(rrd_path) except Exception: # Unable to read RRD file, ignore it self.log.exception("Unable to read RRD fil...
def _read_rrd(self, rrd_path, hostname, device_name, tags): ''' Main metric fetching method ''' metric_count = 0 try: info = self._get_rrd_info(rrd_path) except Exception: # Unable to read RRD file, ignore it self.log.exception("Unable to read RRD fil...
[ "Main", "metric", "fetching", "method" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cacti/datadog_checks/cacti/cacti.py#L114-L164
[ "def", "_read_rrd", "(", "self", ",", "rrd_path", ",", "hostname", ",", "device_name", ",", "tags", ")", ":", "metric_count", "=", "0", "try", ":", "info", "=", "self", ".", "_get_rrd_info", "(", "rrd_path", ")", "except", "Exception", ":", "# Unable to re...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cacti._fetch_rrd_meta
Fetch metadata about each RRD in this Cacti DB, returning a list of tuples of (hostname, device_name, rrd_path)
cacti/datadog_checks/cacti/cacti.py
def _fetch_rrd_meta(self, connection, rrd_path_root, whitelist, field_names, tags): ''' Fetch metadata about each RRD in this Cacti DB, returning a list of tuples of (hostname, device_name, rrd_path) ''' def _in_whitelist(rrd): path = rrd.replace('<path_rra>/', '') ...
def _fetch_rrd_meta(self, connection, rrd_path_root, whitelist, field_names, tags): ''' Fetch metadata about each RRD in this Cacti DB, returning a list of tuples of (hostname, device_name, rrd_path) ''' def _in_whitelist(rrd): path = rrd.replace('<path_rra>/', '') ...
[ "Fetch", "metadata", "about", "each", "RRD", "in", "this", "Cacti", "DB", "returning", "a", "list", "of", "tuples", "of", "(", "hostname", "device_name", "rrd_path", ")" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cacti/datadog_checks/cacti/cacti.py#L166-L214
[ "def", "_fetch_rrd_meta", "(", "self", ",", "connection", ",", "rrd_path_root", ",", "whitelist", ",", "field_names", ",", "tags", ")", ":", "def", "_in_whitelist", "(", "rrd", ")", ":", "path", "=", "rrd", ".", "replace", "(", "'<path_rra>/'", ",", "''", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
Cacti._format_metric_name
Format a cacti metric name into a Datadog-friendly name
cacti/datadog_checks/cacti/cacti.py
def _format_metric_name(self, m_name, cfunc): ''' Format a cacti metric name into a Datadog-friendly name ''' try: aggr = CFUNC_TO_AGGR[cfunc] except KeyError: aggr = cfunc.lower() try: m_name = CACTI_TO_DD[m_name] if aggr != 'avg': ...
def _format_metric_name(self, m_name, cfunc): ''' Format a cacti metric name into a Datadog-friendly name ''' try: aggr = CFUNC_TO_AGGR[cfunc] except KeyError: aggr = cfunc.lower() try: m_name = CACTI_TO_DD[m_name] if aggr != 'avg': ...
[ "Format", "a", "cacti", "metric", "name", "into", "a", "Datadog", "-", "friendly", "name" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cacti/datadog_checks/cacti/cacti.py#L216-L229
[ "def", "_format_metric_name", "(", "self", ",", "m_name", ",", "cfunc", ")", ":", "try", ":", "aggr", "=", "CFUNC_TO_AGGR", "[", "cfunc", "]", "except", "KeyError", ":", "aggr", "=", "cfunc", ".", "lower", "(", ")", "try", ":", "m_name", "=", "CACTI_TO...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
calculate_perf_100nsec_timer
PERF_100NSEC_TIMER https://technet.microsoft.com/en-us/library/cc728274(v=ws.10).aspx
datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py
def calculate_perf_100nsec_timer(previous, current, property_name): """ PERF_100NSEC_TIMER https://technet.microsoft.com/en-us/library/cc728274(v=ws.10).aspx """ n0 = previous[property_name] n1 = current[property_name] d0 = previous["Timestamp_Sys100NS"] d1 = current["Timestamp_Sys100NS...
def calculate_perf_100nsec_timer(previous, current, property_name): """ PERF_100NSEC_TIMER https://technet.microsoft.com/en-us/library/cc728274(v=ws.10).aspx """ n0 = previous[property_name] n1 = current[property_name] d0 = previous["Timestamp_Sys100NS"] d1 = current["Timestamp_Sys100NS...
[ "PERF_100NSEC_TIMER" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py#L96-L110
[ "def", "calculate_perf_100nsec_timer", "(", "previous", ",", "current", ",", "property_name", ")", ":", "n0", "=", "previous", "[", "property_name", "]", "n1", "=", "current", "[", "property_name", "]", "d0", "=", "previous", "[", "\"Timestamp_Sys100NS\"", "]", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
calculate_perf_counter_bulk_count
PERF_COUNTER_BULK_COUNT https://technet.microsoft.com/en-us/library/cc757486(v=ws.10).aspx
datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py
def calculate_perf_counter_bulk_count(previous, current, property_name): """ PERF_COUNTER_BULK_COUNT https://technet.microsoft.com/en-us/library/cc757486(v=ws.10).aspx """ n0 = previous[property_name] n1 = current[property_name] d0 = previous["Timestamp_Sys100NS"] d1 = current["Timestam...
def calculate_perf_counter_bulk_count(previous, current, property_name): """ PERF_COUNTER_BULK_COUNT https://technet.microsoft.com/en-us/library/cc757486(v=ws.10).aspx """ n0 = previous[property_name] n1 = current[property_name] d0 = previous["Timestamp_Sys100NS"] d1 = current["Timestam...
[ "PERF_COUNTER_BULK_COUNT" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py#L114-L129
[ "def", "calculate_perf_counter_bulk_count", "(", "previous", ",", "current", ",", "property_name", ")", ":", "n0", "=", "previous", "[", "property_name", "]", "n1", "=", "current", "[", "property_name", "]", "d0", "=", "previous", "[", "\"Timestamp_Sys100NS\"", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
calculate_perf_counter_100ns_queuelen_type
PERF_COUNTER_100NS_QUEUELEN_TYPE Average length of a queue to a resource over time in 100 nanosecond units. https://msdn.microsoft.com/en-us/library/aa392905(v=vs.85).aspx Formula (n1 - n0) / (d1 - d0)
datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py
def calculate_perf_counter_100ns_queuelen_type(previous, current, property_name): """ PERF_COUNTER_100NS_QUEUELEN_TYPE Average length of a queue to a resource over time in 100 nanosecond units. https://msdn.microsoft.com/en-us/library/aa392905(v=vs.85).aspx Formula (n1 - n0) / (d1 - d0) """ ...
def calculate_perf_counter_100ns_queuelen_type(previous, current, property_name): """ PERF_COUNTER_100NS_QUEUELEN_TYPE Average length of a queue to a resource over time in 100 nanosecond units. https://msdn.microsoft.com/en-us/library/aa392905(v=vs.85).aspx Formula (n1 - n0) / (d1 - d0) """ ...
[ "PERF_COUNTER_100NS_QUEUELEN_TYPE" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/win/wmi/counter_type.py#L184-L201
[ "def", "calculate_perf_counter_100ns_queuelen_type", "(", "previous", ",", "current", ",", "property_name", ")", ":", "n0", "=", "previous", "[", "property_name", "]", "n1", "=", "current", "[", "property_name", "]", "d0", "=", "previous", "[", "\"Timestamp_Sys100...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._server_known
Return whether the hostname and port combination was already seen
postgres/datadog_checks/postgres/postgres.py
def _server_known(cls, host, port): """ Return whether the hostname and port combination was already seen """ with PostgreSql._known_servers_lock: return (host, port) in PostgreSql._known_servers
def _server_known(cls, host, port): """ Return whether the hostname and port combination was already seen """ with PostgreSql._known_servers_lock: return (host, port) in PostgreSql._known_servers
[ "Return", "whether", "the", "hostname", "and", "port", "combination", "was", "already", "seen" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L377-L382
[ "def", "_server_known", "(", "cls", ",", "host", ",", "port", ")", ":", "with", "PostgreSql", ".", "_known_servers_lock", ":", "return", "(", "host", ",", "port", ")", "in", "PostgreSql", ".", "_known_servers" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._set_server_known
Store the host/port combination for this server
postgres/datadog_checks/postgres/postgres.py
def _set_server_known(cls, host, port): """ Store the host/port combination for this server """ with PostgreSql._known_servers_lock: PostgreSql._known_servers.add((host, port))
def _set_server_known(cls, host, port): """ Store the host/port combination for this server """ with PostgreSql._known_servers_lock: PostgreSql._known_servers.add((host, port))
[ "Store", "the", "host", "/", "port", "combination", "for", "this", "server" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L385-L390
[ "def", "_set_server_known", "(", "cls", ",", "host", ",", "port", ")", ":", "with", "PostgreSql", ".", "_known_servers_lock", ":", "PostgreSql", ".", "_known_servers", ".", "add", "(", "(", "host", ",", "port", ")", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_instance_metrics
Add NEWER_92_METRICS to the default set of COMMON_METRICS when server version is 9.2 or later. Store the list of metrics in the check instance to avoid rebuilding it at every collection cycle. In case we have multiple instances pointing to the same postgres server monitoring di...
postgres/datadog_checks/postgres/postgres.py
def _get_instance_metrics(self, key, db, database_size_metrics, collect_default_db): """ Add NEWER_92_METRICS to the default set of COMMON_METRICS when server version is 9.2 or later. Store the list of metrics in the check instance to avoid rebuilding it at every collection cycl...
def _get_instance_metrics(self, key, db, database_size_metrics, collect_default_db): """ Add NEWER_92_METRICS to the default set of COMMON_METRICS when server version is 9.2 or later. Store the list of metrics in the check instance to avoid rebuilding it at every collection cycl...
[ "Add", "NEWER_92_METRICS", "to", "the", "default", "set", "of", "COMMON_METRICS", "when", "server", "version", "is", "9", ".", "2", "or", "later", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L467-L528
[ "def", "_get_instance_metrics", "(", "self", ",", "key", ",", "db", ",", "database_size_metrics", ",", "collect_default_db", ")", ":", "metrics", "=", "self", ".", "instance_metrics", ".", "get", "(", "key", ")", "if", "metrics", "is", "None", ":", "host", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_bgw_metrics
Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS depending on the postgres version. Uses a dictionnary to save the result for each instance
postgres/datadog_checks/postgres/postgres.py
def _get_bgw_metrics(self, key, db): """Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS depending on the postgres version. Uses a dictionnary to save the result for each instance """ # Extended 9.2+ metrics if needed metrics = self.bgw_metrics.g...
def _get_bgw_metrics(self, key, db): """Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS depending on the postgres version. Uses a dictionnary to save the result for each instance """ # Extended 9.2+ metrics if needed metrics = self.bgw_metrics.g...
[ "Use", "either", "COMMON_BGW_METRICS", "or", "COMMON_BGW_METRICS", "+", "NEWER_92_BGW_METRICS", "depending", "on", "the", "postgres", "version", ".", "Uses", "a", "dictionnary", "to", "save", "the", "result", "for", "each", "instance" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L530-L564
[ "def", "_get_bgw_metrics", "(", "self", ",", "key", ",", "db", ")", ":", "# Extended 9.2+ metrics if needed", "metrics", "=", "self", ".", "bgw_metrics", ".", "get", "(", "key", ")", "if", "metrics", "is", "None", ":", "# Hack to make sure that if we have multiple...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_archiver_metrics
Use COMMON_ARCHIVER_METRICS to read from pg_stat_archiver as defined in 9.4 (first version to have this table). Uses a dictionary to save the result for each instance
postgres/datadog_checks/postgres/postgres.py
def _get_archiver_metrics(self, key, db): """Use COMMON_ARCHIVER_METRICS to read from pg_stat_archiver as defined in 9.4 (first version to have this table). Uses a dictionary to save the result for each instance """ # While there's only one set for now, prepare for future additio...
def _get_archiver_metrics(self, key, db): """Use COMMON_ARCHIVER_METRICS to read from pg_stat_archiver as defined in 9.4 (first version to have this table). Uses a dictionary to save the result for each instance """ # While there's only one set for now, prepare for future additio...
[ "Use", "COMMON_ARCHIVER_METRICS", "to", "read", "from", "pg_stat_archiver", "as", "defined", "in", "9", ".", "4", "(", "first", "version", "to", "have", "this", "table", ")", ".", "Uses", "a", "dictionary", "to", "save", "the", "result", "for", "each", "in...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L566-L594
[ "def", "_get_archiver_metrics", "(", "self", ",", "key", ",", "db", ")", ":", "# While there's only one set for now, prepare for future additions to", "# the table, mirroring _get_bgw_metrics()", "metrics", "=", "self", ".", "archiver_metrics", ".", "get", "(", "key", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_replication_metrics
Use either REPLICATION_METRICS_10, REPLICATION_METRICS_9_1, or REPLICATION_METRICS_9_1 + REPLICATION_METRICS_9_2, depending on the postgres version. Uses a dictionnary to save the result for each instance
postgres/datadog_checks/postgres/postgres.py
def _get_replication_metrics(self, key, db): """ Use either REPLICATION_METRICS_10, REPLICATION_METRICS_9_1, or REPLICATION_METRICS_9_1 + REPLICATION_METRICS_9_2, depending on the postgres version. Uses a dictionnary to save the result for each instance """ metrics = self...
def _get_replication_metrics(self, key, db): """ Use either REPLICATION_METRICS_10, REPLICATION_METRICS_9_1, or REPLICATION_METRICS_9_1 + REPLICATION_METRICS_9_2, depending on the postgres version. Uses a dictionnary to save the result for each instance """ metrics = self...
[ "Use", "either", "REPLICATION_METRICS_10", "REPLICATION_METRICS_9_1", "or", "REPLICATION_METRICS_9_1", "+", "REPLICATION_METRICS_9_2", "depending", "on", "the", "postgres", "version", ".", "Uses", "a", "dictionnary", "to", "save", "the", "result", "for", "each", "instan...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L596-L611
[ "def", "_get_replication_metrics", "(", "self", ",", "key", ",", "db", ")", ":", "metrics", "=", "self", ".", "replication_metrics", ".", "get", "(", "key", ")", "if", "self", ".", "_is_10_or_above", "(", "key", ",", "db", ")", "and", "metrics", "is", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_activity_metrics
Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2 depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10. Uses a dictionnary to save the result for each instance
postgres/datadog_checks/postgres/postgres.py
def _get_activity_metrics(self, key, db): """ Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2 depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10. Uses a dictionnary to save the result for each instance """ m...
def _get_activity_metrics(self, key, db): """ Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2 depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10. Uses a dictionnary to save the result for each instance """ m...
[ "Use", "ACTIVITY_METRICS_LT_8_3", "or", "ACTIVITY_METRICS_8_3", "or", "ACTIVITY_METRICS_9_2", "depending", "on", "the", "postgres", "version", "in", "conjunction", "with", "ACTIVITY_QUERY_10", "or", "ACTIVITY_QUERY_LT_10", ".", "Uses", "a", "dictionnary", "to", "save", ...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L613-L637
[ "def", "_get_activity_metrics", "(", "self", ",", "key", ",", "db", ")", ":", "metrics_data", "=", "self", ".", "activity_metrics", ".", "get", "(", "key", ")", "if", "metrics_data", "is", "None", ":", "query", "=", "self", ".", "ACTIVITY_QUERY_10", "if", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._build_relations_config
Builds a dictionary from relations configuration while maintaining compatibility
postgres/datadog_checks/postgres/postgres.py
def _build_relations_config(self, yamlconfig): """Builds a dictionary from relations configuration while maintaining compatibility """ config = {} for element in yamlconfig: if isinstance(element, str): config[element] = {'relation_name': element, 'schemas': [...
def _build_relations_config(self, yamlconfig): """Builds a dictionary from relations configuration while maintaining compatibility """ config = {} for element in yamlconfig: if isinstance(element, str): config[element] = {'relation_name': element, 'schemas': [...
[ "Builds", "a", "dictionary", "from", "relations", "configuration", "while", "maintaining", "compatibility" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L639-L657
[ "def", "_build_relations_config", "(", "self", ",", "yamlconfig", ")", ":", "config", "=", "{", "}", "for", "element", "in", "yamlconfig", ":", "if", "isinstance", "(", "element", ",", "str", ")", ":", "config", "[", "element", "]", "=", "{", "'relation_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._collect_stats
Query pg_stat_* for various metrics If relations is not an empty list, gather per-relation metrics on top of that. If custom_metrics is not an empty list, gather custom metrics defined in postgres.yaml
postgres/datadog_checks/postgres/postgres.py
def _collect_stats( self, key, db, instance_tags, relations, custom_metrics, collect_function_metrics, collect_count_metrics, collect_activity_metrics, collect_database_size_metrics, collect_default_db, interface_error, ...
def _collect_stats( self, key, db, instance_tags, relations, custom_metrics, collect_function_metrics, collect_count_metrics, collect_activity_metrics, collect_database_size_metrics, collect_default_db, interface_error, ...
[ "Query", "pg_stat_", "*", "for", "various", "metrics", "If", "relations", "is", "not", "an", "empty", "list", "gather", "per", "-", "relation", "metrics", "on", "top", "of", "that", ".", "If", "custom_metrics", "is", "not", "an", "empty", "list", "gather",...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L759-L834
[ "def", "_collect_stats", "(", "self", ",", "key", ",", "db", ",", "instance_tags", ",", "relations", ",", "custom_metrics", ",", "collect_function_metrics", ",", "collect_count_metrics", ",", "collect_activity_metrics", ",", "collect_database_size_metrics", ",", "collec...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql.get_connection
Get and memoize connections to instances
postgres/datadog_checks/postgres/postgres.py
def get_connection(self, key, host, port, user, password, dbname, ssl, connect_fct, tags, use_cached=True): """Get and memoize connections to instances""" if key in self.dbs and use_cached: return self.dbs[key] elif host != "" and user != "": try: if host...
def get_connection(self, key, host, port, user, password, dbname, ssl, connect_fct, tags, use_cached=True): """Get and memoize connections to instances""" if key in self.dbs and use_cached: return self.dbs[key] elif host != "" and user != "": try: if host...
[ "Get", "and", "memoize", "connections", "to", "instances" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L843-L876
[ "def", "get_connection", "(", "self", ",", "key", ",", "host", ",", "port", ",", "user", ",", "password", ",", "dbname", ",", "ssl", ",", "connect_fct", ",", "tags", ",", "use_cached", "=", "True", ")", ":", "if", "key", "in", "self", ".", "dbs", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostgreSql._get_custom_queries
Given a list of custom_queries, execute each query and parse the result for metrics
postgres/datadog_checks/postgres/postgres.py
def _get_custom_queries(self, db, tags, custom_queries, programming_error): """ Given a list of custom_queries, execute each query and parse the result for metrics """ for custom_query in custom_queries: metric_prefix = custom_query.get('metric_prefix') if not met...
def _get_custom_queries(self, db, tags, custom_queries, programming_error): """ Given a list of custom_queries, execute each query and parse the result for metrics """ for custom_query in custom_queries: metric_prefix = custom_query.get('metric_prefix') if not met...
[ "Given", "a", "list", "of", "custom_queries", "execute", "each", "query", "and", "parse", "the", "result", "for", "metrics" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postgres/datadog_checks/postgres/postgres.py#L878-L970
[ "def", "_get_custom_queries", "(", "self", ",", "db", ",", "tags", ",", "custom_queries", ",", "programming_error", ")", ":", "for", "custom_query", "in", "custom_queries", ":", "metric_prefix", "=", "custom_query", ".", "get", "(", "'metric_prefix'", ")", "if",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
IbmWasCheck.process_stats
The XML will have Stat Nodes and Nodes that contain the metrics themselves This code recursively goes through each Stat Node to properly setup tags where each Stat will have a different tag key depending on the context.
ibm_was/datadog_checks/ibm_was/ibm_was.py
def process_stats(self, stats, prefix, metric_categories, nested_tags, tags, recursion_level=0): """ The XML will have Stat Nodes and Nodes that contain the metrics themselves This code recursively goes through each Stat Node to properly setup tags where each Stat will have a different t...
def process_stats(self, stats, prefix, metric_categories, nested_tags, tags, recursion_level=0): """ The XML will have Stat Nodes and Nodes that contain the metrics themselves This code recursively goes through each Stat Node to properly setup tags where each Stat will have a different t...
[ "The", "XML", "will", "have", "Stat", "Nodes", "and", "Nodes", "that", "contain", "the", "metrics", "themselves", "This", "code", "recursively", "goes", "through", "each", "Stat", "Node", "to", "properly", "setup", "tags", "where", "each", "Stat", "will", "h...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ibm_was/datadog_checks/ibm_was/ibm_was.py#L81-L92
[ "def", "process_stats", "(", "self", ",", "stats", ",", "prefix", ",", "metric_categories", ",", "nested_tags", ",", "tags", ",", "recursion_level", "=", "0", ")", ":", "for", "child", "in", "stats", ":", "if", "child", ".", "tag", "in", "metrics", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_to_micros
Convert duration 'dur' to microseconds.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def _to_micros(dur): """Convert duration 'dur' to microseconds.""" if hasattr(dur, 'total_seconds'): return int(dur.total_seconds() * 10e5) # Python 2.6 return dur.microseconds + (dur.seconds + dur.days * 24 * 3600) * 1000000
def _to_micros(dur): """Convert duration 'dur' to microseconds.""" if hasattr(dur, 'total_seconds'): return int(dur.total_seconds() * 10e5) # Python 2.6 return dur.microseconds + (dur.seconds + dur.days * 24 * 3600) * 1000000
[ "Convert", "duration", "dur", "to", "microseconds", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L283-L288
[ "def", "_to_micros", "(", "dur", ")", ":", "if", "hasattr", "(", "dur", ",", "'total_seconds'", ")", ":", "return", "int", "(", "dur", ".", "total_seconds", "(", ")", "*", "10e5", ")", "# Python 2.6", "return", "dur", ".", "microseconds", "+", "(", "du...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_validate_event_listeners
Validate event listeners
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def _validate_event_listeners(option, listeners): """Validate event listeners""" if not isinstance(listeners, Sequence): raise TypeError("%s must be a list or tuple" % (option,)) for listener in listeners: if not isinstance(listener, _EventListener): raise TypeError("Listeners fo...
def _validate_event_listeners(option, listeners): """Validate event listeners""" if not isinstance(listeners, Sequence): raise TypeError("%s must be a list or tuple" % (option,)) for listener in listeners: if not isinstance(listener, _EventListener): raise TypeError("Listeners fo...
[ "Validate", "event", "listeners" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L291-L300
[ "def", "_validate_event_listeners", "(", "option", ",", "listeners", ")", ":", "if", "not", "isinstance", "(", "listeners", ",", "Sequence", ")", ":", "raise", "TypeError", "(", "\"%s must be a list or tuple\"", "%", "(", "option", ",", ")", ")", "for", "liste...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
register
Register a global event listener. :Parameters: - `listener`: A subclasses of :class:`CommandListener`, :class:`ServerHeartbeatListener`, :class:`ServerListener`, or :class:`TopologyListener`.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def register(listener): """Register a global event listener. :Parameters: - `listener`: A subclasses of :class:`CommandListener`, :class:`ServerHeartbeatListener`, :class:`ServerListener`, or :class:`TopologyListener`. """ if not isinstance(listener, _EventListener): raise...
def register(listener): """Register a global event listener. :Parameters: - `listener`: A subclasses of :class:`CommandListener`, :class:`ServerHeartbeatListener`, :class:`ServerListener`, or :class:`TopologyListener`. """ if not isinstance(listener, _EventListener): raise...
[ "Register", "a", "global", "event", "listener", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L303-L322
[ "def", "register", "(", "listener", ")", ":", "if", "not", "isinstance", "(", "listener", ",", "_EventListener", ")", ":", "raise", "TypeError", "(", "\"Listeners for %s must be either a \"", "\"CommandListener, ServerHeartbeatListener, \"", "\"ServerListener, or TopologyList...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.event_listeners
List of registered event listeners.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def event_listeners(self): """List of registered event listeners.""" return (self.__command_listeners[:], self.__server_heartbeat_listeners[:], self.__server_listeners[:], self.__topology_listeners[:])
def event_listeners(self): """List of registered event listeners.""" return (self.__command_listeners[:], self.__server_heartbeat_listeners[:], self.__server_listeners[:], self.__topology_listeners[:])
[ "List", "of", "registered", "event", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L711-L716
[ "def", "event_listeners", "(", "self", ")", ":", "return", "(", "self", ".", "__command_listeners", "[", ":", "]", ",", "self", ".", "__server_heartbeat_listeners", "[", ":", "]", ",", "self", ".", "__server_listeners", "[", ":", "]", ",", "self", ".", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_command_start
Publish a CommandStartedEvent to all command listeners. :Parameters: - `command`: The command document. - `database_name`: The name of the database this command was run against. - `request_id`: The request id for this operation. - `connection_id`: The address...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_command_start(self, command, database_name, request_id, connection_id, op_id=None): """Publish a CommandStartedEvent to all command listeners. :Parameters: - `command`: The command document. - `database_name`: The name of the database this c...
def publish_command_start(self, command, database_name, request_id, connection_id, op_id=None): """Publish a CommandStartedEvent to all command listeners. :Parameters: - `command`: The command document. - `database_name`: The name of the database this c...
[ "Publish", "a", "CommandStartedEvent", "to", "all", "command", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L718-L739
[ "def", "publish_command_start", "(", "self", ",", "command", ",", "database_name", ",", "request_id", ",", "connection_id", ",", "op_id", "=", "None", ")", ":", "if", "op_id", "is", "None", ":", "op_id", "=", "request_id", "event", "=", "CommandStartedEvent", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_command_success
Publish a CommandSucceededEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `reply`: The server reply document. - `command_name`: The command name. - `request_id`: The request id for this operation. - `co...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_command_success(self, duration, reply, command_name, request_id, connection_id, op_id=None): """Publish a CommandSucceededEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `reply`: T...
def publish_command_success(self, duration, reply, command_name, request_id, connection_id, op_id=None): """Publish a CommandSucceededEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `reply`: T...
[ "Publish", "a", "CommandSucceededEvent", "to", "all", "command", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L741-L762
[ "def", "publish_command_success", "(", "self", ",", "duration", ",", "reply", ",", "command_name", ",", "request_id", ",", "connection_id", ",", "op_id", "=", "None", ")", ":", "if", "op_id", "is", "None", ":", "op_id", "=", "request_id", "event", "=", "Co...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_command_failure
Publish a CommandFailedEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `failure`: The server reply document or failure description document. - `command_name`: The command name. - `request_id`: The req...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_command_failure(self, duration, failure, command_name, request_id, connection_id, op_id=None): """Publish a CommandFailedEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `failure`: ...
def publish_command_failure(self, duration, failure, command_name, request_id, connection_id, op_id=None): """Publish a CommandFailedEvent to all command listeners. :Parameters: - `duration`: The command duration as a datetime.timedelta. - `failure`: ...
[ "Publish", "a", "CommandFailedEvent", "to", "all", "command", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L764-L786
[ "def", "publish_command_failure", "(", "self", ",", "duration", ",", "failure", ",", "command_name", ",", "request_id", ",", "connection_id", ",", "op_id", "=", "None", ")", ":", "if", "op_id", "is", "None", ":", "op_id", "=", "request_id", "event", "=", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_heartbeat_started
Publish a ServerHeartbeatStartedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_heartbeat_started(self, connection_id): """Publish a ServerHeartbeatStartedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. """ event = ServerHeartbeatStartedEvent(connection_id) ...
def publish_server_heartbeat_started(self, connection_id): """Publish a ServerHeartbeatStartedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. """ event = ServerHeartbeatStartedEvent(connection_id) ...
[ "Publish", "a", "ServerHeartbeatStartedEvent", "to", "all", "server", "heartbeat", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L788-L800
[ "def", "publish_server_heartbeat_started", "(", "self", ",", "connection_id", ")", ":", "event", "=", "ServerHeartbeatStartedEvent", "(", "connection_id", ")", "for", "subscriber", "in", "self", ".", "__server_heartbeat_listeners", ":", "try", ":", "subscriber", ".", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_heartbeat_succeeded
Publish a ServerHeartbeatSucceededEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. - `duration`: The execution time of the event in the highest possible resolution for the platform. - `reply`:...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_heartbeat_succeeded(self, connection_id, duration, reply): """Publish a ServerHeartbeatSucceededEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. ...
def publish_server_heartbeat_succeeded(self, connection_id, duration, reply): """Publish a ServerHeartbeatSucceededEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. ...
[ "Publish", "a", "ServerHeartbeatSucceededEvent", "to", "all", "server", "heartbeat", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L802-L818
[ "def", "publish_server_heartbeat_succeeded", "(", "self", ",", "connection_id", ",", "duration", ",", "reply", ")", ":", "event", "=", "ServerHeartbeatSucceededEvent", "(", "duration", ",", "reply", ",", "connection_id", ")", "for", "subscriber", "in", "self", "."...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_heartbeat_failed
Publish a ServerHeartbeatFailedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. - `duration`: The execution time of the event in the highest possible resolution for the platform. - `reply`: Th...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_heartbeat_failed(self, connection_id, duration, reply): """Publish a ServerHeartbeatFailedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. - `duration`: The execution time of the event i...
def publish_server_heartbeat_failed(self, connection_id, duration, reply): """Publish a ServerHeartbeatFailedEvent to all server heartbeat listeners. :Parameters: - `connection_id`: The address (host/port pair) of the connection. - `duration`: The execution time of the event i...
[ "Publish", "a", "ServerHeartbeatFailedEvent", "to", "all", "server", "heartbeat", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L820-L835
[ "def", "publish_server_heartbeat_failed", "(", "self", ",", "connection_id", ",", "duration", ",", "reply", ")", ":", "event", "=", "ServerHeartbeatFailedEvent", "(", "duration", ",", "reply", ",", "connection_id", ")", "for", "subscriber", "in", "self", ".", "_...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_opened
Publish a ServerOpeningEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_opened(self, server_address, topology_id): """Publish a ServerOpeningEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of...
def publish_server_opened(self, server_address, topology_id): """Publish a ServerOpeningEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of...
[ "Publish", "a", "ServerOpeningEvent", "to", "all", "server", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L837-L850
[ "def", "publish_server_opened", "(", "self", ",", "server_address", ",", "topology_id", ")", ":", "event", "=", "ServerOpeningEvent", "(", "server_address", ",", "topology_id", ")", "for", "subscriber", "in", "self", ".", "__server_listeners", ":", "try", ":", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_closed
Publish a ServerClosedEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_closed(self, server_address, topology_id): """Publish a ServerClosedEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of....
def publish_server_closed(self, server_address, topology_id): """Publish a ServerClosedEvent to all server listeners. :Parameters: - `server_address`: The address (host/port pair) of the server. - `topology_id`: A unique identifier for the topology this server is a part of....
[ "Publish", "a", "ServerClosedEvent", "to", "all", "server", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L852-L865
[ "def", "publish_server_closed", "(", "self", ",", "server_address", ",", "topology_id", ")", ":", "event", "=", "ServerClosedEvent", "(", "server_address", ",", "topology_id", ")", "for", "subscriber", "in", "self", ".", "__server_listeners", ":", "try", ":", "s...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_server_description_changed
Publish a ServerDescriptionChangedEvent to all server listeners. :Parameters: - `previous_description`: The previous server description. - `server_address`: The address (host/port pair) of the server. - `new_description`: The new server description. - `topology_id`: A unique...
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_server_description_changed(self, previous_description, new_description, server_address, topology_id): """Publish a ServerDescriptionChangedEvent to all server listeners. :Parameters: - `previous_d...
def publish_server_description_changed(self, previous_description, new_description, server_address, topology_id): """Publish a ServerDescriptionChangedEvent to all server listeners. :Parameters: - `previous_d...
[ "Publish", "a", "ServerDescriptionChangedEvent", "to", "all", "server", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L867-L886
[ "def", "publish_server_description_changed", "(", "self", ",", "previous_description", ",", "new_description", ",", "server_address", ",", "topology_id", ")", ":", "event", "=", "ServerDescriptionChangedEvent", "(", "previous_description", ",", "new_description", ",", "se...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_topology_opened
Publish a TopologyOpenedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_topology_opened(self, topology_id): """Publish a TopologyOpenedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of. """ event = TopologyOpenedEvent(topology_id) for subscribe...
def publish_topology_opened(self, topology_id): """Publish a TopologyOpenedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of. """ event = TopologyOpenedEvent(topology_id) for subscribe...
[ "Publish", "a", "TopologyOpenedEvent", "to", "all", "topology", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L888-L900
[ "def", "publish_topology_opened", "(", "self", ",", "topology_id", ")", ":", "event", "=", "TopologyOpenedEvent", "(", "topology_id", ")", "for", "subscriber", "in", "self", ".", "__topology_listeners", ":", "try", ":", "subscriber", ".", "opened", "(", "event",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_topology_closed
Publish a TopologyClosedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_topology_closed(self, topology_id): """Publish a TopologyClosedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of. """ event = TopologyClosedEvent(topology_id) for subscribe...
def publish_topology_closed(self, topology_id): """Publish a TopologyClosedEvent to all topology listeners. :Parameters: - `topology_id`: A unique identifier for the topology this server is a part of. """ event = TopologyClosedEvent(topology_id) for subscribe...
[ "Publish", "a", "TopologyClosedEvent", "to", "all", "topology", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L902-L914
[ "def", "publish_topology_closed", "(", "self", ",", "topology_id", ")", ":", "event", "=", "TopologyClosedEvent", "(", "topology_id", ")", "for", "subscriber", "in", "self", ".", "__topology_listeners", ":", "try", ":", "subscriber", ".", "closed", "(", "event",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_EventListeners.publish_topology_description_changed
Publish a TopologyDescriptionChangedEvent to all topology listeners. :Parameters: - `previous_description`: The previous topology description. - `new_description`: The new topology description. - `topology_id`: A unique identifier for the topology this server is a part of.
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
def publish_topology_description_changed(self, previous_description, new_description, topology_id): """Publish a TopologyDescriptionChangedEvent to all topology listeners. :Parameters: - `previous_description`: The previous topology description. ...
def publish_topology_description_changed(self, previous_description, new_description, topology_id): """Publish a TopologyDescriptionChangedEvent to all topology listeners. :Parameters: - `previous_description`: The previous topology description. ...
[ "Publish", "a", "TopologyDescriptionChangedEvent", "to", "all", "topology", "listeners", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L916-L932
[ "def", "publish_topology_description_changed", "(", "self", ",", "previous_description", ",", "new_description", ",", "topology_id", ")", ":", "event", "=", "TopologyDescriptionChangedEvent", "(", "previous_description", ",", "new_description", ",", "topology_id", ")", "f...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PostfixCheck._get_postqueue_stats
root@postfix:/opt/datadog-agent/agent/checks.d# postqueue -p ----Queue ID----- --Size-- ---Arrival Time---- --Sender/Recipient------ 3xWyLP6Nmfz23fk 367 Tue Aug 15 16:17:33 root@postfix.devnull.home (deferred transport) ...
postfix/datadog_checks/postfix/postfix.py
def _get_postqueue_stats(self, postfix_config_dir, tags): # get some intersting configuratin values from postconf pc_output, _, _ = get_subprocess_output(['postconf', 'mail_version'], self.log, False) postfix_version = pc_output.strip('\n').split('=')[1].strip() pc_output, _, _ = get_su...
def _get_postqueue_stats(self, postfix_config_dir, tags): # get some intersting configuratin values from postconf pc_output, _, _ = get_subprocess_output(['postconf', 'mail_version'], self.log, False) postfix_version = pc_output.strip('\n').split('=')[1].strip() pc_output, _, _ = get_su...
[ "root@postfix", ":", "/", "opt", "/", "datadog", "-", "agent", "/", "agent", "/", "checks", ".", "d#", "postqueue", "-", "p", "----", "Queue", "ID", "-----", "--", "Size", "--", "---", "Arrival", "Time", "----", "--", "Sender", "/", "Recipient", "-----...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/postfix/datadog_checks/postfix/postfix.py#L117-L170
[ "def", "_get_postqueue_stats", "(", "self", ",", "postfix_config_dir", ",", "tags", ")", ":", "# get some intersting configuratin values from postconf", "pc_output", ",", "_", ",", "_", "=", "get_subprocess_output", "(", "[", "'postconf'", ",", "'mail_version'", "]", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
integrations
Generates a markdown file containing the list of integrations shipped in 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/integrations.py
def integrations(since, to, write, force): """ Generates a markdown file containing the list of integrations shipped in 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 ...
def integrations(since, to, write, force): """ Generates a markdown file containing the list of integrations shipped in 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 ...
[ "Generates", "a", "markdown", "file", "containing", "the", "list", "of", "integrations", "shipped", "in", "a", "given", "Agent", "release", ".", "Agent", "version", "numbers", "are", "derived", "inspecting", "tags", "on", "integrations", "-", "core", "so", "ru...
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/agent/integrations.py#L25-L59
[ "def", "integrations", "(", "since", ",", "to", ",", "write", ",", "force", ")", ":", "agent_tags", "=", "get_agent_tags", "(", "since", ",", "to", ")", "# get the list of integrations shipped with the agent from the requirements file", "req_file_name", "=", "os", "."...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PgBouncer._collect_stats
Query pgbouncer for various metrics
pgbouncer/datadog_checks/pgbouncer/pgbouncer.py
def _collect_stats(self, db, instance_tags): """Query pgbouncer for various metrics """ metric_scope = [self.STATS_METRICS, self.POOLS_METRICS, self.DATABASES_METRICS] try: with db.cursor(cursor_factory=pgextras.DictCursor) as cursor: for scope in metric_sco...
def _collect_stats(self, db, instance_tags): """Query pgbouncer for various metrics """ metric_scope = [self.STATS_METRICS, self.POOLS_METRICS, self.DATABASES_METRICS] try: with db.cursor(cursor_factory=pgextras.DictCursor) as cursor: for scope in metric_sco...
[ "Query", "pgbouncer", "for", "various", "metrics" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/pgbouncer/datadog_checks/pgbouncer/pgbouncer.py#L92-L134
[ "def", "_collect_stats", "(", "self", ",", "db", ",", "instance_tags", ")", ":", "metric_scope", "=", "[", "self", ".", "STATS_METRICS", ",", "self", ".", "POOLS_METRICS", ",", "self", ".", "DATABASES_METRICS", "]", "try", ":", "with", "db", ".", "cursor",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PgBouncer._get_connect_kwargs
Get the params to pass to psycopg2.connect() based on passed-in vals from yaml settings file
pgbouncer/datadog_checks/pgbouncer/pgbouncer.py
def _get_connect_kwargs(self, host, port, user, password, database_url): """ Get the params to pass to psycopg2.connect() based on passed-in vals from yaml settings file """ if database_url: return {'dsn': database_url} if not host: raise CheckExc...
def _get_connect_kwargs(self, host, port, user, password, database_url): """ Get the params to pass to psycopg2.connect() based on passed-in vals from yaml settings file """ if database_url: return {'dsn': database_url} if not host: raise CheckExc...
[ "Get", "the", "params", "to", "pass", "to", "psycopg2", ".", "connect", "()", "based", "on", "passed", "-", "in", "vals", "from", "yaml", "settings", "file" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/pgbouncer/datadog_checks/pgbouncer/pgbouncer.py#L136-L157
[ "def", "_get_connect_kwargs", "(", "self", ",", "host", ",", "port", ",", "user", ",", "password", ",", "database_url", ")", ":", "if", "database_url", ":", "return", "{", "'dsn'", ":", "database_url", "}", "if", "not", "host", ":", "raise", "CheckExceptio...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
PgBouncer._get_connection
Get and memoize connections to instances
pgbouncer/datadog_checks/pgbouncer/pgbouncer.py
def _get_connection(self, key, host='', port='', user='', password='', database_url='', tags=None, use_cached=True): "Get and memoize connections to instances" if key in self.dbs and use_cached: return self.dbs[key] try: connect_kwargs = self._get_connect_kwargs( ...
def _get_connection(self, key, host='', port='', user='', password='', database_url='', tags=None, use_cached=True): "Get and memoize connections to instances" if key in self.dbs and use_cached: return self.dbs[key] try: connect_kwargs = self._get_connect_kwargs( ...
[ "Get", "and", "memoize", "connections", "to", "instances" ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/pgbouncer/datadog_checks/pgbouncer/pgbouncer.py#L159-L188
[ "def", "_get_connection", "(", "self", ",", "key", ",", "host", "=", "''", ",", "port", "=", "''", ",", "user", "=", "''", ",", "password", "=", "''", ",", "database_url", "=", "''", ",", "tags", "=", "None", ",", "use_cached", "=", "True", ")", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
ElectionRecord.seconds_until_renew
Returns the number of seconds between the current time and the set renew time. It can be negative if the leader election is running late.
datadog_checks_base/datadog_checks/base/checks/kube_leader/record.py
def seconds_until_renew(self): """ Returns the number of seconds between the current time and the set renew time. It can be negative if the leader election is running late. """ delta = self.renew_time - datetime.now(self.renew_time.tzinfo) return delta.total_secon...
def seconds_until_renew(self): """ Returns the number of seconds between the current time and the set renew time. It can be negative if the leader election is running late. """ delta = self.renew_time - datetime.now(self.renew_time.tzinfo) return delta.total_secon...
[ "Returns", "the", "number", "of", "seconds", "between", "the", "current", "time", "and", "the", "set", "renew", "time", ".", "It", "can", "be", "negative", "if", "the", "leader", "election", "is", "running", "late", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/kube_leader/record.py#L76-L83
[ "def", "seconds_until_renew", "(", "self", ")", ":", "delta", "=", "self", ".", "renew_time", "-", "datetime", ".", "now", "(", "self", ".", "renew_time", ".", "tzinfo", ")", "return", "delta", ".", "total_seconds", "(", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_make_error
Create and return an error document.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def _make_error(index, code, errmsg, operation): """Create and return an error document. """ return { _UINDEX: index, _UCODE: code, _UERRMSG: errmsg, _UOP: operation }
def _make_error(index, code, errmsg, operation): """Create and return an error document. """ return { _UINDEX: index, _UCODE: code, _UERRMSG: errmsg, _UOP: operation }
[ "Create", "and", "return", "an", "error", "document", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L91-L99
[ "def", "_make_error", "(", "index", ",", "code", ",", "errmsg", ",", "operation", ")", ":", "return", "{", "_UINDEX", ":", "index", ",", "_UCODE", ":", "code", ",", "_UERRMSG", ":", "errmsg", ",", "_UOP", ":", "operation", "}" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_merge_legacy
Merge a result from a legacy opcode into the full results.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def _merge_legacy(run, full_result, result, index): """Merge a result from a legacy opcode into the full results. """ affected = result.get('n', 0) errmsg = result.get("errmsg", result.get("err", "")) if errmsg: # wtimeout is not considered a hard failure in # MongoDB 2.6 so don't t...
def _merge_legacy(run, full_result, result, index): """Merge a result from a legacy opcode into the full results. """ affected = result.get('n', 0) errmsg = result.get("errmsg", result.get("err", "")) if errmsg: # wtimeout is not considered a hard failure in # MongoDB 2.6 so don't t...
[ "Merge", "a", "result", "from", "a", "legacy", "opcode", "into", "the", "full", "results", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L102-L142
[ "def", "_merge_legacy", "(", "run", ",", "full_result", ",", "result", ",", "index", ")", ":", "affected", "=", "result", ".", "get", "(", "'n'", ",", "0", ")", "errmsg", "=", "result", ".", "get", "(", "\"errmsg\"", ",", "result", ".", "get", "(", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_merge_command
Merge a group of results from write commands into the full result.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def _merge_command(run, full_result, results): """Merge a group of results from write commands into the full result. """ for offset, result in results: affected = result.get("n", 0) if run.op_type == _INSERT: full_result["nInserted"] += affected elif run.op_type == _DE...
def _merge_command(run, full_result, results): """Merge a group of results from write commands into the full result. """ for offset, result in results: affected = result.get("n", 0) if run.op_type == _INSERT: full_result["nInserted"] += affected elif run.op_type == _DE...
[ "Merge", "a", "group", "of", "results", "from", "write", "commands", "into", "the", "full", "result", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L145-L198
[ "def", "_merge_command", "(", "run", ",", "full_result", ",", "results", ")", ":", "for", "offset", ",", "result", "in", "results", ":", "affected", "=", "result", ".", "get", "(", "\"n\"", ",", "0", ")", "if", "run", ".", "op_type", "==", "_INSERT", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Run.add
Add an operation to this Run instance. :Parameters: - `original_index`: The original index of this operation within a larger bulk operation. - `operation`: The operation document.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def add(self, original_index, operation): """Add an operation to this Run instance. :Parameters: - `original_index`: The original index of this operation within a larger bulk operation. - `operation`: The operation document. """ self.index_map.append(orig...
def add(self, original_index, operation): """Add an operation to this Run instance. :Parameters: - `original_index`: The original index of this operation within a larger bulk operation. - `operation`: The operation document. """ self.index_map.append(orig...
[ "Add", "an", "operation", "to", "this", "Run", "instance", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L79-L88
[ "def", "add", "(", "self", ",", "original_index", ",", "operation", ")", ":", "self", ".", "index_map", ".", "append", "(", "original_index", ")", "self", ".", "ops", ".", "append", "(", "operation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.add_insert
Add an insert document to the list of ops.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def add_insert(self, document): """Add an insert document to the list of ops. """ validate_is_document_type("document", document) # Generate ObjectId client side. if not (isinstance(document, RawBSONDocument) or '_id' in document): document['_id'] = ObjectId() ...
def add_insert(self, document): """Add an insert document to the list of ops. """ validate_is_document_type("document", document) # Generate ObjectId client side. if not (isinstance(document, RawBSONDocument) or '_id' in document): document['_id'] = ObjectId() ...
[ "Add", "an", "insert", "document", "to", "the", "list", "of", "ops", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L219-L226
[ "def", "add_insert", "(", "self", ",", "document", ")", ":", "validate_is_document_type", "(", "\"document\"", ",", "document", ")", "# Generate ObjectId client side.", "if", "not", "(", "isinstance", "(", "document", ",", "RawBSONDocument", ")", "or", "'_id'", "i...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.add_replace
Create a replace document and add it to the list of ops.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def add_replace(self, selector, replacement, upsert=False, collation=None): """Create a replace document and add it to the list of ops. """ validate_ok_for_replace(replacement) cmd = SON([('q', selector), ('u', replacement), ('multi', False), ('upse...
def add_replace(self, selector, replacement, upsert=False, collation=None): """Create a replace document and add it to the list of ops. """ validate_ok_for_replace(replacement) cmd = SON([('q', selector), ('u', replacement), ('multi', False), ('upse...
[ "Create", "a", "replace", "document", "and", "add", "it", "to", "the", "list", "of", "ops", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L241-L252
[ "def", "add_replace", "(", "self", ",", "selector", ",", "replacement", ",", "upsert", "=", "False", ",", "collation", "=", "None", ")", ":", "validate_ok_for_replace", "(", "replacement", ")", "cmd", "=", "SON", "(", "[", "(", "'q'", ",", "selector", ")...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.add_delete
Create a delete document and add it to the list of ops.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def add_delete(self, selector, limit, collation=None): """Create a delete document and add it to the list of ops. """ cmd = SON([('q', selector), ('limit', limit)]) collation = validate_collation_or_none(collation) if collation is not None: self.uses_collation = True ...
def add_delete(self, selector, limit, collation=None): """Create a delete document and add it to the list of ops. """ cmd = SON([('q', selector), ('limit', limit)]) collation = validate_collation_or_none(collation) if collation is not None: self.uses_collation = True ...
[ "Create", "a", "delete", "document", "and", "add", "it", "to", "the", "list", "of", "ops", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L254-L262
[ "def", "add_delete", "(", "self", ",", "selector", ",", "limit", ",", "collation", "=", "None", ")", ":", "cmd", "=", "SON", "(", "[", "(", "'q'", ",", "selector", ")", ",", "(", "'limit'", ",", "limit", ")", "]", ")", "collation", "=", "validate_c...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.gen_ordered
Generate batches of operations, batched by type of operation, in the order **provided**.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def gen_ordered(self): """Generate batches of operations, batched by type of operation, in the order **provided**. """ run = None for idx, (op_type, operation) in enumerate(self.ops): if run is None: run = _Run(op_type) elif run.op_type != ...
def gen_ordered(self): """Generate batches of operations, batched by type of operation, in the order **provided**. """ run = None for idx, (op_type, operation) in enumerate(self.ops): if run is None: run = _Run(op_type) elif run.op_type != ...
[ "Generate", "batches", "of", "operations", "batched", "by", "type", "of", "operation", "in", "the", "order", "**", "provided", "**", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L264-L276
[ "def", "gen_ordered", "(", "self", ")", ":", "run", "=", "None", "for", "idx", ",", "(", "op_type", ",", "operation", ")", "in", "enumerate", "(", "self", ".", "ops", ")", ":", "if", "run", "is", "None", ":", "run", "=", "_Run", "(", "op_type", "...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.gen_unordered
Generate batches of operations, batched by type of operation, in arbitrary order.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def gen_unordered(self): """Generate batches of operations, batched by type of operation, in arbitrary order. """ operations = [_Run(_INSERT), _Run(_UPDATE), _Run(_DELETE)] for idx, (op_type, operation) in enumerate(self.ops): operations[op_type].add(idx, operation) ...
def gen_unordered(self): """Generate batches of operations, batched by type of operation, in arbitrary order. """ operations = [_Run(_INSERT), _Run(_UPDATE), _Run(_DELETE)] for idx, (op_type, operation) in enumerate(self.ops): operations[op_type].add(idx, operation) ...
[ "Generate", "batches", "of", "operations", "batched", "by", "type", "of", "operation", "in", "arbitrary", "order", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L278-L288
[ "def", "gen_unordered", "(", "self", ")", ":", "operations", "=", "[", "_Run", "(", "_INSERT", ")", ",", "_Run", "(", "_UPDATE", ")", ",", "_Run", "(", "_DELETE", ")", "]", "for", "idx", ",", "(", "op_type", ",", "operation", ")", "in", "enumerate", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.execute_command
Execute using write commands.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def execute_command(self, sock_info, generator, write_concern): """Execute using write commands. """ # nModified is only reported for write commands, not legacy ops. full_result = { "writeErrors": [], "writeConcernErrors": [], "nInserted": 0, ...
def execute_command(self, sock_info, generator, write_concern): """Execute using write commands. """ # nModified is only reported for write commands, not legacy ops. full_result = { "writeErrors": [], "writeConcernErrors": [], "nInserted": 0, ...
[ "Execute", "using", "write", "commands", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L290-L332
[ "def", "execute_command", "(", "self", ",", "sock_info", ",", "generator", ",", "write_concern", ")", ":", "# nModified is only reported for write commands, not legacy ops.", "full_result", "=", "{", "\"writeErrors\"", ":", "[", "]", ",", "\"writeConcernErrors\"", ":", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.execute_no_results
Execute all operations, returning no results (w=0).
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def execute_no_results(self, sock_info, generator): """Execute all operations, returning no results (w=0). """ # Cannot have both unacknowledged write and bypass document validation. if self.bypass_doc_val and sock_info.max_wire_version >= 4: raise OperationFailure("Cannot se...
def execute_no_results(self, sock_info, generator): """Execute all operations, returning no results (w=0). """ # Cannot have both unacknowledged write and bypass document validation. if self.bypass_doc_val and sock_info.max_wire_version >= 4: raise OperationFailure("Cannot se...
[ "Execute", "all", "operations", "returning", "no", "results", "(", "w", "=", "0", ")", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L334-L384
[ "def", "execute_no_results", "(", "self", ",", "sock_info", ",", "generator", ")", ":", "# Cannot have both unacknowledged write and bypass document validation.", "if", "self", ".", "bypass_doc_val", "and", "sock_info", ".", "max_wire_version", ">=", "4", ":", "raise", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.execute_legacy
Execute using legacy wire protocol ops.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def execute_legacy(self, sock_info, generator, write_concern): """Execute using legacy wire protocol ops. """ coll = self.collection full_result = { "writeErrors": [], "writeConcernErrors": [], "nInserted": 0, "nUpserted": 0, "n...
def execute_legacy(self, sock_info, generator, write_concern): """Execute using legacy wire protocol ops. """ coll = self.collection full_result = { "writeErrors": [], "writeConcernErrors": [], "nInserted": 0, "nUpserted": 0, "n...
[ "Execute", "using", "legacy", "wire", "protocol", "ops", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L386-L463
[ "def", "execute_legacy", "(", "self", ",", "sock_info", ",", "generator", ",", "write_concern", ")", ":", "coll", "=", "self", ".", "collection", "full_result", "=", "{", "\"writeErrors\"", ":", "[", "]", ",", "\"writeConcernErrors\"", ":", "[", "]", ",", ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
_Bulk.execute
Execute operations.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def execute(self, write_concern): """Execute operations. """ if not self.ops: raise InvalidOperation('No operations to execute') if self.executed: raise InvalidOperation('Bulk operations can ' 'only be executed once.') se...
def execute(self, write_concern): """Execute operations. """ if not self.ops: raise InvalidOperation('No operations to execute') if self.executed: raise InvalidOperation('Bulk operations can ' 'only be executed once.') se...
[ "Execute", "operations", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L465-L495
[ "def", "execute", "(", "self", ",", "write_concern", ")", ":", "if", "not", "self", ".", "ops", ":", "raise", "InvalidOperation", "(", "'No operations to execute'", ")", "if", "self", ".", "executed", ":", "raise", "InvalidOperation", "(", "'Bulk operations can ...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkUpsertOperation.update_one
Update one document matching the selector. :Parameters: - `update` (dict): the update operations to apply
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def update_one(self, update): """Update one document matching the selector. :Parameters: - `update` (dict): the update operations to apply """ self.__bulk.add_update(self.__selector, update, multi=False, upsert=True, ...
def update_one(self, update): """Update one document matching the selector. :Parameters: - `update` (dict): the update operations to apply """ self.__bulk.add_update(self.__selector, update, multi=False, upsert=True, ...
[ "Update", "one", "document", "matching", "the", "selector", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L509-L517
[ "def", "update_one", "(", "self", ",", "update", ")", ":", "self", ".", "__bulk", ".", "add_update", "(", "self", ".", "__selector", ",", "update", ",", "multi", "=", "False", ",", "upsert", "=", "True", ",", "collation", "=", "self", ".", "__collation...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkUpsertOperation.replace_one
Replace one entire document matching the selector criteria. :Parameters: - `replacement` (dict): the replacement document
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def replace_one(self, replacement): """Replace one entire document matching the selector criteria. :Parameters: - `replacement` (dict): the replacement document """ self.__bulk.add_replace(self.__selector, replacement, upsert=True, collation=sel...
def replace_one(self, replacement): """Replace one entire document matching the selector criteria. :Parameters: - `replacement` (dict): the replacement document """ self.__bulk.add_replace(self.__selector, replacement, upsert=True, collation=sel...
[ "Replace", "one", "entire", "document", "matching", "the", "selector", "criteria", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L529-L536
[ "def", "replace_one", "(", "self", ",", "replacement", ")", ":", "self", ".", "__bulk", ".", "add_replace", "(", "self", ".", "__selector", ",", "replacement", ",", "upsert", "=", "True", ",", "collation", "=", "self", ".", "__collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkWriteOperation.remove_one
Remove a single document matching the selector criteria.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def remove_one(self): """Remove a single document matching the selector criteria. """ self.__bulk.add_delete(self.__selector, _DELETE_ONE, collation=self.__collation)
def remove_one(self): """Remove a single document matching the selector criteria. """ self.__bulk.add_delete(self.__selector, _DELETE_ONE, collation=self.__collation)
[ "Remove", "a", "single", "document", "matching", "the", "selector", "criteria", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L577-L581
[ "def", "remove_one", "(", "self", ")", ":", "self", ".", "__bulk", ".", "add_delete", "(", "self", ".", "__selector", ",", "_DELETE_ONE", ",", "collation", "=", "self", ".", "__collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkWriteOperation.remove
Remove all documents matching the selector criteria.
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def remove(self): """Remove all documents matching the selector criteria. """ self.__bulk.add_delete(self.__selector, _DELETE_ALL, collation=self.__collation)
def remove(self): """Remove all documents matching the selector criteria. """ self.__bulk.add_delete(self.__selector, _DELETE_ALL, collation=self.__collation)
[ "Remove", "all", "documents", "matching", "the", "selector", "criteria", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L583-L587
[ "def", "remove", "(", "self", ")", ":", "self", ".", "__bulk", ".", "add_delete", "(", "self", ".", "__selector", ",", "_DELETE_ALL", ",", "collation", "=", "self", ".", "__collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
train
BulkOperationBuilder.find
Specify selection criteria for bulk operations. :Parameters: - `selector` (dict): the selection criteria for update and remove operations. - `collation` (optional): An instance of :class:`~pymongo.collation.Collation`. This option is only supported on Mon...
tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py
def find(self, selector, collation=None): """Specify selection criteria for bulk operations. :Parameters: - `selector` (dict): the selection criteria for update and remove operations. - `collation` (optional): An instance of :class:`~pymongo.collation.Collati...
def find(self, selector, collation=None): """Specify selection criteria for bulk operations. :Parameters: - `selector` (dict): the selection criteria for update and remove operations. - `collation` (optional): An instance of :class:`~pymongo.collation.Collati...
[ "Specify", "selection", "criteria", "for", "bulk", "operations", "." ]
DataDog/integrations-core
python
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L635-L654
[ "def", "find", "(", "self", ",", "selector", ",", "collation", "=", "None", ")", ":", "validate_is_mapping", "(", "\"selector\"", ",", "selector", ")", "return", "BulkWriteOperation", "(", "selector", ",", "self", ".", "__bulk", ",", "collation", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd