diff --git a/lib/inc/drogon/utils/monitoring/Gauge.h b/lib/inc/drogon/utils/monitoring/Gauge.h index 99de3df8..9a4b065b 100644 --- a/lib/inc/drogon/utils/monitoring/Gauge.h +++ b/lib/inc/drogon/utils/monitoring/Gauge.h @@ -91,7 +91,7 @@ class Gauge : public Metric static std::string_view type() { - return "counter"; + return "gauge"; } void setToCurrentTime() diff --git a/lib/src/PromExporter.cc b/lib/src/PromExporter.cc index 65941411..3628f43e 100644 --- a/lib/src/PromExporter.cc +++ b/lib/src/PromExporter.cc @@ -28,6 +28,7 @@ void PromExporter::initAndStart(const Json::Value &config) } auto resp = HttpResponse::newHttpResponse(); resp->setBody(thisPtr->exportMetrics()); + resp->setContentTypeCode(CT_TEXT_PLAIN); resp->setExpiredTime(5); callback(resp); }, @@ -118,12 +119,12 @@ static std::string exportCollector( .append(collector->name()) .append(" ") .append(collector->help()) - .append("\r\n"); + .append("\n"); res.append("# TYPE ") .append(collector->name()) .append(" ") .append(collector->type()) - .append("\r\n"); + .append("\n"); for (auto const &sampleGroup : sampleGroups) { auto const &metricPtr = sampleGroup.metric; @@ -157,11 +158,11 @@ static std::string exportCollector( res.append(" ") .append(std::to_string( sample.timestamp.microSecondsSinceEpoch() / 1000)) - .append("\r\n"); + .append("\n"); } else { - res.append("\r\n"); + res.append("\n"); } } }