Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upGetting error "expected label name, got \"BCLOSE\"" #5196
Comments
This comment has been minimized.
This comment has been minimized.
|
Here is a sample of the metrics being scraped. |
codesome
changed the title
Getting error expected label name, got "BCLOSE"
Getting error "expected label name, got \"BCLOSE\""
Feb 10, 2019
This comment has been minimized.
This comment has been minimized.
|
Looking at this unit test here prometheus/pkg/textparse/openmetricsparse_test.go Lines 333 to 336 in 4cb6c20 I suspect it is causing because of ,} at the end of your metrics, i.e. the content type of the target is "application/openmetrics-text", but the metrics don't comply with it.
Can you let us know that is the content/media type of |
This comment has been minimized.
This comment has been minimized.
|
Content-Type is text/plain;charset=ISO-8859-1 I also suspected the |
This comment has been minimized.
This comment has been minimized.
|
That charset isn't right, it should be utf-8, but I don't see any non-ASCII characters. |
This comment has been minimized.
This comment has been minimized.
|
I think my content type is wrong still actually. I just realized the content type is dictated by the requests accept header. I wasn't sending that when testing with postman to get the metrics so I get text/plain. (Not sure about the charset. I'll have to investigate that separately in my app.) If I set the request to header to |
This comment has been minimized.
This comment has been minimized.
|
That seems to be the issue. The "Accept" header in the scrape request from Prometheus is Looking at the following in prometheus code: Lines 452 to 454 in 4cb6c20 It seems that prometheus is always going to request |
This comment has been minimized.
This comment has been minimized.
|
The simpleclient only produces Prometheus textformat, and sets the Content-Type accordingly. This sounds like a bug in your http handling. |
This comment has been minimized.
This comment has been minimized.
|
You could be right. This is an inherited Spring MVC project that hadn't been updated for years when I took over. I've been slowly bringing it to the modern world and it may be that some of the annotations need to be updated to produce correct Content-Types. The behavior of the current annotation seems to be always as I described, set the Content-Type based on the "Accept" header. But there may be another option. Let me do some more researching. I still think it might be a good idea to enable explicitly specifying a metric format type in the scrape config. |
This comment has been minimized.
This comment has been minimized.
|
We're sending appropriate headers, I don't think we should be adding configuration options for broken http servers. |
This comment has been minimized.
This comment has been minimized.
|
Are you really sending appropriate headers though if you specify you only accept "openmetrics-text" but you also accept "text/plain" (or whatever the Content-Type of prometheus format metrics is)? Seems you should send the accept header for the context type expected. Even stipulating that my http handling is not correct it seems it would also be incorrect for simple client to receive a request for open metrics and then produce prometheus metrics. I may be thinking incorrectly here but from my point of view you'd be adding configuration options for correctly configured http servers and it's only broken ones that would be functioning based on your request headers. |
This comment has been minimized.
This comment has been minimized.
|
We accept both and that's what our Accept header says. The problem is that your response has mismatched content and Content-Type. |
This comment has been minimized.
This comment has been minimized.
|
Ah yes! Sorry, I was missing that you specified both types in the Accept header! I have tested using the exact accept header you supply and have managed to change my app to supply the correct Content-Type. Prometheus is scraping it now. |
wraithfive commentedFeb 8, 2019
•
edited
Bug Report
I have a spring application that exposes metrics via micrometer. After upgrading to Prometheus 2.7.1 (from a 2.6.x release) when scrapping that application I now get the error "expected label name, got "BCLOSE""
Environment
System information:
Linux 3.10.0-957.1.3.el7.x86_64 x86_64
Prometheus version:
prometheus, version 2.7.1 (branch: HEAD, revision: 62e591f)
build user: root@f9f82868fc43
build date: 20190131-11:16:59
go version: go1.11.5
Prometheus configuration file: