| :py:mod:`airflow.providers.datadog.hooks.datadog` |
| ================================================= |
| |
| .. py:module:: airflow.providers.datadog.hooks.datadog |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.datadog.hooks.datadog.DatadogHook |
| |
| |
| |
| |
| .. py:class:: DatadogHook(datadog_conn_id = 'datadog_default') |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook`, :py:obj:`airflow.utils.log.logging_mixin.LoggingMixin` |
| |
| Uses datadog API to send metrics of practically anything measurable, |
| so it's possible to track # of db records inserted/deleted, records read |
| from file and many other useful metrics. |
| |
| Depends on the datadog API, which has to be deployed on the same server where |
| Airflow runs. |
| |
| :param datadog_conn_id: The connection to datadog, containing metadata for api keys. |
| |
| .. py:method:: validate_response(self, response) |
| |
| Validate Datadog response |
| |
| |
| .. py:method:: send_metric(self, metric_name, datapoint, tags = None, type_ = None, interval = None) |
| |
| Sends a single datapoint metric to DataDog |
| |
| :param metric_name: The name of the metric |
| :param datapoint: A single integer or float related to the metric |
| :param tags: A list of tags associated with the metric |
| :param type_: Type of your metric: gauge, rate, or count |
| :param interval: If the type of the metric is rate or count, define the corresponding interval |
| |
| |
| .. py:method:: query_metric(self, query, from_seconds_ago, to_seconds_ago) |
| |
| Queries datadog for a specific metric, potentially with some |
| function applied to it and returns the results. |
| |
| :param query: The datadog query to execute (see datadog docs) |
| :param from_seconds_ago: How many seconds ago to start querying for. |
| :param to_seconds_ago: Up to how many seconds ago to query for. |
| |
| |
| .. py:method:: post_event(self, title, text, aggregation_key = None, alert_type = None, date_happened = None, handle = None, priority = None, related_event_id = None, tags = None, device_name = None) |
| |
| Posts an event to datadog (processing finished, potentially alerts, other issues) |
| Think about this as a means to maintain persistence of alerts, rather than |
| alerting itself. |
| |
| :param title: The title of the event |
| :param text: The body of the event (more information) |
| :param aggregation_key: Key that can be used to aggregate this event in a stream |
| :param alert_type: The alert type for the event, one of |
| ["error", "warning", "info", "success"] |
| :param date_happened: POSIX timestamp of the event; defaults to now |
| :handle: User to post the event as; defaults to owner of the application key used |
| to submit. |
| :param handle: str |
| :param priority: Priority to post the event as. ("normal" or "low", defaults to "normal") |
| :param related_event_id: Post event as a child of the given event |
| :param tags: List of tags to apply to the event |
| :param device_name: device_name to post the event with |
| |
| |
| |