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

ValueError: dictionary update sequence element #0 has length 1; 2 is required #8

Open
pengguoyong opened this issue May 8, 2020 · 4 comments

Comments

@pengguoyong
Copy link

$ docker run --rm -v /Users/test/git/prometheus_aci_exporter/examples/aci.yml:/etc/prometheus_aci_exporter/aci.yml -p 9377:9377 -it ravualhemio/prometheus_aci_exporter

Exception happened during processing of request from ('172.17.0.1', 57602)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "./prometheus_aci_exporter.py", line 513, in do_GET
generated_lines = [
File "./prometheus_aci_exporter.py", line 513, in
generated_lines = [
File "./prometheus_aci_exporter.py", line 246, in collect
yield from self.collect_fabric(fabric_name, fabric, controller, common_queries)
File "./prometheus_aci_exporter.py", line 334, in collect_fabric
labels.update(updated_labels)
ValueError: dictionary update sequence element #0 has length 1; 2 is required

@pengguoyong
Copy link
Author

Hello experts,
The above is the error output of docker run CLI. Could you tell me what is the cause of this issue? Thanks!

@RavuAlHemio
Copy link
Owner

I have modified the code to provide a bit more context about this issue. Please try running the newest version of the container and posting the new error message here.

@pengguoyong
Copy link
Author

@RavuAlHemio Many thanks for your reply!
I tried to run the latest version, but there are new issue the below.

Exception happened during processing of request from ('172.17.0.1', 58006)
Traceback (most recent call last):
File "./prometheus_aci_exporter.py", line 335, in collect_fabric
labels.update(updated_labels)
ValueError: dictionary update sequence element #0 has length 1; 2 is required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "./prometheus_aci_exporter.py", line 519, in do_GET
generated_lines = [
File "./prometheus_aci_exporter.py", line 519, in
generated_lines = [
File "./prometheus_aci_exporter.py", line 246, in collect
yield from self.collect_fabric(fabric_name, fabric, controller, common_queries)
File "./prometheus_aci_exporter.py", line 337, in collect_fabric
raise ValueError(f"failed to update labels in query {query_name!r} with {updated_labels!r}: {ex}")
ValueError: failed to update labels in query 'interface_rx_stats' with 'topology/pod-1/node-201/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min': dictionary update sequence element #0 has length 1; 2 is required

@RavuAlHemio
Copy link
Owner

I think I've understood the issue: the regex that should extract the labels from the DN does not work with this DN format, so instead of producing a dictionary (of labels and their values), the function produces a string (the DN itself).

A quick fix in aci.yml would be adding regex_must_match: true right under the regex: [...] line under the only entry in common_queries -> interface_rx_stats -> labels (that's line 113 of the current revision of examples/aci.yml). You might also have to do the same for interface_tx_stats.

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