epoch8 / airflow-exporter

Airflow plugin to export dag and task based metrics to Prometheus.
Other
248 stars 75 forks source link

UnknownFormatError: Unsupported content-type provided: text #24

Closed szyn closed 6 years ago

szyn commented 6 years ago

Hi, I get the following error when using Datadog with Prometheus integration.

prometheus (3.0.0)
------------------
    Instance ID: prometheus:99fffad4f445db41 [ERROR]
    Total Runs: 2
    Metric Samples: 0, Total: 0
    Events: 0, Total: 0
    Service Checks: 1, Total: 2
    Average Execution Time : 17ms
    Error: Unsupported content-type provided: text
    Traceback (most recent call last):
    File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/base/checks/base.py", line 366, in run
        self.check(copy.deepcopy(self.instances[0]))
    File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/base/checks/prometheus/base_check.py", line 108, in check
        ignore_unmapped=True
    File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/base/checks/prometheus/mixins.py", line 392, in process
        for metric in self.scrape_metrics(endpoint):
    File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/base/checks/prometheus/mixins.py", line 366, in scrape_metrics
        for metric in self.parse_metric_family(response):
    File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/base/checks/prometheus/mixins.py", line 235, in parse_metric_family
        response.headers['Content-Type']))
    UnknownFormatError: Unsupported content-type provided: text

The cause of the error is mimetype='text'. https://github.com/epoch8/airflow-exporter/blob/master/prometheus_exporter.py#L125

As prometheus/client_python, we have better to use text/plain instead of text.

elephantum commented 6 years ago

@szyn thanks for reporting and fixing!

szyn commented 6 years ago

@elephantum Thank you, too!