Remote carbonlink fix #169

Closed
wants to merge 4 commits into
from

Projects

None yet

2 participants

Accessing metric when on remote server throws exception.

Thu Feb 28 13:35:38 2013 :: Exception Caught
Traceback (most recent call last):
File "/opt/graphite/webapp/graphite/render/datalib.py", line 226, in fetchData
cachedResults = CarbonLink.query(dbFile.real_metric)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 135, in query
results = self.send_request(request)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 158, in send_request
conn = self.get_connection(host)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 125, in get_connection
connection.connect( (server, port) )
File "", line 1, in connect
error: [Errno 111] Connection refused

or if no local carbon-cache:

Fri Feb 22 13:47:00 2013 :: Exception Caught
Traceback (most recent call last):
File "/opt/graphite/webapp/graphite/render/datalib.py", line 226, in fetchData
cachedResults = CarbonLink.query(dbFile.real_metric)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 135, in query
results = self.send_request(request)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 157, in send_request
host = self.select_host(metric)
File "/opt/graphite/webapp/graphite/render/datalib.py", line 109, in select_host
return self.hash_ring.get_node(metric)
File "/opt/graphite/webapp/graphite/render/hashing.py", line 83, in get_node
index %= len(self.ring)
ZeroDivisionError: integer division or modulo by zero

I stop trying to pull data from carbon-cache if the metric is found on a remote server since the local carbon-cache is it exists doesn't contains data about this metric.

Owner

Thanks for the fix, I'm pretty sure this is reasonable behavior to have. The node who has the metric data should be responsible for doing the carbon query. Without this fix, some installs may be querying their carbon-cache more than necessary.

Manually merged this into 0.9.x since it was on master pre-split of 0.9.x

@mleinart mleinart closed this Aug 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment