Skip to content

Use the text/plain content type for the Web Exporter

Joel Low requested to merge lowjoel/gitlab-monitor:fix-content-type into master

According to https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md, the proper content-type to be returned by the exporter should be text/plain.

The default for Sinatra is currently text/html:

curl -v http://localhost:9168/sidekiq
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 9168 (#0)
> GET /sidekiq HTTP/1.1
> Host: localhost:9168
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK 
< Content-Type: text/html;charset=utf-8
< Content-Length: 20281
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Server: WEBrick/1.3.1 (Ruby/2.4.4/2018-03-28)
< Date: Tue, 17 Jul 2018 04:57:30 GMT
< Connection: Keep-Alive
< 

This allows other metrics engines, such as DataDog, to be able to retrieve statistics from GitLab.

Merge request reports