Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errant quotes in .prom files break exporting of data. #38

Open
ish-owi opened this issue Apr 12, 2023 · 1 comment
Open

errant quotes in .prom files break exporting of data. #38

ish-owi opened this issue Apr 12, 2023 · 1 comment

Comments

@ish-owi
Copy link

ish-owi commented Apr 12, 2023

When you run a python script that uses p4python in windows it reports its' version with quotes in the string (this does not happen when it is run in Linux) this then does not get sanitized when being pulled by the exporter which in turn breaks the node exporter with the following error level=error ts=2023-04-12T01:00:40.552Z caller=textfile.go:209 collector=textfile msg="failed to collect textfile data" file=p4_cmds.prom err="failed to parse textfile data from \"/var/lib/node_exporter/p4_cmds.prom\": text format parsing error in line 968: unexpected end of label value \"unnamed_p4-python_script_[PY3.9.4/P4PY\""

on the different platforms on my system the revision is reported as on windows. P4PYTHON/"NTX64"/"2022.1"/"2369090" ("2022.1/2361553" API) ("2022"/"11"/"11"). and on Linux as P4PYTHON/LINUX54X86_64/2022.1/2405572 (2022.1/2361553 API) (2023/02/09). to see this on your side open a python instance and

>>> import P4
>>> print(P4.P4.identify())

while there is an argument that this is something that p4python could fix, I am unable to post issues to that repo and this change on the side of P4Prometheus would make it more robust

@rcowham
Copy link
Contributor

rcowham commented Apr 13, 2023

Thanks for this - can insert some filtering to remove (like it does for other similar chars).

marcoperezowi pushed a commit to marcoperezowi/p4python that referenced this issue Apr 13, 2023
This is so revision strings appear without quotes while still producing
valid compilation commands.
Adresses bug reported in p4prometheus:
perforce/p4prometheus#38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants