This is breaking prometheus 3.0.0 crawling 2 exporters of mine that use this crate. Is it know we don't send a Content-Type response on purpose?
Prometheus Error
Error scraping target: non-compliant scrape target sending blank Content-Type and no fallback_scrape_protocol specified for target
Working response vs non working response
cooper@home1:~$ curl -v http://10.254.254.24:9342/metrics
* Trying 10.254.254.24:9342...
* Connected to 10.254.254.24 (10.254.254.24) port 9342
> GET /metrics HTTP/1.1
> Host: 10.254.254.24:9342
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; version=0.0.4; charset=utf-8; escaping=underscores
< Date: Tue, 19 Nov 2024 03:12:03 GMT
< Transfer-Encoding: chunked
<
----
cooper@home1:~$ curl -v http://[::1]:1/metrics
* Trying [::1]:1...
* Connected to ::1 (::1) port 1
> GET /metrics HTTP/1.1
> Host: [::1]:1
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: tiny-http (Rust)
< Date: Tue, 19 Nov 2024 03:14:54 GMT
< Content-Length: 8719
Will read the code, but is there anything this crate is doing to supress tiny_http's response? A default hello world tiny_http server responds correctly:
+ let server = Server::http("0.0.0.0:8000").unwrap();
+
+ for request in server.incoming_requests() {
+ println!(
+ "received request! method: {:?}, url: {:?}, headers: {:?}",
+ request.method(),
+ request.url(),
+ request.headers()
+ );
+
+ let response = Response::from_string("hello world");
+ request.respond(response)?;
+ }
+
Ok(())
}
crl-m1:~ cooper$ curl -v http://127.0.0.1:8000/
* Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000
> GET / HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Server: tiny-http (Rust)
< Date: Tue, 19 Nov 2024 03:43:03 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 11
<
* Connection #0 to host 127.0.0.1 left intact
hello world
This is breaking prometheus 3.0.0 crawling 2 exporters of mine that use this crate. Is it know we don't send a
Content-Type
response on purpose?Prometheus Error
Working response vs non working response
Will read the code, but is there anything this crate is doing to supress
tiny_http
's response? A default hello world tiny_http server responds correctly: