class_docstr: Uses datadog API to send metrics of practically anything measurable.
  
  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.
class_docstr_tok: ["Uses","datadog","API","to","send","metrics","of","practically","anything","measurable",".","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","."]
docstr: Query datadog for a metric, potentially with some function applied to it and return the result.
  
  :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.
docstr_tok: ["Query","datadog","for","a","metric",",","potentially","with","some","function","applied","to","it","and","return","the","result",".",":","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","."]
code: def query_metric(
      self, query: str, from_seconds_ago: int, to_seconds_ago: int
  ) -> dict[str, Any]:
      """
      Query datadog for a metric, potentially with some function applied to it and return the result.
  
      :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.
      """
      now = int(time.time())
  
      response = api.Metric.query(
          start=now - from_seconds_ago,
          end=now - to_seconds_ago,
          query=query,
      )
  
      self.validate_response(response)
      return response
  
file_path: airflow/airflow/providers/datadog/hooks/datadog.py
imports: from __future__ import annotations
  import time
  from typing import Any
  from datadog import api, initialize
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 4 for calling the DatadogHook obj's underlying member method code with example usage: obj.query_metric(query, from_seconds_ago, to_seconds_ago) and returns: response