Skip to content

Commit 57b0b85

Browse files
PokomzalegralaDuologic
authored
static-exporter: Update httpd.conf file to include headers (#1361)
* static-exporter: Update httpd.conf file to include headers Prometheus v3.0.0 has a stricter requirements on the headers that are returned from exporters. The static-exporter does not set any headers and causes scrapes to fail with the following error: ``` non-compliant scrape target sending blank Content-Type and no fallback_scrape_protocol specified for target ```` ``` This adds an httpd.conf file to mount to the container that includes a directive to add a header that solves this problem. To generate the httpd.conf file, I ran the following command: `docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > my-httpd.conf` * Mount the httpdConfig to the filesystem * Include withSubPath mixin volumeMount mixin * Move httpConfig setup to a method so it's opt in * Add reference to name that can be called elsewhere * Update withHttpConfig() to accept a config that can be patched * Update configMap to have a prefix with the name and a suffix foir -httpd-config * Update README.md for static-exporter to add explicit instructions to update the httpd.conf * Update static-exporter/httpd.conf Co-authored-by: Jeroen Op 't Eynde <[email protected]> --------- Co-authored-by: Zach Leslie <[email protected]> Co-authored-by: Jeroen Op 't Eynde <[email protected]>
1 parent 51cad60 commit 57b0b85

File tree

3 files changed

+587
-0
lines changed

3 files changed

+587
-0
lines changed

static-exporter/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,22 @@ local static_exporter = import 'github.com/grafana/jsonnet-libs/static-expoter/m
4343
]),
4444
}
4545
```
46+
47+
## Updating httpd.conf
48+
49+
There is a default httpd.conf that was added to this library.
50+
It was generated by running the following:
51+
52+
```
53+
docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf httpd.conf
54+
```
55+
56+
If there is a downstream change that requires updating this config file, run the above command and then add the following snippet to the `<Directory "/usr/local/apache2/htdocs"` block:
57+
58+
```
59+
<IfModule mod_headers.c>
60+
Header set Content-Type: "text/plain; version=0.0.4"
61+
</IfModule>
62+
```
63+
64+
This change adds a Header to the requests that enables Prometheus 3.x to scrape the static exporter.

0 commit comments

Comments
 (0)