How to use the datadog.statsd.event function in datadog

To help you get started, we’ve selected a few datadog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NCI-GDC / gdcdatamodel / zug / datamodel / latest_urls.py View on Github external
def parse_archive_url(archive):
    archive_url = archive['dcc_archive_url']
    archive_ok = True
    if (archive_url.startswith(OPEN_BASE_URL)):
        # open archive
        archive['protected'] = False
    elif (archive_url.startswith(PROTECTED_BASE_URL)):
        # protected archive
        archive['protected'] = True
    else:
        tags = [
            'tcga_latest_urls',
        ]

        statsd.event(
            'TCGA URL not found',
            'URL {} has unexpected prefix'.format(archive["dcc_archive_url"]),
            source_type_name='tcga_archive_check',
            alert_type='warning',
            tags=tags
        )
        logger.warning("url {} has unexpected prefix".format(archive["dcc_archive_url"]))
        archive_ok = False
        #raise RuntimeError("url {} has unexpected prefix".format(archive["dcc_archive_url"]))

    if archive_ok:
        logger.debug('archive_url: %s' % archive_url)
        parts = archive_url.split('/')

        if (parts[8].upper() != archive['disease_code']):
            logger.warning("Unmatched disease code between Archive URL and "
github NCI-GDC / gdcdatamodel / zug / harmonize / abstract_harmonizer.py View on Github external
def submit_event(self, name, description, alert_type='info'):
        self.log.info("[datadog] submit event {}".format(name))
        tags=["alignment_type:{}".format(self.name),
              "alignment_host:{}".format(socket.gethostname())]

        statsd.event(name, description, source_type_name='harmonization',
                     alert_type=alert_type,
                     tags=tags)
    @abstractmethod
github NCI-GDC / gdcdatamodel / zug / datamodel / psqlgraph2json.py View on Github external
def warning(self, title, text, tags=[], *args, **kwargs):
        log.warning("{}: {}".format(title, text))
        statsd.event(
            title,
            text,
            source_type_name="esbuild",
            alert_type="warning",
            tags=tags,
        )
github NCI-GDC / gdcdatamodel / zug / harmonize / tcga_mirnaseq_aligner.py View on Github external
def docker_failure_cleanup(self):
        tags = [
            'alignment_type:{}'.format(self.name),
            'alignment_host:{}'.format(socket.gethostname()),
        ]
        
        statsd.event(
            'Alignment Failure',
            'alignment of %s has failed' % self.inputs['bam'].node_id,
            source_type_name='harmonization',
            alert_type='error',
            tags=tags,
        )
        
        return super(TCGAMIRNASeqAligner, self).docker_failure_cleanup()
github NCI-GDC / gdcdatamodel / zug / datamodel / psqlgraph2json.py View on Github external
def error(self, title, text, tags=[], *args, **kwargs):
        log.error("{}: {}".format(title, text))
        statsd.event(
            title,
            text,
            source_type_name="esbuild",
            alert_type="error",
            tags=tags,
        )
github NCI-GDC / gdcdatamodel / zug / harmonize / bwa_aligner.py View on Github external
def submit_metrics(self):
        """
        Submit metrics to datadog
        """
        self.log.info("Submitting metrics")
        took = int(time.time()) - self.start_time
        input_id = self.inputs["bam"].node_id

        tags=["alignment_type:{}".format(self.name),
              "alignment_host:{}".format(socket.gethostname())]
        statsd.event(
            "{} aligned".format(input_id),
            "successfully aligned {} in {} minutes".format(input_id, took / 60),
            source_type_name="harmonization",
            alert_type="success",
            tags=tags
        )
        with self.graph.session_scope():
            total = self.bam_files.count()
            done = self.bam_files.filter(File.derived_files.any()).count()
        self.log.info("%s bams aligned out of %s", done, total)
        statsd.gauge('harmonization.completed_bams',
                     done,
                     tags=tags)
        statsd.gauge('harmonization.total_bams',
                     total,
                     tags=tags)